/** * Update one or more plugins. * * ## OPTIONS * * [<plugin>...] * : One or more plugins to update. * * [--all] * : If set, all plugins that have updates will be updated. * * [--version=<version>] * : If set, the plugin will be updated to the specified version. * * [--dry-run] * : Preview which plugins would be updated. * * ## EXAMPLES * * wp plugin update bbpress --version=dev * * wp plugin update --all */ function update($args, $assoc_args) { if (isset($assoc_args['version'])) { foreach ($this->fetcher->get_many($args) as $plugin) { $this->_delete($plugin); $assoc_args['force'] = 1; $this->install(array($plugin->name), $assoc_args); } } else { parent::update_many($args, $assoc_args); } }
/** * Update one or more themes. * * ## OPTIONS * * [<theme>...] * : One or more themes to update. * * [--all] * : If set, all themes that have updates will be updated. * * [--version=<version>] * : If set, the theme will be updated to the latest development version, * regardless of what version is currently installed. * * [--dry-run] * : Preview which themes would be updated. * * ## EXAMPLES * * wp theme update twentyeleven twentytwelve * * wp theme update --all */ function update($args, $assoc_args) { parent::update_many($args, $assoc_args); }
/** * Update one or more themes. * * ## OPTIONS * * [<theme>...] * : One or more themes to update. * * [--all] * : If set, all themes that have updates will be updated. * * [--format=<format>] * : Output summary as table or summary. Defaults to table. * * [--version=<version>] * : If set, the theme will be updated to the specified version. * * [--dry-run] * : Preview which themes would be updated. * * ## EXAMPLES * * wp theme update twentyeleven twentytwelve * * wp theme update --all */ function update($args, $assoc_args) { if (isset($assoc_args['version'])) { foreach ($this->fetcher->get_many($args) as $theme) { $r = delete_theme($theme->stylesheet); if (is_wp_error($r)) { WP_CLI::warning($r); } else { $assoc_args['force'] = true; $this->install(array($theme->stylesheet), $assoc_args); } } } else { parent::update_many($args, $assoc_args); } }