|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00032 define('CLI_SCRIPT', true); 00033 00034 require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); 00035 require_once($CFG->libdir.'/clilib.php'); 00036 require_once("$CFG->dirroot/enrol/meta/locallib.php"); 00037 00038 // now get cli options 00039 list($options, $unrecognized) = cli_get_params(array('verbose'=>false, 'help'=>false), array('v'=>'verbose', 'h'=>'help')); 00040 00041 if ($unrecognized) { 00042 $unrecognized = implode("\n ", $unrecognized); 00043 cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); 00044 } 00045 00046 if ($options['help']) { 00047 $help = 00048 "Execute meta course enrol sync. 00049 00050 Options: 00051 -v, --verbose Print verbose progess information 00052 -h, --help Print out this help 00053 00054 Example: 00055 \$sudo -u www-data /usr/bin/php enrol/meta/cli/sync.php 00056 "; 00057 00058 echo $help; 00059 die; 00060 } 00061 00062 $verbose = !empty($options['verbose']); 00063 00064 $result = enrol_meta_sync(null, $verbose); 00065 00066 exit($result);