Exemple #1
0
 public function __construct()
 {
     parent::__construct();
     if (!defined("VANDELAY_CONFIG_FILE")) {
         WP_CLI::error("Please set configuration file using VANDELAY_CONFIG_FILE constant");
     }
 }
Exemple #2
0
    private function general_help()
    {
        WP_CLI::line('Available commands:');
        foreach (WP_CLI::load_all_commands() as $command => $class) {
            if ('help' == $command) {
                continue;
            }
            $out = "    wp {$command}";
            $methods = WP_CLI_Command::get_subcommands($class);
            if (!empty($methods)) {
                $out .= ' [' . implode('|', $methods) . ']';
            }
            WP_CLI::line($out);
        }
        WP_CLI::line(<<<EOB

See 'wp help <command>' for more information on a specific command.

Global parameters:
    --user=<id|login>   set the current user
    --url=<url>         set the current URL
    --path=<path>       set the current path to the WP install
    --require=<path>    load a certain file before running the command
    --quiet             suppress informational messages
    --version           print wp-cli version
EOB
);
    }
Exemple #3
0
 public function __construct()
 {
     if (\WP_CLI\Utils\wp_version_compare(3.7, '<')) {
         // remove description for wp <= 3.7
         $this->fields = array_values(array_diff($this->fields, array('description')));
     }
     parent::__construct();
 }
Exemple #4
0
 private function single_command_help($name, $command)
 {
     WP_CLI::out('    wp ' . $name);
     $methods = WP_CLI_Command::get_subcommands($command);
     if (!empty($methods)) {
         WP_CLI::out(' [' . implode('|', $methods) . ']');
     }
     WP_CLI::line(' ...');
 }
Exemple #5
0
 public function __construct()
 {
     global $wp_version;
     if (version_compare($wp_version, 3.7, '<')) {
         // remove description for wp <= 3.7
         $this->fields = array_values(array_diff($this->fields, array('description')));
     }
     parent::__construct();
 }
Exemple #6
0
    if (isset($GLOBALS['wp_query']) && isset($GLOBALS['wp'])) {
        $GLOBALS['wp']->parse_request();
        $GLOBALS['wp_query']->query($GLOBALS['wp']->query_vars);
    }
}
// Set the user
if (isset($assoc_args['user'])) {
    $user = $assoc_args['user'];
    if (is_numeric($user)) {
        $user_id = (int) $user;
    } else {
        $user_id = (int) username_exists($user);
    }
    if (!$user_id || !wp_set_current_user($user_id)) {
        WP_CLI::error(sprintf('Could not get a user_id for this user: %s', var_export($user, true)));
    }
    unset($user);
}
// Set filesystem method
add_filter('filesystem_method', function () {
    return 'direct';
}, 99);
// Handle --completions parameter
if (isset($assoc_args['completions'])) {
    WP_CLI::load_all_commands();
    foreach (WP_CLI::$commands as $name => $command) {
        WP_CLI::line($name . ' ' . implode(' ', WP_CLI_Command::get_subcommands($command)));
    }
    exit;
}
WP_CLI::run_command($arguments, $assoc_args);
Exemple #7
0
 function __construct()
 {
     parent::__construct();
     $this->fetcher = new \WP_CLI\Fetchers\Theme();
 }
Exemple #8
0
 function __construct()
 {
     parent::__construct();
 }
Exemple #9
0
// Set filesystem method
add_filter('filesystem_method', function () {
    return 'direct';
}, 99);
// Handle --user parameter
if (isset($assoc_args['user'])) {
    $user = $assoc_args['user'];
    if (is_numeric($user)) {
        $user_id = (int) $user;
    } else {
        $user_id = (int) username_exists($user);
    }
    if (!$user_id || !wp_set_current_user($user_id)) {
        WP_CLI::error(sprintf('Could not get a user_id for this user: %s', var_export($user, true)));
    }
    unset($assoc_args['user'], $user);
}
// Handle --require parameter
if (isset($assoc_args['require'])) {
    require $assoc_args['require'];
    unset($assoc_args['require']);
}
// Generate strings for autocomplete
if (WP_CLI_AUTOCOMPLETE) {
    foreach (WP_CLI::load_all_commands() as $name => $command) {
        $subcommands = implode(' ', WP_CLI_Command::get_subcommands($command));
        WP_CLI::line($name . ' ' . $subcommands);
    }
    exit;
}
WP_CLI::run_command($arguments, $assoc_args);
Exemple #10
-10
 function __construct($args, $assoc_args)
 {
     require_once ABSPATH . 'wp-admin/includes/plugin.php';
     require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     parent::__construct($args, $assoc_args);
 }