本文整理汇总了PHP中upgrade_core函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_core函数的具体用法?PHP upgrade_core怎么用?PHP upgrade_core使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_core函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: moodle_url
$PAGE->navbar->add($strplugincheck);
$PAGE->set_title($strplugincheck);
$PAGE->set_heading($strplugincheck);
$PAGE->set_cacheable(false);
$reloadurl = new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1));
if ($fetchupdates) {
// no sesskey support guaranteed here
available_update_checker::instance()->fetch();
redirect($reloadurl);
}
$output = $PAGE->get_renderer('core', 'admin');
echo $output->upgrade_plugin_check_page(plugin_manager::instance(), available_update_checker::instance(), $version, $showallplugins, $reloadurl, new moodle_url('/admin/index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1, 'confirmplugincheck' => 1)));
die;
} else {
// Launch main upgrade
upgrade_core($version, true);
}
}
}
} else {
if ($version < $CFG->version) {
// better stop here, we can not continue with plugin upgrades or anything else
throw new moodle_exception('downgradedcore', 'error', new moodle_url('/admin/'));
}
}
// Updated human-readable release version if necessary
if ($release != $CFG->release) {
// Update the release version
set_config('release', $release);
}
if (moodle_needs_upgrading()) {
开发者ID:numbas,项目名称:moodle,代码行数:31,代码来源:index.php
示例2: mnetadmin_rpc_upgrade
function mnetadmin_rpc_upgrade($user, $json_response = true)
{
global $CFG, $USER;
// Invoke local user and check his rights
if ($auth_response = invoke_local_user((array) $user)) {
if ($json_response) {
return $auth_response;
} else {
return json_decode($auth_response);
}
}
// Creating response
$response = new stdclass();
$response->status = RPC_SUCCESS;
require "{$CFG->dirroot}/version.php";
// defines $version, $release, $branch and $maturity
$CFG->target_release = $release;
// used during installation and upgrades
if ($version < $CFG->version) {
$response->status = RPC_FAILURE_RUN;
$response->error = get_string('downgradedcore', 'error');
$response->errors[] = get_string('downgradedcore', 'error');
if ($json_response) {
return json_encode($response);
} else {
return $response;
}
}
$oldversion = "{$CFG->release} ({$CFG->version})";
$newversion = "{$release} ({$version})";
if (!moodle_needs_upgrading()) {
$response->message = get_string('cliupgradenoneed', 'core_admin', $newversion);
if ($json_response) {
return json_encode($response);
} else {
return $response;
}
}
// debug_trace('Remote Upgrade : Environment check');
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_NEWER);
if (!$envstatus) {
$response->status = RPC_FAILURE_RUN;
$response->error = vmoodle_get_string('environmentissues', 'vmoodleadminset_upgrade');
$response->errors[] = vmoodle_get_string('environmentissues', 'vmoodleadminset_upgrade');
$response->detail = $environment_results;
if ($json_response) {
return json_encode($response);
} else {
return $response;
}
}
// Test plugin dependencies.
// debug_trace('Remote Upgrade : Plugins check');
$failed = array();
if (!plugin_manager::instance()->all_plugins_ok($version, $failed)) {
$response->status = RPC_FAILURE_RUN;
$response->error = get_string('pluginschecktodo', 'admin');
$response->errors[] = get_string('pluginschecktodo', 'admin');
if ($json_response) {
return json_encode($response);
} else {
return $response;
}
}
ob_start();
// debug_trace('Remote Upgrade : Upgrade core');
if ($version > $CFG->version) {
upgrade_core($version, false);
}
set_config('release', $release);
set_config('branch', $branch);
// unconditionally upgrade
// debug_trace('Remote Upgrade : Upgrade other');
upgrade_noncore(false);
// log in as admin - we need doanything permission when applying defaults
// debug_trace('Remote Upgrade : Turning ADMIN ');
session_set_user(get_admin());
// apply all default settings, just in case do it twice to fill all defaults
// debug_trace('Remote Upgrade : Applying settings ');
admin_apply_default_settings(NULL, false);
admin_apply_default_settings(NULL, false);
ob_end_clean();
$response->message = vmoodle_get_string('upgradecomplete', 'vmoodleadminset_upgrade', $newversion);
if ($json_response) {
return json_encode($response);
} else {
return $response;
}
}
开发者ID:gabrielrosset,项目名称:moodle-local_vmoodle,代码行数:89,代码来源:rpclib.php
注:本文中的upgrade_core函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论