当前位置: 首页>>代码示例>>PHP>>正文


PHP cli_heading函数代码示例

本文整理汇总了PHP中cli_heading函数的典型用法代码示例。如果您正苦于以下问题:PHP cli_heading函数的具体用法?PHP cli_heading怎么用?PHP cli_heading使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cli_heading函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rewind

 /**
  * Asks by command line both users to merge, with a header telling what to do.
  */
 public function rewind()
 {
     cli_heading(get_string('pluginname', 'tool_mergeusers'));
     echo get_string('cligathering:description', 'tool_mergeusers') . "\n\n";
     echo get_string('cligathering:stopping', 'tool_mergeusers') . "\n\n";
     $this->next();
 }
开发者ID:advancingdesign,项目名称:moodle-tool_mergeusers,代码行数:10,代码来源:cligathering.php

示例2: cli_error

// Validate hours argument.
if (array_key_exists('hours', $options)) {
    if (!validate_parameter($options['hours'])) {
        cli_error(get_string('cli_error_hours', 'eliscore_etl'));
    }
    $period->hours = (int) $options['hours'];
}
$durationinseconds = convert_time_to_seconds($period);
if (0 == $durationinseconds || false == $durationinseconds) {
    cli_error(get_string('cli_error_zero_duration', 'eliscore_etl'));
}
if ($durationinseconds > ETL_BLOCKED_MAX_TIME) {
    cli_error(get_string('cli_error_max_time_exceeded', 'eliscore_etl', ETL_BLOCKED_MAX_TIME));
}
// Print heading.
cli_heading(get_string('cli_run_etl_cron_heading', 'eliscore_etl', $period));
// Check for existing block.
$task = $DB->get_record('local_eliscore_sched_tasks', array('plugin' => 'eliscore_etl'));
if (!empty($task->blocked) && $timenow < $task->blocked) {
    cli_error(get_string('cli_error_blocked', 'eliscore_etl'));
}
$etlobj = new eliscore_etl_useractivity($durationinseconds);
// Set callback method incase the script is terminated.
if (function_exists('pcntl_signal')) {
    $signals = array(SIGINT, SIGTERM, SIGHUP, SIGQUIT, SIGABRT, SIGUSR1, SIGUSR2);
    foreach ($signals as $signal) {
        pcntl_signal($signal, array(&$etlobj, 'save_current_etl_state'));
    }
} else {
    cli_error(get_string('cli_error_no_pcntl', 'eliscore_etl'));
}
开发者ID:jamesmcq,项目名称:elis,代码行数:31,代码来源:run_etl_cron.php

示例3: install_cli_database

/**
 * Install Moodle DB,
 * config.php must exist, there must not be any tables in db yet.
 *
 * @param array $options adminpass is mandatory
 * @param bool $interactive
 * @return void
 */
