本文整理匯總了PHP中okapi\Okapi::execute_prerequest_cronjobs方法的典型用法代碼示例。如果您正苦於以下問題:PHP Okapi::execute_prerequest_cronjobs方法的具體用法?PHP Okapi::execute_prerequest_cronjobs怎麽用?PHP Okapi::execute_prerequest_cronjobs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類okapi\Okapi
的用法示例。
在下文中一共展示了Okapi::execute_prerequest_cronjobs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _call
private static function _call()
{
ignore_user_abort(true);
set_time_limit(0);
header("Content-Type: text/plain; charset=utf-8");
$current_ver = self::get_current_version();
$max_ver = self::get_max_version();
self::out("Current OKAPI database version: {$current_ver}\n");
if ($current_ver == 0 && (!isset($_GET['install']) || $_GET['install'] != 'true')) {
self::out("Current OKAPI settings are:\n\n" . Settings::describe_settings() . "\n\n" . "Make sure they are correct, then append '?install=true' to your query.");
try {
Db::select_value("select 1 from caches limit 1");
} catch (Exception $e) {
self::out("\n\n" . "IMPORTANT: If you're trying to install OKAPI on an empty database then\n" . "you will fail. OKAPI is not a standalone application, it is a plugin\n" . "for Opencaching sites. Please read this:\n\n" . "https://github.com/opencaching/okapi/issues/299");
}
return;
} elseif ($max_ver == $current_ver) {
self::out("It is up-to-date.\n\n");
} elseif ($max_ver < $current_ver) {
throw new Exception();
} else {
self::out("Updating to version {$max_ver}... PLEASE WAIT\n\n");
while ($current_ver < $max_ver) {
$version_to_apply = $current_ver + 1;
self::out("Applying mutation #{$version_to_apply}...");
try {
call_user_func(array(__CLASS__, "ver" . $version_to_apply));
self::out(" OK!\n");
Okapi::set_var('db_version', $version_to_apply);
$current_ver += 1;
} catch (Exception $e) {
self::out(" ERROR\n\n");
throw $e;
}
}
self::out("\nDatabase updated.\n\n");
}
self::out("Registering new cronjobs...\n");
# Validate all cronjobs (some might have been added).
Okapi::set_var("cron_nearest_event", 0);
Okapi::execute_prerequest_cronjobs();
self::out("\nUpdate complete.\n");
}