本文整理汇总了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");
}