function install_cli_database(array $options, $interactive)
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/environmentlib.php';
    require_once $CFG->libdir . '/upgradelib.php';
    // show as much debug as possible
    @error_reporting(E_ALL | E_STRICT);
    @ini_set('display_errors', '1');
    $CFG->debug = E_ALL | E_STRICT;
    $CFG->debugdisplay = true;
    $CFG->version = '';
    $CFG->release = '';
    $CFG->branch = '';
    $version = null;
    $release = null;
    $branch = null;
    // read $version and $release
    require $CFG->dirroot . '/version.php';
    if ($DB->get_tables()) {
        cli_error(get_string('clitablesexist', 'install'));
    }
    if (empty($options['adminpass'])) {
        cli_error('Missing required admin password');
    }
    // test environment first
    list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
    if (!$envstatus) {
        $errors = environment_get_errors($environment_results);
        cli_heading(get_string('environment', 'admin'));
        foreach ($errors as $error) {
            list($info, $report) = $error;
            echo "!! {$info} !!\n{$report}\n\n";
        }
        exit(1);
    }
    if (!$DB->setup_is_unicodedb()) {
        if (!$DB->change_db_encoding()) {
            // If could not convert successfully, throw error, and prevent installation
            cli_error(get_string('unicoderequired', 'admin'));
        }
    }
    if ($interactive) {
        cli_separator();
        cli_heading(get_string('databasesetup'));
    }
    // install core
    install_core($version, true);
    set_config('release', $release);
    set_config('branch', $branch);
    if (PHPUNIT_TEST) {
        // mark as test database as soon as possible
        set_config('phpunittest', 'na');
    }
    // install all plugins types, local, etc.
    upgrade_noncore(true);
    // set up admin user password
    $DB->set_field('user', 'password', hash_internal_user_password($options['adminpass']), array('username' => 'admin'));
    // rename admin username if needed
    if (isset($options['adminuser']) and $options['adminuser'] !== 'admin' and $options['adminuser'] !== 'guest') {
        $DB->set_field('user', 'username', $options['adminuser'], array('username' => 'admin'));
    }
    // indicate that this site is fully configured
    set_config('rolesactive', 1);
    upgrade_finished();
    // log in as admin - we need do anything when applying defaults
    $admins = get_admins();
    $admin = reset($admins);
    session_set_user($admin);
    // apply all default settings, do it twice to fill all defaults - some settings depend on other setting
    admin_apply_default_settings(NULL, true);
    admin_apply_default_settings(NULL, true);
    set_config('registerauth', '');
    // set the site name
    if (isset($options['shortname']) and $options['shortname'] !== '') {
        $DB->set_field('course', 'shortname', $options['shortname'], array('format' => 'site'));
    }
    if (isset($options['fullname']) and $options['fullname'] !== '') {
        $DB->set_field('course', 'fullname', $options['fullname'], array('format' => 'site'));
    }
}
开发者ID:JP-Git,项目名称:moodle,代码行数:88,代码来源:installlib.php

示例4: list

require_once $CFG->dirroot . '/enrol/guest/lib.php';
// guest enrol lib functions
include "../app/facebook-php-sdk-master/src/facebook.php";
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Backup of all information of user's on facebook.\n\nOptions:\n-h, --help            Print out this help\n\nExample:\n\$sudo /usr/bin/php /local/facebook/cli/info.php\n";
    //TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading('User\'s Facebook information');
