示例#1
0
文件: index.php 项目: numbas/moodle
    }
    install_core($version, true);
}
// Check version of Moodle code on disk compared with database
// and upgrade if possible.
$stradministration = get_string('administration');
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
if (empty($CFG->version)) {
    print_error('missingconfigversion', 'debug');
}
if ($version > $CFG->version) {
    // upgrade
    purge_all_caches();
    $PAGE->set_pagelayout('maintenance');
    $PAGE->set_popup_notification_allowed(false);
    if (upgrade_stale_php_files_present()) {
        $PAGE->set_title($stradministration);
        $PAGE->set_cacheable(false);
        $output = $PAGE->get_renderer('core', 'admin');
        echo $output->upgrade_stale_php_files_page();
        die;
    }
    if (empty($confirmupgrade)) {
        $a = new stdClass();
        $a->oldversion = "{$CFG->release} ({$CFG->version})";
        $a->newversion = "{$release} ({$version})";
        $strdatabasechecking = get_string('databasechecking', '', $a);
        $PAGE->set_title($stradministration);
        $PAGE->set_heading($strdatabasechecking);
        $PAGE->set_cacheable(false);
        $output = $PAGE->get_renderer('core', 'admin');
 /**
  * Test the {@link upgrade_stale_php_files_present() function
  */
 public function test_upgrade_stale_php_files_present()
 {
     // Just call the function, must return bool false always
     // if there aren't any old files in the codebase.
     $this->assertFalse(upgrade_stale_php_files_present());
 }