// // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * link checker robot local cli * * @package local_linkchecker_robot * @author Brendan Heywood <*****@*****.**> * @copyright Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; require_once $CFG->libdir . '/clilib.php'; require_once $CFG->dirroot . '/local/linkchecker_robot/lib.php'; list($options, $unrecognized) = cli_get_params(array('help' => false, 'url' => null), array('h' => 'help', 'u' => 'url')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } $help = "Scrape the url as the robot would see it, but do not process/queue it.\n\nOptions:\n-h, --help Print out this help\n-u, --url Url to scrape\n\nExample:\n\$sudo -u www-data php scrape-as.php --url=http://ford.com/\n"; if ($options['help']) { echo $help; die; } $robot = new \local_linkchecker_robot\robot\crawler(); $error = $robot->is_bot_valid(); if ($error) { print "Error: {$error}"; exit; }
if (isset($_SERVER['REMOTE_ADDR'])) { die; // No access from web!. } define('BEHAT_UTIL', true); define('CLI_SCRIPT', true); define('NO_OUTPUT_BUFFERING', true); define('IGNORE_COMPONENT_CACHE', true); define('ABORT_AFTER_CONFIG', true); require_once __DIR__ . '/../../../../config.php'; require_once __DIR__ . '/../../../../lib/clilib.php'; require_once __DIR__ . '/../../../../lib/behat/lib.php'; require_once __DIR__ . '/../../../../lib/behat/classes/behat_command.php'; require_once __DIR__ . '/../../../../lib/behat/classes/behat_config_manager.php'; // CLI options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'install' => false, 'drop' => false, 'enable' => false, 'disable' => false, 'diag' => false, 'parallel' => 0, 'maxruns' => false, 'updatesteps' => false, 'fromrun' => 1, 'torun' => 0), array('h' => 'help', 'j' => 'parallel', 'm' => 'maxruns')); // Checking util.php CLI script usage. $help = "\nBehat utilities to manage the test environment\n\nOptions:\n--install Installs the test environment for acceptance tests\n--drop Drops the database tables and the dataroot contents\n--enable Enables test environment and updates tests list\n--disable Disables test environment\n--diag Get behat test environment status code\n-j, --parallel Number of parallel behat run operation\n-m, --maxruns Max parallel processes to be executed at one time.\n--updatesteps Update feature step file.\n\n-h, --help Print out this help\n\nExample from Moodle root directory:\n\$ php admin/tool/behat/cli/util.php --enable --parallel=4\n\nMore info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests\n"; if (!empty($options['help'])) { echo $help; exit(0); } $cwd = getcwd(); // For drop option check if parallel site. if (empty($options['parallel']) && $options['drop']) { // Get parallel run info from first run. $options['parallel'] = behat_config_manager::get_parallel_test_runs($options['fromrun']); } // If not a parallel site then open single run. if (empty($options['parallel'])) { chdir(__DIR__);
* * @package plagiarism_moss * @copyright 2011 Sun Zhigang (http://sunner.cn) * @author Sun Zhigang * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/clilib.php'; // cli only functions require_once $CFG->dirroot . '/plagiarism/moss/lib.php'; // now get cli options $longoptions = array('help' => false, 'nodone' => false); $shortoptions = array('h' => 'help', 'n' => 'nodone'); list($options, $unrecognized) = cli_get_params($longoptions, $shortoptions); if ($unrecognized) { $cmid = (int) current($unrecognized); if ($cmid === 0) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } } if ($options['help'] or !isset($cmid)) { $help = "Trigger assessable_file_uploaded and assessable_files_done events of specified assignment.\n\ntrigger_assignment_events.php cmid\n\nOptions:\n-h, --help Print out this help\n-n, --nodone Do not trigger assessable_files_done event\n\nExample:\n\$sudo -u www-data /usr/bin/php plagiarism/moss/cli/trigger_assignment_events.php 1234\n"; echo $help; die; } $count = moss_trigger_assignment_events($cmid, !$options['nodone']); if ($count === false) { cli_error('Failed!');
// // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * This script implements some useful svg manipulation tricks. * * @package core_admin * @subpackage cli * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require __DIR__ . '/../../config.php'; require_once $CFG->libdir . '/clilib.php'; // Now get cli options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'ie9fix' => false, 'noaspectratio' => false, 'path' => $CFG->dirroot), array('h' => 'help')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } // If necessary add files that should be ignored - such as in 3rd party plugins. $blacklist = array(); $path = $options['path']; if (!file_exists($path)) { cli_error("Invalid path {$path}"); } if ($options['ie9fix']) { core_admin_recurse_svgs($path, '', 'core_admin_svgtool_ie9fix', $blacklist); } else { if ($options['noaspectratio']) { core_admin_recurse_svgs($path, '', 'core_admin_svgtool_noaspectratio', $blacklist);
// No access from web! } define('BEHAT_UTIL', true); define('CLI_SCRIPT', true); define('ABORT_AFTER_CONFIG', true); define('CACHE_DISABLE_ALL', true); define('NO_OUTPUT_BUFFERING', true); require_once __DIR__ . '/../../../../config.php'; require_once __DIR__ . '/../../../../lib/clilib.php'; require_once __DIR__ . '/../../../../lib/behat/lib.php'; require_once __DIR__ . '/../../../../lib/behat/classes/behat_command.php'; require_once __DIR__ . '/../../../../lib/behat/classes/behat_config_manager.php'; error_reporting(E_ALL | E_STRICT); ini_set('display_errors', '1'); ini_set('log_errors', '1'); list($options, $unrecognised) = cli_get_params(array('stop-on-failure' => 0, 'verbose' => false, 'replace' => false, 'help' => false, 'tags' => '', 'profile' => '', 'feature' => '', 'fromrun' => 1, 'torun' => 0, 'single-run' => false), array('h' => 'help', 't' => 'tags', 'p' => 'profile', 's' => 'single-run')); // Checking run.php CLI script usage. $help = "\nBehat utilities to run behat tests in parallel\n\nUsage:\n php run.php [--BEHAT_OPTION=\"value\"] [--feature=\"value\"] [--replace] [--fromrun=value --torun=value] [--help]\n\nOptions:\n--BEHAT_OPTION Any combination of behat option specified in http://behat.readthedocs.org/en/v2.5/guides/6.cli.html\n--feature Only execute specified feature file (Absolute path of feature file).\n--replace Replace args string with run process number, useful for output.\n--fromrun Execute run starting from (Used for parallel runs on different vms)\n--torun Execute run till (Used for parallel runs on different vms)\n\n-h, --help Print out this help\n\nExample from Moodle root directory:\n\$ php admin/tool/behat/cli/run.php --tags=\"@javascript\"\n\nMore info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests\n"; if (!empty($options['help'])) { echo $help; exit(0); } $parallelrun = behat_config_manager::get_parallel_test_runs($options['fromrun']); // Default torun is maximum parallel runs. if (empty($options['torun'])) { $options['torun'] = $parallelrun; } // Capture signals and ensure we clean symlinks. if (extension_loaded('pcntl')) { $disabled = explode(',', ini_get('disable_functions')); if (!in_array('pcntl_signal', $disabled)) {
* that is before upgrade and install. * * @package core * @copyright 2013 Petr Skoda (skodak) {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); define('ABORT_AFTER_CONFIG', true); // We need just the values from config.php. define('CACHE_DISABLE_ALL', true); // This prevents reading of existing caches. define('IGNORE_COMPONENT_CACHE', true); require __DIR__ . '/../../config.php'; require_once $CFG->libdir . '/clilib.php'; // Now get cli options. list($options, $unrecognized) = cli_get_params(array('file' => false, 'rebuild' => false, 'print' => false, 'help' => false), array('h' => 'help')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2); } if (!$options['rebuild'] and !$options['file'] and !$options['print']) { $help = "Create alternative component cache file\n\nOptions:\n-h, --help Print out this help\n--rebuild Rebuild \$CFG->alternative_component_cache file\n--file=filepath Save component cache to file\n--print Print component cache file content\n\nExample:\n\$ php admin/cli/rebuild_alternative_component_cache.php --rebuild\n"; echo $help; exit(0); } error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); $content = core_component::get_cache_content(); if ($options['print']) { echo $content; exit(0);
// // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * CLI interface for creating a test site. * * @package tool_generator * @copyright 2013 David Monllaó * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); define('NO_OUTPUT_BUFFERING', true); require __DIR__ . '/../../../../config.php'; require_once $CFG->libdir . '/clilib.php'; // CLI options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'size' => false, 'fixeddataset' => false, 'filesizelimit' => false, 'bypasscheck' => false, 'quiet' => false), array('h' => 'help')); $sitesizes = '* ' . implode(PHP_EOL . '* ', tool_generator_site_backend::get_size_choices()); // Display help. if (!empty($options['help']) || empty($options['size'])) { echo "\nUtility to generate a standard test site data set.\n\nNot for use on live sites; only normally works if debugging is set to DEVELOPER\nlevel.\n\nConsider that, depending on the size you select, this CLI tool can really generate a lot of data, aproximated sizes:\n\n{$sitesizes}\n\nOptions:\n--size Size of the generated site, this value affects the number of courses and their size. Accepted values: XS, S, M, L, XL, or XXL (required)\n--fixeddataset Use a fixed data set instead of randomly generated data\n--filesizelimit Limits the size of the generated files to the specified bytes\n--bypasscheck Bypasses the developer-mode check (be careful!)\n--quiet Do not show any output\n\n-h, --help Print out this help\n\nExample from Moodle root directory:\n\$ php admin/tool/generator/cli/maketestsite.php --size=S\n"; // Exit with error unless we're showing this because they asked for it. exit(empty($options['help']) ? 1 : 0); } // Check debugging is set to developer level. if (empty($options['bypasscheck']) && !$CFG->debugdeveloper) { cli_error(get_string('error_notdebugging', 'tool_generator')); } // Get options. $sizename = $options['size']; $fixeddataset = $options['fixeddataset']; $filesizelimit = $options['filesizelimit'];
// GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * CLI search indexer * * @package search * @copyright 2016 Dan Poltawski <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require __DIR__ . '/../../config.php'; require_once $CFG->libdir . '/clilib.php'; // cli only functions list($options, $unrecognized) = cli_get_params(array('help' => false, 'force' => false, 'reindex' => false), array('h' => 'help', 'f' => 'force', 'r' => 'reindex')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Index search data\n\nOptions:\n-h, --help Print out this help\n-r, --reindex Reindex data\n-f, --force Allow indexer to run, even if global search is disabled.\n\nExample:\n\$ sudo -u www-data /usr/bin/php search/cli/indexer.php --reindex\n"; echo $help; die; } if (!\core_search\manager::is_global_search_enabled() && empty($options['force'])) { cli_error('Global search is disabled. Use --force if you want to force an index while disabled'); } if (!($searchengine = \core_search\manager::search_engine_instance())) { cli_error(get_string('engineserverstatus', 'search')); }
* CLI update for manual enrolments expiration. * * Notes: * - it is required to use the web server account when executing PHP CLI scripts * - you need to change the "www-data" to match the apache user account * - use "su" if "sudo" not available * * @package enrol_manual * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require __DIR__ . '/../../../config.php'; require_once "{$CFG->libdir}/clilib.php"; // Now get cli options. list($options, $unrecognized) = cli_get_params(array('verbose' => false, 'help' => false), array('v' => 'verbose', 'h' => 'help')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Execute manual enrolments expiration sync and send notifications.\n\nOptions:\n-v, --verbose Print verbose progress information\n-h, --help Print out this help\n\nExample:\n\$ sudo -u www-data /usr/bin/php enrol/self/manual/sync.php\n"; echo $help; die; } if (!enrol_is_enabled('manual')) { cli_error('enrol_manual plugin is disabled, synchronisation stopped', 2); } if (empty($options['verbose'])) { $trace = new null_progress_trace(); } else {
// Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. define('CLI_SCRIPT', true); require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; // Global moodle config file. require_once $CFG->dirroot . '/lib/clilib.php'; // CLI only functions // Ensure options are blanck; unset($options); // Now get cli options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'plugin' => false, 'fulldelete' => false, 'test' => false), array('h' => 'help', 'p' => 'plugin', 'f' => 'fulldelete', 't' => 'test')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Command line ENT Global Updater.\nOptions:\n-h, --help Print out this help\n-p, --plugin Complete plugin name (ex : local_vmoodle)\n-f, --fulldelete To completely remove source from wwwroot after uninstalling\n-t, --test Stops after host resolution, telling the actual config that will be used\n"; echo $help; die; } $allhosts = $DB->get_records('local_vmoodle'); mtrace("Start uninstalling plugin {$options['plugin']}...\n"); $phpcmd = "php"; if (!isset($CFG->ostype) || $CFG->ostype == 'WINDOWS') { if (isset($CFG->phpinstallpath)) { $phpcmd = '"' . $CFG->phpinstallpath . '/php.exe"';
/** * MySQL collation conversion tool. * * @package core * @copyright 2012 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require __DIR__ . '/../../config.php'; require_once $CFG->libdir . '/clilib.php'; // cli only functions if ($DB->get_dbfamily() !== 'mysql') { cli_error('This function is designed for MySQL databases only!'); } // now get cli options list($options, $unrecognized) = cli_get_params(array('help' => false, 'list' => false, 'collation' => false, 'available' => false), array('h' => 'help', 'l' => 'list', 'a' => 'available')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } $help = "MySQL collation conversions script.\n\nIt is strongly recommended to stop the web server before the conversion.\nThis script may be executed before the main upgrade - 1.9.x data for example.\n\nOptions:\n--collation=COLLATION Convert MySQL tables to different collation\n-l, --list Show table and column information\n-a, --available Show list of available collations\n-h, --help Print out this help\n\nExample:\n\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci\n"; if (!empty($options['collation'])) { $collations = mysql_get_collations(); $collation = clean_param($options['collation'], PARAM_ALPHANUMEXT); $collation = strtolower($collation); if (!isset($collations[$collation])) { cli_error("Error: collation '{$collation}' is not available on this server!"); } echo "Converting tables and columns to '{$collation}' for {$CFG->wwwroot}:\n"; $prefix = $DB->get_prefix(); $prefix = str_replace('_', '\\_', $prefix);
* All CLI utilities uses $CFG->behat_dataroot and $CFG->prefix_dataroot as * $CFG->dataroot and $CFG->prefix * * @package tool_behat * @copyright 2012 David Monllaó * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ if (isset($_SERVER['REMOTE_ADDR'])) { die; // No access from web!. } // Basic functions. require_once __DIR__ . '/../../../../lib/clilib.php'; require_once __DIR__ . '/../../../../lib/behat/lib.php'; // CLI options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'install' => false, 'drop' => false, 'enable' => false, 'disable' => false, 'diag' => false), array('h' => 'help')); if ($options['install'] or $options['drop']) { define('CACHE_DISABLE_ALL', true); } // Checking util.php CLI script usage. $help = "\nBehat utilities to manage the test environment\n\nOptions:\n--install Installs the test environment for acceptance tests\n--drop Drops the database tables and the dataroot contents\n--enable Enables test environment and updates tests list\n--disable Disables test environment\n--diag Get behat test environment status code\n\n-h, --help Print out this help\n\nExample from Moodle root directory:\n\$ php admin/tool/behat/cli/util.php --enable\n\nMore info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests\n"; if (!empty($options['help'])) { echo $help; exit(0); } // Checking $CFG->behat_* vars and values. define('BEHAT_UTIL', true); define('CLI_SCRIPT', true); define('ABORT_AFTER_CONFIG', true); define('NO_OUTPUT_BUFFERING', true); error_reporting(E_ALL | E_STRICT);
* component: optional, the name of the component the setting belongs to (forum, auth_manual...) * value: the configuration value (only on add rules). * * @category ci * @package local_ci * @subpackage configure_site * @copyright 2011 Eloy Lafuente (http://stronk7.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; require_once $CFG->libdir . '/clilib.php'; // cli only functions require_once $CFG->dirroot . '/local/ci/configure_site/lib.php'; // now get cli options list($options, $unrecognized) = cli_get_params(array('help' => false, 'rule' => '', 'preset' => ''), array('h' => 'help', 'r' => 'rule', 'p' => 'preset')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Set various configuration options for a given site, both @ config.php and database\n\nOptions:\n-h, --help Print out this help\n-r, --rule Define the configuration option to apply\n-p, --preset Define the preset (batch of rules) to apply\n\nFormat of any configuration option is, always:\n target, type, name[:plugin][, value]\nWith:\n target: file (config.php) or db (config/config_plugin tables)\n type: add (to add) or del (to delete)\n name: the name of the configuration setting (debug,...)\n component: optional, the name of the component the setting belongs to (forum, auth_manual...)\n value: the configuration value (only on add rules).\n\nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/configure_site/configure_site.php --rule=file,add,debug,38911\n"; echo $help; exit(0); } $rule = $options['rule']; $preset = $options['preset']; if (empty($rule) && empty($preset)) { cli_error('Both --rule and --preset missing. Use --help to get more info.'); } if (!empty($rule) && !empty($preset)) {
<?php define('CLI_SCRIPT', 1); require __DIR__ . '/../../../../config.php'; require_once $CFG->libdir . '/clilib.php'; list($options, $unrecognized) = cli_get_params(array('overwrite-autoload' => false, 'install-in-codebase' => false, 'help' => false), array('o' => 'overwrite-autoload', 'h' => 'help')); $help = "\nUtility to install composer dependencies.\n\nThis finds all plugins with a composer.json file and creates a composer.json\nthat will resolve them all together.\n\nUsage:\n php composer.php [--overwrite-autoload] [--install-in-codebase] [--help] [command]\n\nOptions:\n--overwrite-autoload Overwrite autoloader in plugin code to use global\n--install-in-codebase Install to lib/vendor directory in dirroot rather than dataroot\n\n-h, --help Print out this help\n\n"; if (!empty($options['help'])) { echo $help; exit(0); } $manager = new \tool_composer\manager(); if ($options['overwrite-autoload']) { $manager->set_overwritelocal(true); } if ($options['install-in-codebase']) { $manager->set_installincodebase(true); } $manager->run(implode(' ', $unrecognized));
* @package core * @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Petr Skoda <*****@*****.**> */ define('CLI_SCRIPT', true); require dirname(__FILE__) . '/../../config.php'; require_once $CFG->libdir . '/clilib.php'; if ($DB->get_dbfamily() !== 'mysql') { cli_error('This script is used for MySQL databases only.'); } $engine = strtolower($DB->get_dbengine()); if ($engine !== 'innodb' and $engine !== 'xtradb') { cli_error('This script is for MySQL servers using InnoDB or XtraDB engines only.'); } list($options, $unrecognized) = cli_get_params(array('help' => false, 'info' => false, 'list' => false, 'fix' => false, 'showsql' => false), array('h' => 'help', 'i' => 'info', 'l' => 'list', 'f' => 'fix', 's' => 'showsql')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } $help = "Script for detection of row size problems in MySQL InnoDB tables.\n\nBy default InnoDB storage table is using legacy Antelope file format\nwhich has major restriction on database row size.\nUse this script to detect and fix database tables with potential data\noverflow problems.\n\nOptions:\n-i, --info Show database information\n-l, --list List problematic tables\n-f, --fix Attempt to fix all tables (requires SUPER privilege)\n-s, --showsql Print SQL statements for fixing of tables\n-h, --help Print out this help\n\nExample:\n\$ sudo -u www-data /usr/bin/php admin/cli/mysql_compressed_rows.php -l\n"; /** @var mysql_sql_generator $generator */ $generator = $DB->get_manager()->generator; $info = $DB->get_server_info(); $filepertable = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_per_table'"); $filepertable = $filepertable ? $filepertable->value : ''; $fileformat = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_format'"); $fileformat = $fileformat ? $fileformat->value : ''; $prefix = $DB->get_prefix(); $database = $CFG->dbname; if (!empty($options['info'])) {
*/ define('CLI_SCRIPT', true); require '../../../config.php'; require_once $CFG->libdir . '/adminlib.php'; // various admin-only functions require_once $CFG->libdir . '/upgradelib.php'; // general upgrade/install related functions require_once $CFG->libdir . '/clilib.php'; // cli only functions require_once $CFG->dirroot . '/local/vmoodle/lib.php'; require_once $CFG->dirroot . '/local/vmoodle/cli/clilib.php'; // vmoodle cli only functions // Fakes an admin identity for all the process. $USER = get_admin(); // Now get cli options. list($options, $unrecognized) = cli_get_params(array('interactive' => false, 'help' => false, 'config' => false, 'nodes' => ''), array('h' => 'help', 'c' => 'config', 'n' => 'nodes', 'i' => 'interactive')); $interactive = !empty($options['interactive']); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Command line VMoodle Generator.\nPlease note you must execute this script with the same uid as apache!\n\nOptions:\n--interactive No interactive questions or confirmations\n-h, --help Print out this help\n-c, --config Define an external config file\n-n, --nodes A node descriptor CSV file\n\nExample:\n\$sudo -u www-data /usr/bin/php local/vmoodle/cli/bulksnapshot.php -nodes=nodelist.csv\n"; //TODO: localize - to be translated later when everything is finished echo $help; die; } if (empty($CFG->version)) { cli_error(get_string('missingconfigversion', 'debug')); } // Get all options from config file.
* @package core * @subpackage cli * @copyright 2009 Petr Skoda (http://skodak.org) * @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 . '/adminlib.php'; // various admin-only functions require_once $CFG->libdir . '/upgradelib.php'; // general upgrade/install related functions require_once $CFG->libdir . '/clilib.php'; // cli only functions require_once $CFG->libdir . '/environmentlib.php'; // now get cli options list($options, $unrecognized) = cli_get_params(array('non-interactive' => false, 'help' => false), array('h' => 'help')); $interactive = empty($options['non-interactive']); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Command line Moodle upgrade.\nPlease note you must execute this script with the same uid as apache!\n\nSite defaults may be changed via local/defaults.php.\n\nOptions:\n--non-interactive No interactive questions or confirmations\n-h, --help Print out this help\n\nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/upgrade.php\n"; //TODO: localize - to be translated later when everything is finished echo $help; die; } if (empty($CFG->version)) { cli_error(get_string('missingconfigversion', 'debug')); } require "{$CFG->dirroot}/version.php";
$CFG->target_release = $release; //Database types $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), 'oci' => moodle_database::get_driver_instance('oci', 'native'), 'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), 'mssql' => moodle_database::get_driver_instance('mssql', 'native')); foreach ($databases as $type => $database) { if ($database->driver_installed() !== true) { unset($databases[$type]); } } if (empty($databases)) { $defaultdb = ''; } else { reset($databases); $defaultdb = key($databases); } // now get cli options list($options, $unrecognized) = cli_get_params(array('chmod' => '2777', 'lang' => $CFG->lang, 'wwwroot' => '', 'dataroot' => $CFG->dataroot, 'dbtype' => $defaultdb, 'dbhost' => 'localhost', 'dbname' => 'moodle', 'dbuser' => 'root', 'dbpass' => '', 'dbsocket' => false, 'prefix' => 'mdl_', 'fullname' => '', 'shortname' => '', 'adminuser' => 'admin', 'adminpass' => '', 'non-interactive' => false, 'agree-license' => false, 'allow-unstable' => false, 'help' => false), array('h' => 'help')); $interactive = empty($options['non-interactive']); // set up language $lang = clean_param($options['lang'], PARAM_SAFEDIR); if (file_exists($CFG->dirroot . '/install/lang/' . $lang)) { $CFG->lang = $lang; } if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { echo $help; die; } //Print header
* PHPUnit related utilities. * * Exit codes: {@see phpunit_bootstrap_error()} * * @package tool_phpunit * @copyright 2012 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ if (isset($_SERVER['REMOTE_ADDR'])) { die; // no access from web! } require_once __DIR__ . '/../../../../lib/clilib.php'; require_once __DIR__ . '/../../../../lib/phpunit/bootstraplib.php'; // now get cli options list($options, $unrecognized) = cli_get_params(array('drop' => false, 'install' => false, 'buildconfig' => false, 'buildcomponentconfigs' => false, 'diag' => false, 'run' => false, 'help' => false), array('h' => 'help')); if (file_exists(__DIR__ . '/../../../../vendor/autoload.php')) { // Composer packages present. require_once __DIR__ . '/../../../../vendor/autoload.php'; } // Verify PHPUnit libs can be loaded. if (!(include_once 'PHPUnit/Autoload.php')) { phpunit_bootstrap_error(PHPUNIT_EXITCODE_PHPUNITMISSING); } if ($options['run']) { unset($options); unset($unrecognized); foreach ($_SERVER['argv'] as $k => $v) { if (strpos($v, '--run') === 0) { unset($_SERVER['argv'][$k]); $_SERVER['argc'] = $_SERVER['argc'] - 1;
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Version details. * * @package tool_email * @copyright 2016 Brendan Heywood <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require __DIR__ . '/../../../config.php'; require_once $CFG->libdir . '/clilib.php'; list($options, $unrecognized) = cli_get_params(array('dryrun' => false, 'from' => $CFG->supportemail, 'help' => false, 'method' => 'email', 'subject' => '', 'to' => '*****@*****.**'), array('d' => 'dryrun', 'f' => 'from', 'h' => 'help', 'm' => 'method', 's' => 'subject', 't' => 'to')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2); } if ($options['help'] || empty($options['subject'])) { $help = "Send an email to someone, from someone, using the mooodle libs.\n\nOptions:\n-h, --help Print out this help\n-d, --dryrun Dry run with echo instead of sending email\n-t, --to To email address (defaults to {$options['to']})\n-f, --from From email address (defaults to {$options['from']})\n-s, --subject Subject is required\n-m, --method 'email' (default) or 'message' which uses the Message API\n\nExample:\n\$php email.php -s='Test subject'\n\$php email.php -s=Test -t=to@example.com -f=from@moodle.com\n"; echo $help; exit(0); } $to = (object) array('id' => 1, 'auth' => 'manual', 'email' => $options['to'], 'username' => 'brendan', 'firstname' => 'Bob', 'lastname' => 'Smith', 'deleted' => 0, 'emailstop' => 0, 'suspended' => 0, 'maildisplay' => true, 'mailformat' => 1); $allnames = get_all_user_name_fields(); foreach ($allnames as $name) { if (!property_exists($to, $name)) { $to->{$name} = ''; }
define('SITEID', 1); //Database types $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), 'mariadb' => moodle_database::get_driver_instance('mariadb', 'native'), 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), 'oci' => moodle_database::get_driver_instance('oci', 'native'), 'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), 'mssql' => moodle_database::get_driver_instance('mssql', 'native')); foreach ($databases as $type => $database) { if ($database->driver_installed() !== true) { unset($databases[$type]); } } if (empty($databases)) { $defaultdb = ''; } else { reset($databases); $defaultdb = key($databases); } // now get cli options list($options, $unrecognized) = cli_get_params(array('chmod' => isset($distro->directorypermissions) ? sprintf('%04o', $distro->directorypermissions) : '2777', 'lang' => $CFG->lang, 'wwwroot' => '', 'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))) . '/moodledata') : $distro->dataroot, 'dbtype' => empty($distro->dbtype) ? $defaultdb : $distro->dbtype, 'dbhost' => empty($distro->dbhost) ? 'localhost' : $distro->dbhost, 'dbname' => 'moodle', 'dbuser' => empty($distro->dbuser) ? 'root' : $distro->dbuser, 'dbpass' => '', 'dbport' => '', 'dbsocket' => '', 'prefix' => 'mdl_', 'fullname' => '', 'shortname' => '', 'summary' => '', 'adminuser' => 'admin', 'adminpass' => '', 'adminemail' => '', 'non-interactive' => false, 'agree-license' => false, 'allow-unstable' => false, 'help' => false), array('h' => 'help')); $interactive = empty($options['non-interactive']); // set up language $lang = clean_param($options['lang'], PARAM_SAFEDIR); if (file_exists($CFG->dirroot . '/install/lang/' . $lang)) { $CFG->lang = $lang; } if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { echo $help; die; } //Print header
} // Include necessary libs require $configfile; require_once $CFG->libdir . '/clilib.php'; require_once $CFG->libdir . '/installlib.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/componentlib.class.php'; // make sure no tables are installed yet if ($DB->get_tables()) { cli_error(get_string('clitablesexist', 'install')); } $CFG->early_install_lang = true; get_string_manager(true); raise_memory_limit(MEMORY_EXTRA); // now get cli options list($options, $unrecognized) = cli_get_params(array('lang' => 'en', 'adminuser' => 'admin', 'adminpass' => '', 'fullname' => '', 'shortname' => '', 'agree-license' => false, 'help' => false), array('h' => 'help')); if ($options['help']) { echo $help; die; } if (!$options['agree-license']) { cli_error('You have to agree to the license. --help prints out the help'); // TODO: localize } if ($options['adminpass'] === true or $options['adminpass'] === '') { cli_error('You have to specify admin password. --help prints out the help'); // TODO: localize } $options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR); if (!file_exists($CFG->dirroot . '/install/lang/' . $options['lang'])) { $options['lang'] = 'en';
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. define('CLI_SCRIPT', true); define('ENT_INSTALLER_SYNC_MAX_WORKERS', 2); define('JOB_INTERLEAVE', 2); require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; // Global moodle config file. require_once $CFG->dirroot . '/lib/clilib.php'; // CLI only functions // Ensure options are blanck; unset($options); // Now get cli options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'workers' => false, 'distributed' => false, 'verbose' => false, 'simulate' => false, 'fulldelete' => false, 'role' => false, 'unassignteachercategoryrole' => false, 'matchlevel' => false, 'force' => false, 'logroot' => false), array('h' => 'help', 'w' => 'workers', 'd' => 'distributed', 'v' => 'verbose', 's' => 'simulate', 'D' => 'fulldelete', 'r' => 'role', 'u' => 'unassignteachercategoryrole', 'm' => 'matchlevel', 'f' => 'force', 'l' => 'logroot')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Command line ENT Sync worker.\n\n Options:\n -h, --help Print out this help\n -w, --workers Number of workers.\n -d, --distributed Distributed operations.\n -v, --verbose Provides lot of output\n -s, --simulate Get all data for simulation but will NOT process any writing in database.\n -D, --fulldelete Propagates a full delete option to all workers.\n -r, --role Restricts sync to a specific role ('eleve', 'enseignant', 'administration').\n -u, --unassignteachercategoryrole \n Unassign given comma separated roles to teacher category.\n -m, --matchlevel Index of tolerance level to match users ('10:LASTNAME/FIRSTNAME','15:USERNAME (default)','20:ID/LASTNAME','50:FULL NO USERNAME','100:FULL NO GUID','200:GUID ENT').\n -f, --force Force updating all data.\n -l, --logroot Root directory for logs.\n\n "; //TODO: localize - to be translated later when everything is finished echo $help; die; } if ($options['workers'] === false) { $options['workers'] = ENT_INSTALLER_SYNC_MAX_WORKERS; } if (!empty($options['logroot'])) { $logroot = $options['logroot'];
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Tool to make all courses in a category visible (or not). * * @package tool_cat * @copyright 2015 University of Kent * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require_once dirname(__FILE__) . '/../../../../config.php'; require_once $CFG->libdir . '/clilib.php'; require_once $CFG->dirroot . '/course/lib.php'; list($options, $unrecognized) = cli_get_params(array('category' => 0, 'visibility' => 1)); if (empty($options['category']) || empty($options['visibility'])) { print_error("You must specify a category with --category and visibility with --visibility."); exit(0); } \core\session\manager::set_user(get_admin()); $category = new \tool_cat\category($options['category']); $courses = $category->get_courses(); foreach ($courses as $course) { if ($course->visible != $options['visibility']) { mtrace("Updating {$course->id}"); $course->visible = $options['visibility']; update_course($course); } }
if (isset($_SERVER['REMOTE_ADDR'])) { die; // No access from web! } // Force OPcache reset if used, we do not want any stale caches // when preparing test environment. if (function_exists('opcache_reset')) { opcache_reset(); } // Is not really necessary but adding it as is a CLI_SCRIPT. define('CLI_SCRIPT', true); define('CACHE_DISABLE_ALL', true); // Basic functions. require_once __DIR__ . '/../../../../lib/clilib.php'; require_once __DIR__ . '/../../../../lib/behat/lib.php'; list($options, $unrecognized) = cli_get_params(array('parallel' => 0, 'maxruns' => false, 'help' => false, 'fromrun' => 1, 'torun' => 0, 'run-with-theme' => false, 'optimize-runs' => ''), array('j' => 'parallel', 'm' => 'maxruns', 'h' => 'help')); // Checking run.php CLI script usage. $help = "\nBehat utilities to initialise behat tests\n\nUsage:\n php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]] [--help]\n\nOptions:\n-j, --parallel Number of parallel behat run to initialise\n-m, --maxruns Max parallel processes to be executed at one time.\n--fromrun Execute run starting from (Used for parallel runs on different vms)\n--torun Execute run till (Used for parallel runs on different vms)\n--optimize-runs Split features with specified tags in all parallel runs.\n--run-with-theme Run all core features with specified theme.\n\n-h, --help Print out this help\n\nExample from Moodle root directory:\n\$ php admin/tool/behat/cli/init.php --parallel=2\n\nMore info in http://docs.moodle.org/dev/Acceptance_testing#Running_tests\n"; if (!empty($options['help'])) { echo $help; exit(0); } // Check which util file to call. $utilfile = 'util_single_run.php'; $commandoptions = ""; // If parallel run then use utilparallel. if ($options['parallel'] && $options['parallel'] > 1) { $utilfile = 'util.php'; // Sanitize all input options, so they can be passed to util. foreach ($options as $option => $value) { if ($value) {
* lib as a CLI, VMoodle enabled script. Vmoodle enabled scripts start <with a special piece of code * that allows host switching before processing the real CLI algorithm. */ define('CLI_SCRIPT', true); define('ENT_INSTALLER_SYNC_MAX_WORKERS', 2); define('JOB_INTERLEAVE', 2); require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; // Global moodle config file. require_once $CFG->dirroot . '/lib/clilib.php'; // CLI only functions mtrace("VMoodle Automated Distributed Fixture Tool"); mtrace("##########################################\n"); // Ensure options are blanck; unset($options); // Now get cli options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'workers' => false, 'distributed' => false, 'fixture' => false, 'logroot' => false, 'include' => false, 'exclude' => false, 'simulate' => false, 'verbose' => false), array('h' => 'help', 'w' => 'workers', 'd' => 'distributed', 'f' => 'fixture', 'l' => 'logroot', 'e' => 'exclude', 'i' => 'include', 's' => 'simulate', 'v' => 'verbose')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Command line ENT Sync worker.\n\n Options:\n -h, --help Print out this help\n -w, --workers Number of workers.\n -f, --fixture Script name to give to workers.\n -d, --distributed Distributed operations.\n -l, --logroot Root directory for logs.\n -e, --exclude Exclude pattern filter (NOT LIKE).\n -i, --include Include pattern filter (LIKE).\n -s, --simulate Stops before launching and gives host list.\n -v, --verbose Stops before launching and gives host list.\n "; //TODO: localize - to be translated later when everything is finished echo $help; die; } if ($options['workers'] === false) { $options['workers'] = ENT_INSTALLER_SYNC_MAX_WORKERS; } if (!empty($options['include'])) { $allhosts = $DB->get_records_select('local_vmoodle', ' vhostname LIKE "' . $options['include'] . '" ', array());
* CLI task implementation to synchronize MailChimp mailinglist subscriptions. * * @package block_mailchimp * * @version 3.0.0 * @author John Azinheira * @copyright 2015 Saylor Academy {@link http://www.saylor.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * * * */ define('CLI_SCRIPT', true); require __DIR__ . '/../../../config.php'; require_once "{$CFG->libdir}/clilib.php"; require_once __DIR__ . '/../classes/task/mcsynchronize.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']) { cli_heading('Help'); $help = "Use this script to manually initiate a sync of users'\n mailing list subscription status with MailChimp.\n\n Options:\n -h, --help Print out this help\n\n Example:\n \$sudo -u www-data /usr/bin/php blocks/mailchimp/cli/\n cli_mcsynchronize.php\n\n"; echo $help; die; } $sync = new mcsynchronize(); cli_heading('Initiating MailChimp sync'); $sync->execute(); cli_heading('Finished MailChimp sync');
@ini_set('default_socket_timeout', 900); $CFG->debug = E_ALL | E_STRICT; // === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS! $CFG->debugdisplay = 1; // NOT FOR PRODUCTION SERVERS! 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 = "Processes PDF files with answers.\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/processpdfanswers.php --category 2\n"; // TODO: localize - to be translated later when everything is finished echo $help; die; } cli_heading('EMarking processing PDF answers file'); // TODO: localize emarking_process_digitized_answers(); exit(0); // 0 means success
// // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package local-mail * @copyright Albert Gasset <*****@*****.**> * @copyright Marc Català <*****@*****.**> * @copyright Manuel Cagigas <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('CLI_SCRIPT', true); require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; require_once $CFG->libdir . '/clilib.php'; global $DB; // Cli options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'timelimit' => false), array('h' => 'help', 't' => 'timelimit')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help']) { $help = "Local mail upgrade helper CLI tool.\nWill upgrade all remaining mails if no options are specified.\n\nOptions:\n-t, --timelimit=<n> Process mails for n number of seconds, then exit. A mail\n currently in progress will not be interrupted.\n-h, --help Print out this help\n\nExample:\n\$sudo -u www-data /usr/bin/php local/mail/cli/cliupgrade.php -t=1000\n"; echo $help; die; } // Setup the stop time. if ($options['timelimit']) { $stoptime = time() + $options['timelimit']; } else { $stoptime = false; }
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * A fixture worker will play a script after */ define('CLI_SCRIPT', true); define('ENT_INSTALLER_SYNC_INTERHOST', 1); require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; // Global moodle config file. require_once $CFG->dirroot . '/lib/clilib.php'; // CLI only functions // Now get cli options. list($options, $unrecognized) = cli_get_params(array('help' => false, 'fixture' => false, 'nodes' => false, 'logfile' => false, 'logmode' => false, 'verbose' => false), array('h' => 'help', 'f' => 'fixture', 'n' => 'nodes', 'l' => 'logfile', 'm' => 'logmode', 'v' => 'verbose')); if ($unrecognized) { $unrecognized = implode("\n ", $unrecognized); cli_error(get_string('cliunknowoption', 'admin', $unrecognized)); } if ($options['help'] || empty($options['nodes'])) { $help = "Command Line Fixture Worker.\n\n Options:\n -h, --help Print out this help\n -f, --fixture The fixture to run.\n -n, --nodes Node ids to work with.\n -l, --logfile the log file to use. No log if not defined\n -m, --logmode 'append' or 'overwrite'\n -v, --verbose Verbose output\n\n "; //TODO: localize - to be translated later when everything is finished echo $help; die; } if (empty($options['logmode'])) { $options['logmode'] = 'w'; } if (!empty($options['logfile'])) { $LOG = fopen($options['logfile'], $options['logmode']);