395 return rtrim(str_replace([
"\\",
".php",
"phar://", rtrim(str_replace([
"\\",
"phar://"], [
"/",
""], \
pocketmine\PATH),
"/"), rtrim(str_replace([
"\\",
"phar://"], [
"/",
""], \
pocketmine\PLUGIN_PATH),
"/")], [
"/",
"",
"",
"",
""], $path),
"/");
400 if(php_sapi_name() !==
"cli"){
401 $logger->critical(
"You must run GenisysPro using the CLI.");
405 if(!extension_loaded(
"sockets")){
406 $logger->critical(
"Unable to find the Socket extension.");
411 if(substr_count($pthreads_version,
".") < 2){
414 if(version_compare($pthreads_version,
"3.1.5") < 0){
415 $logger->critical(
"pthreads >= 3.1.5 is required, while you have $pthreads_version.");
419 if(!extension_loaded(
"uopz")){
423 if(extension_loaded(
"pocketmine")){
424 if(version_compare(phpversion(
"pocketmine"),
"0.0.1") < 0){
425 $logger->critical(
"You have the native GenisysPro extension, but your version is lower than 0.0.1.");
427 }elseif(version_compare(phpversion(
"pocketmine"),
"0.0.4") > 0){
428 $logger->critical(
"You have the native GenisysPro extension, but your version is higher than 0.0.4.");
433 if(extension_loaded(
"xdebug")){
434 $logger->warning(
"You are running GenisysPro with Xdebug enabled. This has a major impact on performance.");
437 if(!extension_loaded(
"curl")){
438 $logger->critical(
"Unable to find the cURL extension.");
442 if(!extension_loaded(
"yaml")){
443 $logger->critical(
"Unable to find the YAML extension.");
447 if(!extension_loaded(
"zlib")){
448 $logger->critical(
"Unable to find the Zlib extension.");
453 $logger->critical(
"Please update or recompile PHP.");
459 if(file_exists(\
pocketmine\PATH .
".git/HEAD")){
460 $ref = trim(file_get_contents(\
pocketmine\PATH .
".git/HEAD"));
461 if(preg_match(
'/^[0-9a-f]{40}$/i', $ref)){
462 define(
'pocketmine\GIT_COMMIT', strtolower($ref));
463 }elseif(substr($ref, 0, 5) ===
"ref: "){
464 $refFile = \pocketmine\PATH .
".git/" . substr(trim(file_get_contents(\
pocketmine\PATH .
".git/HEAD")), 5);
465 if(is_file($refFile)){
466 define(
'pocketmine\GIT_COMMIT', strtolower(trim(file_get_contents($refFile))));
470 if(!defined(
'pocketmine\GIT_COMMIT')){
471 define(
'pocketmine\GIT_COMMIT',
"0000000000000000000000000000000000000000");
474 @define(
"ENDIANNESS", (pack(
"d", 1) ===
"\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
475 @define(
"INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
476 @ini_set(
"opcache.mmap_base", bin2hex(random_bytes(8)));
478 if(!file_exists(\
pocketmine\DATA .
"server.properties") and !isset($opts[
"no-wizard"])){
479 $installer =
new Installer();
480 if(!$installer->run()){
487 if(\Phar::running(
true) ===
""){
488 $logger->warning(
"Non-packaged GenisysPro installation detected, do not use on production.");
491 ThreadManager::init();
494 $logger->info(
"Stopping other threads");
501 foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
502 $logger->debug(
"Stopping " . $thread->getThreadName() .
" thread");
505 $logger->debug($thread->getThreadName() .
" thread stopped successfully.");
508 $logger->debug(
"Could not stop " . $thread->getThreadName() .
" thread: " . $e->getMessage());
515 echo Terminal::$FORMAT_RESET . PHP_EOL;
517 if($erroredThreads > 0){
519 echo
"Some threads could not be stopped, performing a force-kill" . PHP_EOL . PHP_EOL;