Example #1
0
// Handle --url and --blog parameters
WP_CLI::_set_url($assoc_args);
if (array('core', 'download') == $arguments) {
    WP_CLI::run_command($arguments, $assoc_args);
    exit;
}
if (!is_readable(WP_ROOT . 'wp-load.php')) {
    WP_CLI::error('This does not seem to be a WordPress install. Pass --path=`path/to/wordpress` or run `wp core download`.');
}
if (array('core', 'config') == $arguments) {
    WP_CLI::run_command($arguments, $assoc_args);
    exit;
}
// The db commands don't need any WP files
if (array('db') == array_slice($arguments, 0, 1)) {
    WP_CLI::load_wp_config();
    WP_CLI::run_command($arguments, $assoc_args);
    exit;
}
// Set installer flag before loading any WP files
if (array('core', 'install') == $arguments) {
    WP_CLI::check_required_args(array('url', 'title', 'admin_email', 'admin_password'), $assoc_args);
    define('WP_INSTALLING', true);
}
// Load WordPress
require WP_ROOT . 'wp-load.php';
// Fix memory limit. See http://core.trac.wordpress.org/ticket/14889
@ini_set('memory_limit', -1);
require ABSPATH . 'wp-admin/includes/admin.php';
// Load the right info into the global wp_query
if (!defined('WP_INSTALLING') && isset($assoc_args['url'])) {