本文整理汇总了PHP中Theme_Upgrader::upgrade方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme_Upgrader::upgrade方法的具体用法?PHP Theme_Upgrader::upgrade怎么用?PHP Theme_Upgrader::upgrade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme_Upgrader
的用法示例。
在下文中一共展示了Theme_Upgrader::upgrade方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
function update()
{
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
// Clear the cache.
wp_update_themes();
foreach ($this->themes as $theme) {
/**
* Pre-upgrade action
*
* @since 3.9.3
*
* @param object $theme WP_Theme object
* @param array $themes Array of theme objects
*/
do_action('jetpack_pre_theme_upgrade', $theme, $this->themes);
// Objects created inside the for loop to clean the messages for each theme
$skin = new Automatic_Upgrader_Skin();
$upgrader = new Theme_Upgrader($skin);
$upgrader->init();
$result = $upgrader->upgrade($theme);
$this->log[$theme][] = $upgrader->skin->get_upgrade_messages();
}
if (!$this->bulk && !$result) {
return new WP_Error('update_fail', __('There was an error updating your theme', 'jetpack'), 400);
}
return true;
}
示例2: autoupdater_refresh_theme
/**
* Refresh families from meteor function
*/
function autoupdater_refresh_theme()
{
// refresh WordPress information of new theme versions
get_transient('update_themes');
global $wp_version, $theme_version, $theme_to_update, $api_url;
log_me('checking the update and stuff...');
if (function_exists('wp_get_theme')) {
$theme_data = wp_get_theme($theme_to_update);
$theme_version = $theme_data->Version;
} else {
$theme_data = get_theme_data(ABSPATH . '/wp-content/themes/' . $theme_to_update . '/style.css');
$theme_version = $theme_data['Version'];
}
$request = array('slug' => $theme_to_update, 'version' => $theme_version);
// Start checking for an update
$send_for_check = array('body' => array('action' => 'theme_update', 'request' => serialize($request), 'api-key' => md5(get_bloginfo('url'))), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'));
$raw_response = wp_remote_post($api_url, $send_for_check);
if (!is_wp_error($raw_response) && $raw_response['response']['code'] == 200) {
$response = unserialize($raw_response['body']);
}
// check if the new version is higher
// if (version_compare($theme_version, $response['new_version']))
if (version_compare($theme_version, $response['new_version'], '<')) {
require ABSPATH . 'wp-admin/includes/screen.php';
require ABSPATH . 'wp-admin/includes/plugin.php';
require ABSPATH . 'wp-admin/includes/template.php';
require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
require ABSPATH . 'wp-admin/includes/file.php';
require ABSPATH . 'wp-admin/includes/misc.php';
$theme = $theme_to_update;
$title = __('Update Theme');
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
// require_once(ABSPATH . 'wp-admin/admin-header.php');
$nonce = 'upgrade-theme_' . $theme_to_update;
$url = 'update.php?action=upgrade-theme&theme=' . urlencode($theme_to_update);
$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
$upgrader->upgrade($theme_to_update);
}
}
示例3: puma_theme_update_callback
function puma_theme_update_callback()
{
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$update_data = array('theme_version' => get_transient('puma_latest'), 'update_link' => 'https://github.com/bigfa/Puma/archive/master.zip');
$name = "Puma";
$slug = "Puma";
$version = $update_data['theme_version'];
$download_link = $update_data['update_link'];
delete_site_transient('update_themes');
$themes = wp_get_themes();
$current = (object) array("last_checked" => time(), "checked" => array(), "response" => array(), "translations" => array());
foreach ($themes as $theme) {
$current->checked[$theme->get('Slug')] = $theme->get('Version');
}
$current->response[$slug] = array('theme' => $slug, 'new_version' => $version, 'url' => '', 'package' => $download_link);
set_site_transient('update_themes', $current);
$title = __('Update Theme');
$nonce = 'upgrade-theme_' . $slug;
$url = 'update.php?action=upgrade-theme&theme=' . urlencode($slug);
$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
$upgrader->upgrade($slug);
exit;
}
示例4: _wprp_upgrade_theme
/**
* Update a theme
*
* @param mixed $theme
* @return array
*/
function _wprp_upgrade_theme($theme)
{
include_once ABSPATH . 'wp-admin/includes/admin.php';
if (!_wprp_supports_theme_upgrade()) {
return array('status' => 'error', 'error' => 'WordPress version too old for theme upgrades');
}
$skin = new WPRP_Theme_Upgrader_Skin();
$upgrader = new Theme_Upgrader($skin);
// Do the upgrade
ob_start();
$result = $upgrader->upgrade($theme);
$data = ob_get_contents();
ob_clean();
if (!$result && !is_null($result) || $data) {
return array('status' => 'error', 'error' => 'file_permissions_error');
} elseif (is_wp_error($result)) {
return array('status' => 'error', 'error' => $result->get_error_code());
}
if ($skin->error) {
return array('status' => 'error', 'error' => $skin->error);
}
return array('status' => 'success');
}
示例5: wp_update_theme
/**
* This was once used to kick-off the Theme Updater.
*
* Deprecated in favor of instantating a Theme_Upgrader instance directly,
* and calling the 'upgrade' method.
* Unused since 2.8.0.
*
* @since 2.7.0
* @deprecated 3.7.0
* @see Theme_Upgrader
*/
function wp_update_theme($theme, $feedback = '')
{
_deprecated_function(__FUNCTION__, '3.7', 'new Theme_Upgrader();');
if (!empty($feedback)) {
add_filter('update_feedback', $feedback);
}
include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new Theme_Upgrader();
return $upgrader->upgrade($theme);
}
示例6: elseif
include ABSPATH . 'wp-admin/admin-footer.php';
} elseif ('upgrade-theme' == $action) {
if (!current_user_can('update_themes')) {
wp_die(__('You do not have sufficient permissions to update themes for this site.'));
}
check_admin_referer('upgrade-theme_' . $theme);
wp_enqueue_script('customize-loader');
wp_enqueue_script('updates');
$title = __('Update Theme');
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
require_once ABSPATH . 'wp-admin/admin-header.php';
$nonce = 'upgrade-theme_' . $theme;
$url = 'update.php?action=upgrade-theme&theme=' . urlencode($theme);
$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
$upgrader->upgrade($theme);
include ABSPATH . 'wp-admin/admin-footer.php';
} elseif ('update-selected-themes' == $action) {
if (!current_user_can('update_themes')) {
wp_die(__('You do not have sufficient permissions to update themes for this site.'));
}
check_admin_referer('bulk-update-themes');
if (isset($_GET['themes'])) {
$themes = explode(',', stripslashes($_GET['themes']));
} elseif (isset($_POST['checked'])) {
$themes = (array) $_POST['checked'];
} else {
$themes = array();
}
$themes = array_map('urldecode', $themes);
$url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
示例7: wp_update_theme
function wp_update_theme($theme, $feedback = '')
{
if (!empty($feedback)) {
add_filter('update_feedback', $feedback);
}
include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader = new Theme_Upgrader();
return $upgrader->upgrade($theme);
}
示例8: update_project
/**
* Download and install a plugin update.
*
* @since 4.0.0
* @param int $pid The project ID.
* @param bool $die_on_error Default is true. Otherwise function will
* return false on error.
* @return bool True on success.
*/
public function update_project($pid, $die_on_error = true)
{
// Refresh local project cache before the update starts.
WPMUDEV_Dashboard::$site->set_option('refresh_local_flag', true);
$local_projects = WPMUDEV_Dashboard::$site->get_cached_projects();
// Now make sure that the project is updated, no matter what!
WPMUDEV_Dashboard::$api->calculate_upgrades($local_projects, $pid);
if (!$this->is_project_installed($pid)) {
if ($die_on_error) {
wp_send_json_error(array('message' => __('Project not installed', 'wdpmudev')));
} else {
error_log('WPMU DEV error: Update failed - project not installed');
return false;
}
}
$project = WPMUDEV_Dashboard::$site->get_project_infos($pid);
// Upfront special: If updating a child theme first update parent.
if ($project->need_upfront) {
$upfront = WPMUDEV_Dashboard::$site->get_project_infos($this->id_upfront);
// Time condition to avoid repeated UF checks if there was an error.
$check = (int) WPMUDEV_Dashboard::$site->get_option('last_check_upfront');
if (!$upfront->is_installed) {
if (time() > $check + 3 * MINUTE_IN_SECONDS) {
WPMUDEV_Dashboard::$site->set_option('last_check_upfront', time());
$this->install_project($upfront->pid, $error, false);
}
} elseif ($upfront->version_installed != $upfront->version_latest) {
if (time() > $check + 3 * MINUTE_IN_SECONDS) {
WPMUDEV_Dashboard::$site->set_option('last_check_upfront', time());
$this->update_project($upfront->pid, false);
}
}
}
// For plugins_api..
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
// Save on a bit of bandwidth.
$api = plugins_api('plugin_information', array('slug' => 'wpmudev_install-' . $pid, 'fields' => array('sections' => false)));
if (is_wp_error($api)) {
if ($die_on_error) {
wp_send_json_error(array('message' => __('No data found', 'wpmudev')));
} else {
error_log('WPMU DEV error: Update failed - no upgrade data found');
return false;
}
}
ob_start();
$skin = new Automatic_Upgrader_Skin();
$result = false;
$success = false;
$update_file = $project->filename;
/*
* Set before the update:
* WP will refresh local cache via action-hook before the install()
* method is finished. That refresh call must scan the FS again.
*/
$this->flush_fs_cache = true;
$this->flush_info_cache = true;
switch ($project->type) {
case 'plugin':
wp_update_plugins();
$upgrader = new Plugin_Upgrader($skin);
$result = $upgrader->bulk_upgrade(array($update_file));
break;
case 'theme':
wp_update_themes();
$upgrader = new Theme_Upgrader($skin);
$update_file = dirname($update_file);
$result = $upgrader->upgrade($update_file);
break;
}
// Check for errors.
if (is_array($result) && empty($result[$update_file]) && is_wp_error($skin->result)) {
$result = $skin->result;
}
$details = ob_get_clean();
$err_data = array('error_code' => 'U000', 'message' => __('Update failed', 'wpmudev'), 'details' => $details, 'pid' => $pid);
if (is_array($result) && !empty($result[$update_file])) {
$plugin_update_data = current($result);
if (true === $plugin_update_data) {
$err_data['error_code'] = 'U001';
$err_data['message'] = implode('<br>', $skin->get_upgrade_messages());
error_log('WPMU DEV error: Update failed | ' . json_encode($err_data));
if ($die_on_error) {
$this->send_json_error($err_data);
} else {
return false;
}
}
} elseif (is_wp_error($result)) {
$err_data['error_code'] = 'U002';
//.........这里部分代码省略.........
示例9: update_theme
/**
* Update a single theme.
*
* @param string $theme_slug
* @param string $tag
*
* @throws \Exception
*/
public function update_theme($theme_slug, $tag = 'master')
{
$theme = null;
foreach ((array) Theme::instance()->get_theme_configs() as $config_entry) {
if ($config_entry->repo === $theme_slug) {
$theme = $config_entry;
break;
}
}
if (!$theme) {
throw new \Exception(esc_html__('Theme not found or not updatable with GitHub Updater: ', 'github-updater') . $theme_slug);
}
$this->get_remote_repo_meta($theme);
$updates_transient = get_site_transient('update_themes');
$update = array('theme' => $theme->repo, 'new_version' => null, 'url' => $theme->uri, 'package' => $this->repo_api->construct_download_link(false, $tag));
$updates_transient->response[$theme->repo] = $update;
set_site_transient('update_themes', $updates_transient);
$upgrader = new \Theme_Upgrader($this->upgrader_skin);
$upgrader->upgrade($theme->repo);
}
示例10: _wprp_update_theme
/**
* Update a theme
*
* @param mixed $theme
* @return array
*/
function _wprp_update_theme($theme)
{
if (defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS) {
return new WP_Error('disallow-file-mods', __("File modification is disabled with the DISALLOW_FILE_MODS constant.", 'wpremote'));
}
include_once ABSPATH . 'wp-admin/includes/admin.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
require_once WPRP_PLUGIN_PATH . 'inc/class-wprp-theme-upgrader-skin.php';
// check for filesystem access
if (!_wpr_check_filesystem_access()) {
return new WP_Error('filesystem-not-writable', __('The filesystem is not writable with the supplied credentials', 'wpremote'));
}
$skin = new WPRP_Theme_Upgrader_Skin();
$upgrader = new Theme_Upgrader($skin);
// Do the upgrade
ob_start();
$result = $upgrader->upgrade($theme);
$data = ob_get_contents();
ob_clean();
if (!empty($skin->error)) {
return new WP_Error('theme-upgrader-skin', $upgrader->strings[$skin->error]);
} else {
if (is_wp_error($result)) {
return $result;
} else {
if (!$result && !is_null($result) || $data) {
return new WP_Error('theme-update', __('Unknown error updating theme.', 'wpremote'));
}
}
}
return array('status' => 'success');
}
示例11: upgrade
/**
* Download and install a single plugin/theme update.
*
* @since 4.0.0
* @param int/string $pid The project ID or a plugin slug.
* @return bool True on success.
*/
public function upgrade($pid)
{
$this->clear_error();
// Is a WPMU DEV project?
$is_dev = is_numeric($pid);
if ($is_dev) {
$pid = (int) $pid;
$infos = $this->prepare_dev_upgrade($pid);
if (!$infos) {
return false;
}
$filename = 'theme' == $infos['type'] ? dirname($infos['filename']) : $infos['filename'];
$slug = $infos['slug'];
$type = $infos['type'];
} elseif (is_string($pid)) {
// No need to check if the plugin exists/is installed. WP will check it.
list($type, $filename) = explode(':', $pid);
$slug = 'plugin' == $type && false !== strpos($filename, '/') ? dirname($filename) : $filename;
} else {
$this->set_error($pid, 'UPG.07', __('Invalid upgrade call', 'wdpmudev'));
return false;
}
// For plugins_api/themes_api..
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
include_once ABSPATH . 'wp-admin/includes/theme-install.php';
include_once ABSPATH . 'wp-admin/includes/file.php';
ob_start();
$skin = new Automatic_Upgrader_Skin();
$result = false;
$success = false;
/*
* Set before the update:
* WP will refresh local cache via action-hook before the install()
* method is finished. That refresh call must scan the FS again.
*/
WPMUDEV_Dashboard::$site->clear_local_file_cache();
switch ($type) {
case 'plugin':
// Save on a bit of bandwidth.
$api = plugins_api('plugin_information', array('slug' => $slug, 'fields' => array('sections' => false)));
if (is_wp_error($api)) {
$this->set_error($pid, 'UPG.02', __('No data found', 'wdpmudev'));
return false;
}
wp_update_plugins();
$active_blog = is_plugin_active($filename);
$active_network = is_multisite() && is_plugin_active_for_network($filename);
$upgrader = new Plugin_Upgrader($skin);
$result = $upgrader->upgrade($filename);
/*
* Note: The following plugin activation is an intended and
* needed step. During upgrade() WordPress deactivates the
* plugin network- and site-wide. By default the user would
* see a upgrade-results page with the option to activate the
* plugin again. We skip that screen and restore original state.
*/
if ($active_blog) {
activate_plugin($filename, false, false, true);
}
if ($active_network) {
activate_plugin($filename, false, true, true);
}
break;
case 'theme':
// Save on a bit of bandwidth.
$api = themes_api('theme_information', array('slug' => $slug, 'fields' => array('sections' => false)));
if (is_wp_error($api)) {
$this->set_error($pid, 'UPG.02', __('No data found', 'wdpmudev'));
return false;
}
wp_update_themes();
$upgrader = new Theme_Upgrader($skin);
$result = $upgrader->upgrade($filename);
break;
default:
$this->set_error($pid, 'UPG.08', __('Invalid upgrade call', 'wpmudev'));
return false;
}
// Check for errors.
if (is_array($result) && empty($result[$filename]) && is_wp_error($skin->result)) {
$result = $skin->result;
}
$details = ob_get_clean();
if (is_array($result) && !empty($result[$filename])) {
$plugin_update_data = current($result);
if (true === $plugin_update_data) {
$this->set_error($pid, 'UPG.03', implode('<br>', $skin->get_upgrade_messages()));
return false;
}
} elseif (is_wp_error($result)) {
$this->set_error($pid, 'UPG.04', $result->get_error_message());
return false;
//.........这里部分代码省略.........
示例12: do_theme_update
/**
* Process automatic theme update
*
* @since 1.0.0
*/
public function do_theme_update()
{
if (!isset($_REQUEST['nonce'])) {
die;
}
if (!wp_verify_nonce(esc_attr($_REQUEST['nonce']), 'monstroid-dashboard')) {
die;
}
if (!current_user_can('update_themes')) {
die;
}
monstroid_dashboard()->filesystem->add_creds();
$backup_link = $this->try_make_backup();
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once monstroid_dashboard()->plugin_dir('admin/includes/class-monstroid-dashboard-upgrader-skin.php');
$title = __('Update Monstroid theme', 'monstroid-dashboard');
$theme = 'monstroid';
$upgrader = new Theme_Upgrader(new Monstroid_Dashboard_Upgrader_Skin(compact('title', 'theme')));
ini_set('max_execution_time', -1);
set_time_limit(0);
$update = $upgrader->upgrade($theme);
$log = $upgrader->skin->get_install_log();
$success = __('Great news! Monstroid Dashboard successfully updated your theme to the latest available version', 'monstroid-dashboard');
if (true == $update) {
$this->clear_update_data();
wp_send_json_success(array('message' => $success, 'newVersion' => $this->get_update_data('new_version'), 'updateLog' => $log));
}
$upgrader->maintenance_mode(false);
if (is_wp_error($update)) {
wp_send_json_error(array('message' => sprintf(__('Update failed. %s', 'monstroid-dashboard'), $update->get_error_message()), 'updateLog' => $log));
}
if (!$update) {
wp_send_json_error(array('message' => __('Update failed. <a href="#" class="show-update-log">Show update log</a>', 'monstroid-dashboard'), 'updateLog' => $log));
}
wp_send_json_error(array('message' => __('Unknown error, please try again later or contact our support', 'monstroid-dashboard'), 'updateLog' => $log));
}
示例13: wp_oracle_get_theme_upgrade
public function wp_oracle_get_theme_upgrade()
{
include_once ABSPATH . 'wp-admin/includes/admin.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-wordpress-oracle-theme-upgrader-skin.php';
if (isset($_REQUEST['theme'])) {
$skin = new Wordpress_Oracle_Theme_Upgrader_Skin();
$upgrader = new Theme_Upgrader($skin);
// Do the upgrade
ob_start();
$result = $upgrader->upgrade($_REQUEST['theme']);
$data = ob_get_contents();
ob_clean();
if (!empty($skin->error)) {
return new WP_Error('theme_upgrader_skin', $upgrader->strings[$skin->error]);
} else {
if (is_wp_error($result)) {
return $result;
} else {
if (!$result && !is_null($result) || $data) {
return new WP_Error('unknown_error', 'Unknown error updating theme.');
}
}
}
return array('blog' => array('theme_updated' => $_REQUEST['theme']));
} else {
return new WP_Error('no_theme_file', 'Please specify theme name.');
}
}
示例14: wp_update_theme
/**
* This was once used to kick-off the Theme Updater.
*
* Deprecated in favor of instantiating a Theme_Upgrader instance directly,
* and calling the 'upgrade' method.
* Unused since 2.8.0.
*
* @since 2.7.0
* @deprecated 3.7.0 Use Theme_Upgrader
* @see Theme_Upgrader
*/
function wp_update_theme($theme, $feedback = '')
{
_deprecated_function(__FUNCTION__, '3.7.0', 'new Theme_Upgrader();');
if (!empty($feedback)) {
add_filter('update_feedback', $feedback);
}
$upgrader = new Theme_Upgrader();
return $upgrader->upgrade($theme);
}
示例15: doInstallUpdate
/**
* [doInstallUpdate description]
* @param [type] $update_id [description]
* @param [type] $build_url [description]
* @param [type] $package_url [description]
* @return [type] [description]
*/
public function doInstallUpdate($update_row)
{
global $wp_filesystem;
/*
// Parse Update ID
$update_keys = array('type', 'element', 'version', 'locale');
$update_vals = explode( ':', $update_row->update_id );
$update_rule = new wbSiteManager_Params( array_combine(array_intersect_key($update_keys, $update_vals), array_intersect_key($update_vals, $update_keys)) );
if( empty($update_rule->type) ){
$this->out('Invalid Update ID: ' . $update_id);
return false;
}
$this->out('Processing Update ID: '. $update_id);
*/
// Switch Type
$this->out('Processing Update ID: ' . $update_row->update_id);
switch ($update_row->type) {
case 'core':
// Load Update Record
$remoteUrl = 'update-core.php?action=do-core-upgrade';
$reinstall = false;
if ($update_row->version == $update_row->installed_version) {
$reinstall = true;
$remoteUrl = 'update-core.php?action=do-core-reinstall';
}
$update = find_core_update($update_row->version, $update_row->get('locale', 'en_US'));
if (!$update) {
$this->out(' - Failed to Load Update');
return false;
}
if ($reinstall) {
$update->response = 'reinstall';
}
// Confirm Write Access
$allow_relaxed_file_ownership = isset($update->new_files) && !$update->new_files;
if (false === ($credentials = request_filesystem_credentials($remoteUrl, '', false, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership))) {
$this->out(' - Invalid File Permission');
return false;
}
if (!WP_Filesystem($credentials, ABSPATH, $allow_relaxed_file_ownership)) {
$this->out(' - Failed to load File Permissions');
return false;
}
if ($wp_filesystem->errors->get_error_code()) {
foreach ($wp_filesystem->errors->get_error_messages() as $message) {
$this->out(' - File Error: ' . $message);
}
return false;
}
// Run Update
$upgrader_skin = new wbSiteManager_WP_Upgrader_Skin(array(), $this);
$upgrader = new Core_Upgrader($upgrader_skin);
$result = $upgrader->upgrade($update, array('allow_relaxed_file_ownership' => $allow_relaxed_file_ownership));
$response_html = explode("\n", strip_tags(ob_get_clean()));
ob_end_clean();
if (is_wp_error($result)) {
if ($result->get_error_data() && is_string($result->get_error_data())) {
$message = $result->get_error_message() . ': ' . $result->get_error_data();
} else {
$message = $result->get_error_message();
}
$this->out(' - Update Error: ' . $message);
if ('up_to_date' != $result->get_error_code()) {
$this->out(' - Insallation Failed');
}
return false;
}
// Clear Cache
set_site_transient('update_core', null);
break;
case 'plugin':
// Install vs Upgrade
if ($install) {
// Get Plugins API
$plugin_api = plugins_api('plugin_information', array('slug' => $update_row->extension_id, 'fields' => array('short_description' => false, 'sections' => false, 'requires' => false, 'rating' => false, 'ratings' => false, 'downloaded' => false, 'last_updated' => false, 'added' => false, 'tags' => false, 'compatibility' => false, 'homepage' => false, 'donate_link' => false)));
// Load Plugin Updater
$upgrader = new Plugin_Upgrader(new wbSiteManager_Plugin_Upgrader_Skin(array('title' => 'Install Plugin: ' . $update_row->extension_id . ' v' . $update_row->version, 'nonce' => 'install-plugin_' . $update_row->extension_id, 'url' => 'update.php?action=install-plugin&plugin=' . urlencode($update_row->extension_id), 'plugin' => $update_row->extension_id, 'api' => $api), $this));
$upgrader->install($plugin_api->download_link);
} else {
// Load Plugin Updater
$upgrader = new Plugin_Upgrader(new wbSiteManager_Plugin_Upgrader_Skin(array('title' => 'Upgrade Plugin: ' . $update_row->extension_id . ' v' . $update_row->version, 'nonce' => 'upgrade-plugin_' . $update_row->extension_id, 'url' => 'update.php?action=upgrade-plugin&plugin=' . urlencode($update_row->extension_id), 'plugin' => $update_row->extension_id), $this));
$upgrader->upgrade($update_row->extension_id);
}
// Process Result
if (empty($upgrader->result)) {
$this->out(' - Installation Failed');
return false;
}
// Clear Cache
// set_site_transient( 'update_core', null );
break;
case 'theme':
// Install vs Upgrade
//.........这里部分代码省略.........