コード例 #1
0
        if (!isset($adminpassword)) {
            $adminpassword = $DEFAULT['adminpassword'];
        }
        if (!isset($adminemail)) {
            $adminemail = $DEFAULT['adminemail'];
        }
        $user = new object();
        $user->auth = 'manual';
        $user->firstname = $adminfirstname;
        //get_string('admin');
        $user->lastname = $adminlastname;
        //get_string('user');
        $user->username = $adminusername;
        //'admin';
        $user->password = hash_internal_user_password($adminpassword);
        // 'admin'
        $user->email = $adminemail;
        //'root@localhost';
        $user->confirmed = 1;
        $user->mnethostid = $CFG->mnet_localhost_id;
        $user->lang = $CFG->lang;
        $user->maildisplay = 1;
        $user->timemodified = time();
        create_admin_user($user);
    }
    if ($verbose > CLI_NO) {
        print_newline();
        console_write('upgradingcompleted');
        console_write("\n", '', false);
    }
}
コード例 #2
0
ファイル: weblib.php プロジェクト: nicolasconnault/moodle2.0
/**
 * Print a bold message in an optional color.
 *
 * @param string $message The message to print out
 * @param string $style Optional style to display message text in
 * @param string $align Alignment option
 * @param bool $return whether to return an output string or echo now
 */
function notify($message, $style = 'notifyproblem', $align = 'center', $return = false)
{
    global $DB;
    if ($style == 'green') {
        $style = 'notifysuccess';
        // backward compatible with old color system
    }
    $message = clean_text($message);
    if (!CLI_SCRIPT) {
        $output = '<div class="' . $style . '" style="text-align:' . $align . '">' . $message . '</div>' . "\n";
    } else {
        if ($style === 'notifysuccess') {
            $output = '++' . $message . '++';
        } else {
            $output = '!!' . $message . '!!';
        }
    }
    if ($return) {
        return $output;
    }
    if (!CLI_SCRIPT) {
        echo $output;
    } else {
        console_write($output . "\n", '', false);
    }
}
コード例 #3
0
ファイル: clilib.php プロジェクト: nicolasconnault/moodle2.0
/**
 * Print a new line in the standard output
 *
 */
function print_newline()
{
    console_write("\n", '', false);
}