public function processWindow($window, $id, $ctrl, $param1, $param2)
 {
     global $neardBs, $neardCore, $neardConfig, $neardBins, $neardLang, $neardWinbinder;
     foreach ($neardBins->getServices() as $sName => $service) {
         $name = $neardBins->getApache()->getName() . ' ' . $neardBins->getApache()->getVersion();
         $port = $neardBins->getApache()->getPort();
         if ($sName == BinMysql::SERVICE_NAME) {
             $name = $neardBins->getMysql()->getName() . ' ' . $neardBins->getMysql()->getVersion();
             $port = $neardBins->getMysql()->getPort();
         } elseif ($sName == BinMariadb::SERVICE_NAME) {
             $name = $neardBins->getMariadb()->getName() . ' ' . $neardBins->getMariadb()->getVersion();
             $port = $neardBins->getMariadb()->getPort();
         } elseif ($sName == BinFilezilla::SERVICE_NAME) {
             $name = $neardBins->getFilezilla()->getName() . ' ' . $neardBins->getFilezilla()->getVersion();
             $port = $neardBins->getFilezilla()->getPort();
         }
         $name .= ' (' . $service->getName() . ')';
         $this->splash->incrProgressBar();
         $this->splash->setTextLoading(sprintf($neardLang->getValue(Lang::EXIT_REMOVE_SERVICE_TEXT), $name));
         $service->delete();
     }
     $this->splash->incrProgressBar();
     $this->splash->setTextLoading($neardLang->getValue(Lang::EXIT_STOP_OTHER_PROCESS_TEXT));
     Win32Ps::killBins(true);
     $neardWinbinder->destroyWindow($window);
 }
 public function register()
 {
     // Params
     set_time_limit(0);
     clearstatcache();
     // Error log
     $this->initErrorHandling();
     // External classes
     require_once $this->getCorePath() . '/classes/class.util.php';
     Util::logSeparator();
     // Autoloader
     require_once $this->getCorePath() . '/classes/class.autoloader.php';
     $neardAutoloader = new Autoloader();
     $neardAutoloader->register();
     // Load
     self::loadCore();
     self::loadConfig();
     self::loadLang();
     self::loadBins();
     self::loadTools();
     self::loadApps();
     self::loadWinbinder();
     self::loadRegistry();
     self::loadHomepage();
     // Init
     if ($this->isBootstrap) {
         $this->procs = Win32Ps::getListProcs();
     }
 }
 public function __construct($args)
 {
     global $neardCore, $neardBins;
     Util::startLoading();
     foreach ($neardBins->getServices() as $sName => $service) {
         $service->delete();
     }
     Win32Ps::killBins(true);
     $neardCore->setExec(ActionExec::RESTART);
     Util::stopLoading();
 }
示例#4
0
 public static function exitApp($restart = false)
 {
     global $neardBs, $neardCore;
     $content = 'PING 1.1.1.1 -n 1 -w 2000 > nul' . PHP_EOL;
     $content .= '"' . $neardBs->getExeFilePath() . '" -quit -id={neard}' . PHP_EOL;
     if ($restart) {
         $basename = 'restartApp';
         Util::logInfo('Restart App');
         $content .= '"' . $neardCore->getPhpCliSilentExe() . '" "' . Core::BOOTSTRAP_FILE . '" "' . Action::RESTART . '"' . PHP_EOL;
     } else {
         $basename = 'exitApp';
         Util::logInfo('Exit App');
     }
     Win32Ps::killBins();
     self::execStandalone($basename, $content);
 }
 private function procReload($args)
 {
     global $neardBs, $neardBins, $neardWinbinder;
     if (!Util::isLaunched()) {
         $this->addLog(APP_TITLE . ' is not started.');
         $neardWinbinder->exec($neardBs->getExeFilePath(), null, false);
         $this->addLog('Start ' . APP_TITLE);
         $this->setStatus(self::STATUS_WARNING);
         return;
     }
     $this->addLog('Remove services');
     foreach ($neardBins->getServices() as $sName => $service) {
         if ($service->delete()) {
             $this->addLog('- ' . $sName . ': OK');
         } else {
             $this->addLog('- ' . $sName . ': KO');
             $this->setStatus(self::STATUS_ERROR);
         }
     }
     Win32Ps::killBins();
     $this->addLog('Start services');
     foreach ($neardBins->getServices() as $sName => $service) {
         $service->create();
         if ($service->start()) {
             $this->addLog('- ' . $sName . ': OK');
         } else {
             $this->addLog('- ' . $sName . ': KO');
             $this->setStatus(self::STATUS_ERROR);
         }
     }
 }
示例#6
0
 public static function stopLoading()
 {
     global $neardCore;
     if (file_exists($neardCore->getLoadingPid())) {
         $pids = file($neardCore->getLoadingPid());
         foreach ($pids as $pid) {
             Win32Ps::kill($pid);
         }
         @unlink($neardCore->getLoadingPid());
     }
 }
 private function killPhpInstances()
 {
     global $neardCore, $neardLang;
     $this->splash->setTextLoading($neardLang->getValue(Lang::STARTUP_KILL_OLD_PROCS_TEXT));
     $this->splash->incrProgressBar();
     $procsKilled = Win32Ps::killBins();
     if (!empty($procsKilled)) {
         $this->writeLog('Procs killed:');
         $procsKilledSort = array();
         foreach ($procsKilled as $proc) {
             $unixExePath = Util::formatUnixPath($proc[Win32Ps::EXECUTABLE_PATH]);
             $procsKilledSort[] = '-> ' . basename($unixExePath) . ' (PID ' . $proc[Win32Ps::PROCESS_ID] . ') in ' . $unixExePath;
         }
         sort($procsKilledSort);
         foreach ($procsKilledSort as $proc) {
             $this->writeLog($proc);
         }
     }
 }