コード例 #1
0
// Check initial password and e-mail address before we install
try {
    $institutionname = $cli->get_cli_param('institution');
    $excludelist = $cli->get_cli_param('exclude');
    $includelist = $cli->get_cli_param('include');
    // Overriding the value from config-defaults for this script
    $CFG->auth_ldap_debug_sync_cron = $cli->get_cli_param('verbose');
    $onlycontexts = $cli->get_cli_param('contexts');
    $searchsub = $cli->get_cli_param('searchsub');
    $grouptype = $cli->get_cli_param('grouptype');
    // If they supplied a grouptype, only allow it to be 'course' or 'standard'
    if ($grouptype != -1) {
        if ($grouptype !== 'course') {
            $grouptype = 'standard';
        }
    }
    $nocreate = $cli->get_cli_param('nocreate');
    $nestedgroups = $cli->get_cli_param('nestedgroups');
    $groupclass = $cli->get_cli_param('groupclass');
    $groupattribute = $cli->get_cli_param('groupattribute');
    $dryrun = $cli->get_cli_param('dryrun');
    auth_ldap_sync_groups($institutionname, true, $excludelist == -1 ? null : $excludelist, $includelist == -1 ? null : $includelist, $onlycontexts == -1 ? null : $onlycontexts, $searchsub == -1 ? null : $searchsub, $grouptype == -1 ? null : $grouptype, $nocreate == -1 ? null : !$nocreate, $nestedgroups == -1 ? null : $nestedgroups, $groupclass == -1 ? null : $groupclass, $groupattribute == -1 ? null : $groupattribute, false, null, null, $dryrun);
} catch (Exception $e) {
    $USER->logout();
    // important
    cli::cli_exit($e->getMessage(), true);
}
$USER->logout();
// important
cli::cli_exit('---------- ended at ' . date('r', time()) . ' ----------', true);
コード例 #2
0
 * @copyright  (C) 2011 Andrew Nicols <*****@*****.**>
 *
 */
define('INTERNAL', 1);
define('ADMIN', 1);
define('INSTALLER', 1);
define('CLI', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require get_config('libroot') . 'cli.php';
require get_config('libroot') . 'upgrade.php';
require get_config('docroot') . 'local/install.php';
$cli = get_cli();
$options = array();
$settings = new stdClass();
$settings->options = $options;
$settings->info = get_string('cliupgraderdescription', 'admin');
$cli->setup($settings);
// Check whether Mahara is installed yet
if (!table_exists(new XMLDBTable('config'))) {
    cli::cli_exit(get_string('maharanotinstalled', 'admin'), false);
}
// Check whether we need to do anything
$upgrades = check_upgrades();
if (empty($upgrades['settings']['toupgradecount'])) {
    cli::cli_exit(get_string('noupgrades', 'admin'), false);
}
// Check for issues which would pose problems during upgrade
ensure_upgrade_sanity();
// Actually perform the upgrade
log_info(get_string('cliupgradingmahara', 'admin'));
upgrade_mahara($upgrades);
コード例 #3
0
$options['adminemail']->description = get_string('cliadminemail', 'admin');
$options['adminemail']->required = true;
$settings = new stdClass();
$settings->options = $options;
$settings->info = get_string('cliinstallerdescription', 'admin');
$cli->setup($settings);
// Check whether we need to do anything
if (table_exists(new XMLDBTable('config'))) {
    cli::cli_exit(get_string('maharainstalled', 'admin'), false);
}
// Check initial password and e-mail address before we install
try {
    $adminpassword = $cli->get_cli_param('adminpassword');
    $adminemail = $cli->get_cli_param('adminemail');
} catch (ParameterException $e) {
    cli::cli_exit($e->getMessage(), true);
}
// Determine what we will install
$upgrades = check_upgrades();
$upgrades['firstcoredata'] = true;
$upgrades['localpreinst'] = true;
$upgrades['lastcoredata'] = true;
$upgrades['localpostinst'] = true;
// Actually perform the installation
log_info(get_string('cliinstallingmahara', 'admin'));
upgrade_mahara($upgrades);
// Set initial password and e-mail address
$userobj = new User();
$userobj = $userobj->find_by_username('admin');
$userobj->email = $adminemail;
$userobj->commit();
コード例 #4
0
ファイル: install.php プロジェクト: rboyatt/mahara
    $adminpassword = $cli->get_cli_param('adminpassword');
    $adminemail = $cli->get_cli_param('adminemail');
} catch (ParameterException $e) {
    cli::cli_exit($e->getMessage(), true);
}
// Determine what we will install
$upgrades = check_upgrades();
$upgrades['firstcoredata'] = true;
$upgrades['localpreinst'] = true;
$upgrades['lastcoredata'] = true;
$upgrades['localpostinst'] = true;
// Actually perform the installation
log_info(get_string('cliinstallingmahara', 'admin'));
upgrade_mahara($upgrades);
// Set initial password and e-mail address
$userobj = new User();
$userobj = $userobj->find_by_username('admin');
$userobj->email = $adminemail;
$userobj->commit();
// Ensure that the dummy admin email is changed
update_record('artefact_internal_profile_email', array('email' => $adminemail), array('owner' => $userobj->id));
update_record('artefact', array('title' => $adminemail), array('owner' => $userobj->id, 'artefacttype' => 'email'));
// Password changes should be performed by the authfactory
$authobj = AuthFactory::create($userobj->authinstance);
$authobj->change_password($userobj, $adminpassword, true);
// Set site name
if ($sitename = $cli->get_cli_param('sitename')) {
    if (!set_config('sitename', $sitename)) {
        cli::cli_exit(get_string('cliupdatesitenamefailed', 'admin'), true);
    }
}