本文整理汇总了PHP中find_core_update函数的典型用法代码示例。如果您正苦于以下问题:PHP find_core_update函数的具体用法?PHP find_core_update怎么用?PHP find_core_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_core_update函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update
protected function update($version, $locale)
{
$args = $this->input();
$version = isset($args['version']) ? $args['version'] : false;
$locale = isset($args['locale']) ? $args['locale'] : get_locale();
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
delete_site_transient('update_core');
wp_version_check(array(), true);
if ($version) {
$update = find_core_update($version, $locale);
} else {
$update = $this->find_latest_update_offer();
}
/**
* Pre-upgrade action
*
* @since 3.9.3
*
* @param object|array $update as returned by find_core_update() or find_core_auto_update()
*/
do_action('jetpack_pre_core_upgrade', $update);
$skin = new Automatic_Upgrader_Skin();
$upgrader = new Core_Upgrader($skin);
$this->new_version = $upgrader->upgrade($update);
$this->log = $upgrader->skin->get_upgrade_messages();
if (is_wp_error($this->new_version)) {
return $this->new_version;
}
return $this->new_version;
}
开发者ID:pcuervo,项目名称:wp-carnival,代码行数:30,代码来源:class.jetpack-json-api-core-modify-endpoint.php
示例2: bruteprotect_update_core
/**
* Updates wordpress core to the given version.
*
* Returns the new version on success, and a Wp_error object on failure
*
* @param string $version
* @return string|object
*/
function bruteprotect_update_core($version)
{
$locale = get_locale();
$update = find_core_update($version, $locale);
$skin = new Automatic_Upgrader_Skin();
$upgrader = new Core_Upgrader($skin);
$results = $upgrader->upgrade($update);
return $results;
}
开发者ID:jeremylightsmith,项目名称:blog,代码行数:17,代码来源:update.php
示例3: update
private function update($version, $locale)
{
$args = $this->input();
$version = isset($args['version']) ? $args['version'] : false;
$locale = isset($args['locale']) ? $args['locale'] : get_locale();
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
delete_site_transient('update_core');
wp_version_check(array(), true);
if ($version) {
$update = find_core_update($version, $locale);
} else {
$update = $this->find_latest_update_offer();
}
$skin = new Automatic_Upgrader_Skin();
$upgrader = new Core_Upgrader($skin);
$this->new_version = $upgrader->upgrade($update);
$this->log = $upgrader->skin->get_upgrade_messages();
if (is_wp_error($this->new_version)) {
return $this->new_version;
}
return $this->new_version;
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:22,代码来源:class.jetpack-json-api-core-modify-endpoint.php
示例4: do_undismiss_core_update
function do_undismiss_core_update() {
$version = isset( $_POST['version'] )? $_POST['version'] : false;
$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
$update = find_core_update( $version, $locale );
if ( !$update )
return;
undismiss_core_update( $version, $locale );
wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:9,代码来源:update-core.php
示例5: wp_ajax_update_core
/**
* AJAX handler for updating core.
*
* @since 4.6.0
*
* @see Core_Upgrader
*/
function wp_ajax_update_core()
{
check_ajax_referer('updates');
if (!current_user_can('update_core')) {
$status['error'] = __('You do not have sufficient permissions to update this site.');
wp_send_json_error($status);
}
$reinstall = isset($_POST['reinstall']) ? (bool) $_POST['reinstall'] : false;
$version = isset($_POST['version']) ? sanitize_text_field(wp_unslash($_POST['version'])) : false;
$locale = isset($_POST['locale']) ? sanitize_text_field(wp_unslash($_POST['locale'])) : 'en_US';
$update = find_core_update($version, $locale);
if (!$update) {
return;
}
$status = array('update' => 'core', 'redirect' => esc_url(self_admin_url('about.php?updated')));
if ($update->current === $update->version) {
wp_send_json_success($status);
}
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
if ($reinstall) {
$update->response = 'reinstall';
}
$upgrader = new WP_Automatic_Updater();
$result = $upgrader->update('core', $update);
if (is_array($result) && !empty($result[0])) {
wp_send_json_success($status);
} else {
if (is_wp_error($result)) {
$status['error'] = $result->get_error_message();
wp_send_json_error($status);
} else {
if (false === $result) {
// These aren't actual errors.
$status['error'] = __('Installation Failed');
wp_send_json_error($status);
}
}
}
// An unhandled error occurred.
$status['error'] = __('Installation failed.');
wp_send_json_error($status);
}
开发者ID:ethitter,项目名称:shiny-updates,代码行数:49,代码来源:ajax-actions.php
示例6: 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
//.........这里部分代码省略.........
开发者ID:WebuddhaInc,项目名称:wordpress-plg_wbsitemanager,代码行数:101,代码来源:autoupdate.php
注:本文中的find_core_update函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论