本文整理汇总了PHP中I2CE::getRuntimeVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE::getRuntimeVariable方法的具体用法?PHP I2CE::getRuntimeVariable怎么用?PHP I2CE::getRuntimeVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE
的用法示例。
在下文中一共展示了I2CE::getRuntimeVariable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* Upgrades the modules
* @param string $old_vers
* @param string $new_vers
* @returns boolean
*/
public function upgrade($old_vers, $new_vers)
{
I2CE::raiseError("upgrade {$old_vers} -- {$new_vers}");
if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.5.1')) {
if (!$this->updateConfigAltToLong()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.0.1')) {
if (!$this->updateConfigStatus()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.1')) {
if (!$this->dropOldCaches()) {
return false;
}
if (!$this->updateToInnoDB()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '3.2')) {
if (!$this->updateConfigProcessed()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '>=', '3.2') && I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) {
I2CE::raiseError("Clearing magic data cache for upgrade of I2CE");
if (!I2CE::getConfig()->clearCache()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.2')) {
if (!$this->addConfigPathIndex()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.3.6')) {
if (!$this->createAltConfig(true)) {
return false;
}
}
$config_protocol = strtolower(I2CE::getRuntimeVariable('I2CE_CONFIG_PROTOCOL', 'config_alt'));
if ($config_protocol == 'mongodb' && I2CE_Validate::checkVersion($old_vers, '<', '4.1.4.0')) {
if (!$this->createMongoDBConfig(true)) {
return false;
}
}
return true;
}
示例2: actionCommandLine
/**
* The business method if this page is called from the commmand line
* @param array $request_remainder the remainder of the request after the page specfication.
* @param array $args the array of unix style command line arguments
*/
protected function actionCommandLine($args, $request_remainder)
{
$config = I2CE::getConfig();
if (!$config->is_parent("/modules/forms/forms")) {
I2CE::raiseError("No Forms", E_USER_ERROR);
}
$config = I2CE::getConfig();
$module = $config->config->site->module;
if (!$module) {
I2CE::raiseError("No site module");
}
$formConfig = $config->modules->forms->forms;
$this->locale = I2CE::getRuntimeVariable('locale', false);
if (!$this->locale) {
$this->locale = I2CE_Locales::DEFAULT_LOCALE;
}
$this->locale = I2CE_Locales::ensureSelectableLocale($this->locale);
I2CE_Locales::setPreferredLocale($this->locale);
$forms = I2CE::getRuntimeVariable('forms', false);
if ($forms) {
$forms = explode(',', $forms);
} else {
$forms = $formConfig->getKeys('/modules/forms/forms');
$cli = new I2CE_CLI();
$forms = $cli->chooseMenuValues("Select Forms:", $forms);
}
if ($skipforms = I2CE::getRuntimeVariable('skipforms', false)) {
$skipforms = explode('#', $skipforms);
$t_forms = array();
foreach ($forms as $form) {
foreach ($skipforms as $skipform) {
if (preg_match('/' . $skipform . '/', $form)) {
continue 2;
}
}
$t_forms[] = $form;
}
$forms = $t_forms;
}
sort($forms, SORT_STRING);
switch ($this->page) {
case 'wiki':
$this->wiki($forms);
break;
case 'dot':
$this->dot($forms);
break;
case 'text':
default:
$this->text($forms);
break;
}
}
示例3: _updateSite
protected static function _updateSite($site_module_file, $verbose_errors = true)
{
$config = I2CE::getConfig();
$status = I2CE::allSystemsAreGoGo($site_module_file, true);
I2CE::raiseError("Updating site for {$site_module_file}: {$status}");
if (substr($status, 0, 11) == 'in_progress') {
if (array_key_exists('HTTP_HOST', $_SERVER)) {
if (array_key_exists('restart', $_GET)) {
$status = 'restart_' . substr($status, 12);
}
} else {
if (I2CE::getRuntimeVariable('force-restart')) {
$status = 'restart_' . substr($status, 12);
}
}
}
switch ($status) {
case 'done':
return true;
case 'no_site':
I2CE::raiseError("Cannot determine the site");
return false;
case 'restart_install':
case 'needs_install':
$config->__set("/config/site/installation", 'in_progress_install');
if (!self::install($site_module_file, substr($status, 0, 7) == 'restart', $verbose_errors)) {
I2CE::raiseError("Unseting at " . $config->getPath());
if (isset($config->config) && isset($config->config->site) && isset($config->config->site->installation)) {
unset($config->config->site->installation);
}
I2CE::raiseError("Installation of the site failed", E_USER_ERROR);
return false;
}
return !I2CE::hasWarnings();
case 'restart_reinstall':
case 'needs_reinstall':
$config->__set("/config/site/installation", 'in_progress_reinstall');
if (!self::reinstall($site_module_file, substr($status, 0, 7) == 'restart', $verbose_errors)) {
I2CE::raiseError("Reintiaizliation of site to new file {$site_module_file} failed", E_USER_ERROR);
return false;
}
return !I2CE::hasWarnings();
case 'restart_reenable':
case 'needs_reenable':
$config->__set("/config/site/installation", 'in_progress_reenable');
I2CE::setupFileSearch(array("CLASSES" => "./", 'MODULES' => array(dirname($site_module_file), dirname(dirname(__FILE__)))), true);
if ($config->setIfIsSet($site_module, '/config/site/module')) {
I2CE::raiseError("Somehow the site module {$site_module} was disabled. Attempting to enable");
$mod_factory = I2CE_ModuleFactory::instance();
$mod_factory->resetStoredLoadedPaths();
//$mod_factory->loadPaths(null,'CLASSES'); //make sure all of our classes are loaded.
//somehow the site module got disabled. this could happen, for example, if the paths got screwed up. lets try and correct things
if (!self::_updateModules($site_module)) {
I2CE::raiseError("Renabling failed for {$site_module} ", E_USER_ERROR);
return false;
}
return !I2CE::hasWarnings();
}
I2CE::raiseError("Lost the site module");
return false;
case 'restart_upgrade':
case 'needs_upgrade':
$config->__set("/config/site/installation", 'in_progress_upgrade');
$mod_factory = I2CE_ModuleFactory::instance();
$mod_factory->resetStoredLoadedPaths();
//$mod_factory->loadPaths(null,'CLASSES'); //make sure all of our classes are loaded.
I2CE::setupFileSearch(array("CLASSES" => "./", 'MODULES' => array(dirname($site_module_file), dirname(dirname(__FILE__)))), true);
if (!self::updateOutOfDateConfigFiles()) {
I2CE::raiseError("Error in checking configuration files", E_USER_ERROR);
return false;
}
$config->__set("/I2CE/update/times/last", time());
return !I2CE::hasWarnings();
//Ireturn true;
//Ireturn true;
case 'in_progress_reenable':
case 'in_progress_upgrade':
case 'in_progress_install':
case 'in_progress_reinstall':
if (array_key_exists('HTTP_HOST', $_SERVER)) {
I2CE::raiseError("System update is already in progress");
$url = $_SERVER['REQUEST_URI'];
if (!array_key_exists('restart', $_GET)) {
if (strlen($_SERVER['QUERY_STRING']) > 0) {
$url .= '&restart';
} else {
$url .= '?restart';
}
}
echo "<br/>Site update in progress. <a href='{$url}'>Restart</a>?";
$msg = "Site update in progress. Restart?";
echo "<script type='text/javascript'>if (confirm('{$msg}')) {setTimeout(function() {window.location= '{$url}';},500)}</script>";
//reload the requested page after 5 seconds
flush();
} else {
I2CE::raiseError("System update is already in progress. To force the restart add --force-restart=1");
}
return false;
default:
I2CE::raiseError("Unrecognized site status: {$status}");
//.........这里部分代码省略.........
示例4: launchBackgroundPage
/**
* @param mixed $obj Calling object
* @param string $page the name of the page to launch
* @param mixed $cl_args. String or array of string, the command line arguments. Defualts to empty arra.
*/
public static function launchBackgroundPage($obj, $page, $cl_args = array())
{
$script = $_SERVER['SCRIPT_FILENAME'];
if ($protocol = I2CE::getRuntimeVariable('I2CE_DB_PROTOCOL', '')) {
$cl_args[] = '--I2CE_DB_PROTOCOL=' . $protocol;
}
$cl_args[] = "--page={$page}";
$cl_args[] = "--nocheck=1";
//dont' check that all things are a gogo.. this update won't run
self::launchBackgroundPHPScript($obj, $script, $cl_args);
}