WP_CLI::addCommand PHP Method

addCommand() public static method

back-compat
public static addCommand ( $name, $class )
    public static function addCommand($name, $class)
    {
        trigger_error(sprintf('wp %s: %s is deprecated. use WP_CLI::add_command() instead.', $name, __FUNCTION__), E_USER_WARNING);
        self::add_command($name, $class);
    }

Usage Example

Esempio n. 1
0
<?php

WP_CLI::addCommand('sql', 'SqlCommand');
/**
 * Implement sql command
 *
 * @package wp-cli
 * @subpackage commands/internals
 **/
class SqlCommand extends WP_CLI_Command
{
    protected $default_subcommand = 'cli';
    /**
     * return a string to connecting to the DB.
     *
     * @param void
     * @return string $connect
     */
    protected function connect_string()
    {
        $connect = sprintf('mysql --database=%s --user=%s --password=%s', DB_NAME, DB_USER, DB_PASSWORD);
        return $connect;
    }
    /**
     * A string for connecting to the DB.
     *
     * @param string $args
     * @return void
     */
    function connect($args = array())
    {
All Usage Examples Of WP_CLI::addCommand