function checkAppPaths() { $ok = true; if (!defined('JELIX_LIB_PATH') || !App::isInit()) { throw new \Exception($this->messages->get('path.core')); } if (!file_exists(App::tempBasePath()) || !is_writable(App::tempBasePath())) { $this->error('path.temp'); $ok = false; } if (!file_exists(App::logPath()) || !is_writable(App::logPath())) { $this->error('path.log'); $ok = false; } if (!file_exists(App::varPath())) { $this->error('path.var'); $ok = false; } if (!file_exists(App::appConfigPath())) { $this->error('path.config'); $ok = false; } if (!file_exists(App::configPath())) { $this->error('path.config'); $ok = false; } elseif ($this->checkForInstallation) { if (!is_writable(App::configPath())) { $this->error('path.config.writable'); $ok = false; } if (file_exists(App::configPath('profiles.ini.php')) && !is_writable(App::configPath('profiles.ini.php'))) { $this->error('path.profiles.writable'); $ok = false; } if (file_exists(App::configPath('installer.ini.php')) && !is_writable(App::configPath('installer.ini.php'))) { $this->error('path.installer.writable'); $ok = false; } } if (!file_exists(App::wwwPath())) { $this->error('path.www'); $ok = false; } foreach ($this->otherPaths as $path) { $realPath = \jFile::parseJelixPath($path); if (!file_exists($realPath)) { $this->error('path.custom.not.exists', array($path)); $ok = false; } else { if (!is_writable($realPath)) { $this->error('path.custom.writable', array($path)); $ok = false; } else { $this->ok('path.custom.ok', array($path)); } } } if ($ok) { $this->ok('paths.ok'); } else { throw new \Exception($this->messages->get('too.critical.error')); } return $ok; }
} // ------------- retrieve the name of the jelix command if ($_SERVER['argc'] < 2) { echo "Error: command is missing. See '" . $_SERVER['argv'][0] . " help'.\n"; exit(1); } $argv = $_SERVER['argv']; $scriptName = array_shift($argv); // shift the script name $commandName = array_shift($argv); // get the command name // ------------ load the config and retrieve the command object require JELIX_SCRIPTS_PATH . 'includes/JelixScript.class.php'; set_error_handler('JelixScript::errorHandler'); set_exception_handler('JelixScript::exceptionHandler'); $config = JelixScript::loadConfig(); $command = JelixScript::getCommand($commandName, $config); if (!\Jelix\Core\App::isInit()) { echo "Error: should run within an application\n"; exit(1); } if ($command->applicationRequirement == JelixScriptCommand::APP_MUST_NOT_EXIST) { echo "Error: This command doesn't apply on an existing application\n"; exit(1); } \Jelix\Core\App::setEnv('jelix-scripts'); JelixScript::checkTempPath(); // --------- launch the command now $command->init($argv); $command->run(); exit(0);
public static function isInit() { return \Jelix\Core\App::isInit(); }