コード例 #1
0
ファイル: adminlib.php プロジェクト: raymondAntonio/moodle
/**
 * Based on find_new_settings{@link ()}  in upgradesettings.php
 * Looks to find any admin settings that have not been initialized. Returns 1 if it finds any.
 *
 * @param object $node Instance of admin_category, or admin_settingpage
 * @return boolean true if any settings haven't been initialised, false if they all have
 */
function any_new_admin_settings($node)
{
    if ($node instanceof admin_category) {
        $entries = array_keys($node->children);
        foreach ($entries as $entry) {
            if (any_new_admin_settings($node->children[$entry])) {
                return true;
            }
        }
    } else {
        if ($node instanceof admin_settingpage) {
            foreach ($node->settings as $setting) {
                if ($setting->get_setting() === NULL) {
                    return true;
                }
            }
        }
    }
    return false;
}
コード例 #2
0
ファイル: index.php プロジェクト: numbas/moodle
if (empty($site->shortname)) {
    // probably new installation - lets return to frontpage after this step
    // remove settings that we want uninitialised
    unset_config('registerauth');
    redirect('upgradesettings.php?return=site');
}
// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
if (!empty($id) and $id == $CFG->siteidentifier) {
    set_config('registered', time());
}
// setup critical warnings before printing admin tree block
$insecuredataroot = is_dataroot_insecure(true);
$SESSION->admin_critical_warning = $insecuredataroot == INSECURE_DATAROOT_ERROR;
$adminroot = admin_get_root();
// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)) {
    redirect('upgradesettings.php');
}
// Everything should now be set up, and the user is an admin
// Print default admin page with notifications.
$errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED');
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
$cronoverdue = $lastcron < time() - 3600 * 24;
$dbproblems = $DB->diagnose();
$maintenancemode = !empty($CFG->maintenance_enabled);
$updateschecker = available_update_checker::instance();
$availableupdates = $updateschecker->get_update_info('core', array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
$availableupdatesfetch = $updateschecker->get_last_timefetched();
admin_externalpage_setup('adminnotifications');
if ($fetchupdates) {
    require_sesskey();
コード例 #3
0
/**
 * Based on find_new_settings{@link ()}  in upgradesettings.php
 * Looks to find any admin settings that have not been initialized. Returns 1 if it finds any.
 *
 * @param string &$node The node at which to start searching.
 * @return int Returns 1 if any settings haven't been initialised, 0 if they all have
 */
function any_new_admin_settings(&$node)
{
    if (is_a($node, 'admin_category')) {
        $entries = array_keys($node->children);
        foreach ($entries as $entry) {
            if (any_new_admin_settings($node->children[$entry])) {
                return 1;
            }
        }
    }
    if (is_a($node, 'admin_settingpage')) {
        foreach ($node->settings as $setting) {
            if ($setting->get_setting() === NULL) {
                return 1;
            }
        }
    }
    return 0;
}