// TODO: localize
echo "\nStarting at " . date("F j, Y, G:i:s") . "\n";
$AppID = $CFG->fbkAppID;
$SecretID = $CFG->fbkScrID;
$config = array('appId' => $AppID, 'secret' => $SecretID, 'grant_type' => 'client_credentials');
$facebook = new Facebook($config, true);
$facebook = new Facebook($config);
$facebook_id = $facebook->getUser();
$users_info = $DB->get_records('facebook_user');
foreach ($users_info as $data) {
    $facebook_id = $data->facebookid;
    $user = $facebook->api($facebook_id . '/friends', 'GET');
    $user_friends = $facebook->api('/' . $facebook_id . '/friends', 'GET');
    $user_likes = $facebook->api('/' . $facebook_id . '/likes?limit=500', 'GET');
    $array = array('basic information' => $user, 'likes' => $user_likes, 'friends' => $user_friends);
开发者ID:eduagdo,项目名称:local_facebook,代码行数:31,代码来源:info.php

示例5: judge_all_unjudged

function judge_all_unjudged()
{
    while ($task = get_one_unjudged_task()) {
        verbose(cli_heading('TASK: ' . $task->id, true));
        verbose('Judging...');
        try {
            $task = onlinejudge_judge($task);
            verbose("Successfully judged: {$task->status}");
        } catch (Exception $e) {
            $info = get_exception_info($e);
            $errmsg = "Judged inner level exception handler: " . $info->message . ' Debug: ' . $info->debuginfo . "\n" . format_backtrace($info->backtrace, true);
            cli_problem($errmsg);
            // Continue to get next unjudged task
        }
    }
}
开发者ID:boychunli,项目名称:moodle-local_onlinejudge,代码行数:16,代码来源:judged.php

示例6: cli_error

if (!plugin_manager::instance()->all_plugins_ok($version)) {
    cli_error(get_string('pluginschecktodo', 'admin'));
}
if ($interactive) {
    $a = new stdClass();
    $a->oldversion = $oldversion;
    $a->newversion = $newversion;
    echo cli_heading(get_string('databasechecking', '', $a)) . PHP_EOL;
}
// make sure we are upgrading to a stable release or display a warning
if (isset($maturity)) {
    if ($maturity < MATURITY_STABLE and !$options['allow-unstable']) {
        $maturitylevel = get_string('maturity' . $maturity, 'admin');
        if ($interactive) {
            cli_separator();
            cli_heading(get_string('notice'));
            echo get_string('maturitycorewarning', 'admin', $maturitylevel) . PHP_EOL;
            echo get_string('morehelp') . ': ' . get_docs_url('admin/versions') . PHP_EOL;
            cli_separator();
        } else {
            cli_error(get_string('maturitycorewarning', 'admin', $maturitylevel));
        }
    }
}
if ($interactive) {
    echo html_to_text(get_string('upgradesure', 'admin', $newversion)) . "\n";
    $prompt = get_string('cliyesnoprompt', 'admin');
    $input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
    if ($input == get_string('clianswerno', 'admin')) {
        exit(1);
    }
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:upgrade.php

示例7: list

require __DIR__ . '/../../config.php';
require_once "{$CFG->libdir}/clilib.php";
require_once "{$CFG->libdir}/adminlib.php";
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array('enable' => false, 'enablelater' => 0, 'enableold' => false, 'disable' => false, 'help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Maintenance mode settings.\nCurrent status displayed if not option specified.\n\nOptions:\n--enable              Enable CLI maintenance mode\n--enablelater=MINUTES Number of minutes before entering CLI maintenance mode\n--enableold           Enable legacy half-maintenance mode\n--disable             Disable maintenance mode\n-h, --help            Print out this help\n\nExample:\n\$ sudo -u www-data /usr/bin/php admin/cli/maintenance.php\n";
    //TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading(get_string('sitemaintenancemode', 'admin') . " ({$CFG->wwwroot})");
if ($options['enablelater']) {
    if (file_exists("{$CFG->dataroot}/climaintenance.html")) {
        // Already enabled, sorry.
        echo get_string('clistatusenabled', 'admin') . "\n";
        return 1;
    }
    $time = time() + $options['enablelater'] * 60;
    set_config('maintenance_later', $time);
    echo get_string('clistatusenabledlater', 'admin', userdate($time)) . "\n";
    return 0;
} else {
    if ($options['enable']) {
        if (file_exists("{$CFG->dataroot}/climaintenance.html")) {
            // The maintenance is already enabled, nothing to do.
        } else {
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:maintenance.php

示例8: list

        list($info, $report) = $error;
        echo "!! {$info} !!\n{$report}\n\n";
    }
    //remove config.php, we do not want half finished upgrades!
    unlink($configfile);
    exit(1);
}
if (!$DB->setup_is_unicodedb()) {
    if (!$DB->change_db_encoding()) {
        // If could not convert successfully, throw error, and prevent installation
        cli_error(get_string('unicoderequired', 'admin'));
    }
}
if ($interactive) {
    cli_separator();
    cli_heading(get_string('databasesetup'));
}
// install core
install_core($version, true);
set_config('release', $release);
// install all plugins types, local, etc.
upgrade_noncore(true);
// set up admin user password
$DB->set_field('user', 'password', hash_internal_user_password($options['admin-password'], array('username' => 'admin')));
// indicate that this site is fully configured
set_config('rolesactive', 1);
upgrade_finished();
// log in as admin - we need do anything when applying defaults
$admins = get_admins();
$admin = reset($admins);
session_set_user($admin);
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:install.php

示例9: dirname

require dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once $CFG->libdir . '/clilib.php';
// cli only functions
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Reset local user passwords, useful especially for admin acounts.\n\nThere are no security checks here because anybody who is able to\nexecute this file may execute any PHP too.\n\nOptions:\n-h, --help            Print out this help\n\nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php\n";
    //TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading('Password reset');
// TODO: localize
$prompt = "enter username (manual authentication only)";
// TODO: localize
$username = cli_input($prompt);
if (!($user = $DB->get_record('user', array('auth' => 'manual', 'username' => $username, 'mnethostid' => $CFG->mnet_localhost_id)))) {
    cli_error("Can not find user '{$username}'");
}
$prompt = "Enter new password";
// TODO: localize
$password = cli_input($prompt);
$errmsg = '';
//prevent eclipse warning
if (!check_password_policy($password, $errmsg)) {
    cli_error($errmsg);
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:reset_password.php

示例10: execute_interestsync

 /**
  * Execute task
  * 
  * @global \moodle_database $DB
  * @global \stdClass $CFG
  * @return void
  * @throws \moodle_exception
  */
 public function execute_interestsync()
 {
     global $DB, $CFG;
     // Not going to work if we're missing settings.
     if (!isset($CFG->block_mailchimp_apicode) || !isset($CFG->block_mailchimp_listid) || !isset($CFG->block_mailchimp_linked_profile_field)) {
         cli_error("No API code or list selected. Aborting interest sync.", 1);
         return;
     }
     if (empty($CFG->block_mailchimp_interest) || $CFG->block_mailchimp_interest == "0") {
         cli_error("No interest selected. Aborting interest sync.", 1);
         return;
     }
     $listid = $CFG->block_mailchimp_listid;
     // Get all users in MailChimp.
     $listusers = \block_mailchimp\helper::getMembersSync();
     if (!$listusers) {
         cli_error("ERROR: Failed to get list of all members. Unable to synchronize users.", 1);
         return;
     }
     $listuserscount = count($listusers['members']);
     // Get list of users in Moodle
     cli_heading('Getting list of users in Moodle');
     $moodleusers = $DB->get_records('user');
     cli_heading('Sorting user lists');
     // Sort MailChimp users list
     // foreach ($listusers['members'] as $key => $row) {
     //     $emails[$key] = $row['email_address'];
     // }
     // array_multisort($emails, SORT_ASC, $listusers['members']);
     // unset($emails);
     // Sort Moodle users list
     foreach ($moodleusers as $key => $row) {
         $emails[$key] = $row->email;
     }
     array_multisort($emails, SORT_ASC, $moodleusers);
     unset($emails);
     // // Update all the users that are present in moodle so they have the interest added.
     // cli_heading('Adding interest to MailChimp users that are present in Moodle');
     // foreach ($moodleusers as $moodleuser) {
     //         foreach ($listusers['members'] as $listuser) {
     //             // Search through the moodleusers to find the user with corresponding email address
     //             $maxkey = count($moodleusers) - 1;
     //             $minkey = 0;
     //             $searchkey = round((($maxkey + $minkey)/2), 0, PHP_ROUND_HALF_UP);
     //             $moodleuser = false;
     //             $listuseremail = strtowlower($listuser['email_address']);
     //             while($minkey <= $maxkey) {
     //                 $moodleuseremail = strtolower($moodleusers[$searchkey]->email);
     //                 if ($listuseremail == $moodleuseremail) {
     //                     $moodleuser = $moodleusers[$searchkey];
     //                     break;
     //                 }
     //                 else if ($listuseremail > $moodleuseremail) {
     //                     $minkey = $searchkey + 1;
     //                     $searchkey = round((($maxkey + $minkey)/2), 0, PHP_ROUND_HALF_UP);
     //                 }
     //                 else if ($listuseremail < $moodleuseremail) {
     //                     $maxkey = $searchkey - 1;
     //                     $searchkey = round((($maxkey + $minkey)/2), 0, PHP_ROUND_HALF_UP);
     //                 }
     //         }
     //         // No corresponding moodleuser for the user in mailchimp
     //         if ($moodleuser == false) {
     //             // Do nothing for now
     //             break;
     //         }
     //     // Maybe add some error handling here
     // }
     // Update subscription status info
     cli_heading('Applying interest label and updating subscription status');
     foreach ($listusers['members'] as $listuserkey => $listuser) {
         $statuspercent = round($listuserkey / $listuserscount * 100, 1, PHP_ROUND_HALF_UP);
         echo $statuspercent, "%        \r";
         // Search through the mailchimp users to find the user with corresponding email address
         $maxkey = count($moodleusers) - 1;
         $minkey = 0;
         $searchkey = round(($maxkey + $minkey) / 2, 0, PHP_ROUND_HALF_UP);
         $moodleuser = false;
         $listuseremail = strtolower($listuser['email_address']);
         while ($minkey <= $maxkey) {
             $moodleuseremail = strtolower($moodleusers[$searchkey]->email);
             if ($listuseremail == $moodleuseremail) {
                 $moodleuser = $moodleusers[$searchkey];
                 break;
             } else {
                 if ($listuseremail > $moodleuseremail) {
                     $minkey = $searchkey + 1;
                     $searchkey = round(($maxkey + $minkey) / 2, 0, PHP_ROUND_HALF_UP);
                 } else {
                     if ($listuseremail < $moodleuseremail) {
                         $maxkey = $searchkey - 1;
                         $searchkey = round(($maxkey + $minkey) / 2, 0, PHP_ROUND_HALF_UP);
//.........这里部分代码省略.........
开发者ID:saylordotorg,项目名称:moodle-block_mailchimp,代码行数:101,代码来源:initial_interest_sync.php

示例11: list

require_once $CFG->libdir . '/clilib.php';
// cli only functions
require_once $CFG->dirroot . "/lib/pdflib.php";
require_once $CFG->dirroot . "/mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php";
require_once $CFG->dirroot . "/mod/assign/feedback/editpdf/fpdi/fpdi.php";
require_once $CFG->dirroot . "/mod/emarking/lib/phpqrcode/phpqrcode.php";
require_once $CFG->dirroot . '/mod/emarking/lib.php';
require_once $CFG->dirroot . "/mod/emarking/locallib.php";
require_once $CFG->dirroot . '/mod/emarking/print/locallib.php';
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false, 'category' => 0), array('h' => 'help', 'c' => 'category'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Generates all PDFs pending for printing.\n\nOptions:\n-h, --help            Print out this help\n-c, --category        Print out this only exams from course in this category\n            \nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/generatefilestoprint.php --category 2\n";
    // TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading('EMarking generate files to print');
// TODO: localize
$category = NULL;
if ($options['category'] && !($category = $DB->get_record('course_categories', array('id' => $options['category'])))) {
    cli_error('Invalid category id');
    die;
}
emarking_generate_personalized_exams($category);
exit(0);
// 0 means success
开发者ID:hansnok,项目名称:emarking,代码行数:31,代码来源:generatefilestoprint.php

示例12: list

require_once $CFG->dirroot . '/enrol/guest/lib.php';
// Guest enrol lib functions
include "../app/facebook-php-sdk-master/src/facebook.php";
// Now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
// Text to the facebook console
if ($options['help']) {
    $help = "Send facebook notifications when a course have some news.\n\nOptions:\n-h, --help            Print out this help\n\nExample:\n\$sudo /usr/bin/php /local/facebook/cli/notifications.php";
    echo $help;
    die;
}
cli_heading('Facebook notifications');
// TODO: localize
// Text to the facebook console
echo "\nSearching for new notifications\n";
echo "\nStarting at " . date("F j, Y, G:i:s") . "\n";
// Define used lower in the querys
define('FACEBOOK_NOTIFICATION_LOGGEDOFF', 'message_provider_local_facebook_notification_loggedoff');
define('FACEBOOK_NOTIFICATION_LOGGEDIN', 'message_provider_local_facebook_notification_loggedin');
// Visible Course Module
define('FACEBOOK_COURSE_MODULE_VISIBLE', 1);
define('FACEBOOK_COURSE_MODULE_NOT_VISIBLE', 0);
// Visible Module
define('FACEBOOK_MODULE_VISIBLE', 1);
define('FACEBOOK_MODULE_NOT_VISIBLE', 0);
// Facebook Notifications
define('FACEBOOK_NOTIFICATIONS_WANTED', 1);
开发者ID:pspro360,项目名称:local_facebook,代码行数:31,代码来源:notifications.php

示例13: list

require_once $CFG->dirroot . '/enrol/guest/lib.php';
// guest enrol lib functions
require_once $CFG->dirroot . '/local/reservasalas/lib.php';
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Bloquea y desbloquea a los alumnos según sus reservas.\n\nOptions:\n-h, --help            Print out this help\n\nExample:\n\$sudo -u apache /usr/bin/php /local/reservasalas/cli/bloqueo.php\n";
    //TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading('Blocking students');
// TODO: localize
$time = time();
echo "\nStarting at " . date("F j, Y, G:i:s") . "\n";
$fechahoy = date('Y-m-d');
$horahoy = date('H') . '%';
$sql = "\tSelect rr.id as id, rr.alumno_id as userid\n\t\t\tFROM mdl_reservasalas_reservas AS rr\n\t\t\tINNER JOIN mdl_reservasalas_salas AS rs ON (rr.salas_id = rs.id AND rs.tipo = 2)\n\t\t\tINNER JOIN mdl_reservasalas_edificios AS re ON (re.id = rs.edificios_id)\n\t\t\tINNER JOIN mdl_reservasalas_modulos AS rm ON (rm.edificio_id = re.id)\n\t\t\tWHERE rr.modulo = rm.id AND rm.hora_inicio like '{$horahoy}' AND rr.fecha_reserva ='{$fechahoy}' AND rr.confirmado=0\n";
$result = $DB->get_records_sql($sql);
$i = 0;
foreach ($result as $data) {
    $userid = $data->userid;
    $idreserva = $data->id;
    if (!$DB->get_record('reservasalas_bloqueados', array('alumno_id' => $userid, 'estado' => 1))) {
        $record = new stdClass();
        $record->fecha_bloqueo = $fechahoy;
        $record->id_reserva = $idreserva;
开发者ID:eduagdo,项目名称:reservasalas,代码行数:31,代码来源:bloqueo.php

示例14: list

require_once $CFG->dirroot . '/enrol/guest/lib.php';
// guest enrol lib functions
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Este script se trae los datos desde Omega\n\nOptions:\n-h, --help            Print out this help\n\nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/omega.php\n";
    //TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
echo "Ok\n";
cli_heading('Conectandose con Omega');
// TODO: localize
echo "Ok\n";
putenv('FREETDSCONF=/etc/freetds.conf');
echo "Ok\n";
$link = mssql_connect('bdcl4.uai.cl', 'webcursos', 'uai2011') or die("Error conectandose a BBDD de Omega");
if (!$link) {
    echo "Error conectandose a la BBDD de Omega\n";
    die;
}
echo "Ok\n";
mssql_select_db('OmegaDB') or die('Could not select a database.');
echo "Ok\n";
mysql_connect('localhost', 'moodleuser', 'Diagonal.2011') or die("Imposible conectarse a BBDD local");
echo "Ok\n";
mysql_select_db('omega') or die("Error con BBDD omega " . mysql_error());
开发者ID:jorgecabane93,项目名称:uai,代码行数:31,代码来源:omega.php

示例15: define

/**
 * This script allows you to reset any local user password.
 *
 * @package    core
 * @subpackage cli
 * @copyright  2010 Jorge Villalon (http://villalon.cl)
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('CLI_SCRIPT', true);
require dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once $CFG->libdir . '/clilib.php';
// cli only functions
require_once $CFG->libdir . '/datalib.php';
// data lib functions
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Fixes sortorder of courses and categories.\n\nOptions:\n-h, --help            Print out this help\n\nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/fix_sortorder.php\n";
    //TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading('Fix sortorder for courses and categories');
// TODO: localize
fix_course_sortorder();
exit(0);
// 0 means success
开发者ID:jorgecabane93,项目名称:uai,代码行数:31,代码来源:fix_sortorder.php


注:本文中的cli_heading函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。