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


PHP cli_get_params函数代码示例

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


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

示例1: define

//
// 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 <brendan@catalyst-au.net>
 * @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;
}
开发者ID:central-queensland-uni,项目名称:moodle-local_linkchecker_robot,代码行数:31,代码来源:scrape-as.php

示例2: define

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__);
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:31,代码来源:util.php

示例3: define

 *
 * @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!');
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:trigger_assignment_events.php

示例4: define

//
// 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);
开发者ID:gabrielrosset,项目名称:moodle,代码行数:31,代码来源:svgtool.php

示例5: define

    // 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)) {
开发者ID:aleph-n,项目名称:lms.aaenl,代码行数:31,代码来源:run.php

示例6: define

 * 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);
开发者ID:gabrielrosset,项目名称:moodle,代码行数:31,代码来源:alternative_component_cache.php

示例7: define

//
// 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'];
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:maketestsite.php

示例8: define

// 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 <dan@moodle.com>
 * @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'));
}
开发者ID:gabrielrosset,项目名称:moodle,代码行数:31,代码来源:indexer.php

示例9: define

 * 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 {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:sync.php

示例10: define

// 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"';
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:31,代码来源:bulkplugin.php

示例11: define

/**
 * 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);
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:mysql_collation.php

示例12: list

 * 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);
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:util.php

示例13: define

 *     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)) {
开发者ID:FMCorz,项目名称:moodle-local_ci,代码行数:31,代码来源:configure_site.php

示例14: define

<?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));
开发者ID:micaherne,项目名称:moodle-tool_composer,代码行数:19,代码来源:composer.php

示例15: define

 * @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 <petr.skoda@totaralms.com>
 */
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'])) {
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:mysql_compressed_rows.php


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