• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_version_check函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_version_check函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_version_check函数的具体用法?PHP wp_version_check怎么用?PHP wp_version_check使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_version_check函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: runUpgradeRequiredCheck

 /**
  * Checks if upgrade is required or not
  **/
 function runUpgradeRequiredCheck()
 {
     global $wp_version;
     //if this function does not exist, it means upgrade is definitely required
     if (!function_exists('wp_version_check')) {
         return true;
     } else {
         //run the core check
         if ($wp_version >= 2.7) {
             $update_array = get_core_updates();
             if (is_array($update_array)) {
                 if ('upgrade' == $update_array[0]->response) {
                     return true;
                 }
             }
         } else {
             wp_version_check();
             $cur = get_option('update_core');
             if (isset($cur->response) || 'upgrade' == $cur->response) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:julianbonilla,项目名称:three20.info,代码行数:28,代码来源:wpau_prelimcheck.class.php


示例3: test_tested_up_to

 /**
  * @slowThreshold 1000
  */
 public function test_tested_up_to()
 {
     if (!($readme_data = $this->get_readme())) {
         $this->markTestSkipped('There is no readme file');
         return;
     }
     wp_version_check();
     $cur = get_preferred_from_update_core();
     if (false === $cur) {
         $this->markTestSkipped('There is no internet connection');
         return;
     }
     if (isset($cur->current)) {
         list($display_version) = explode('-', $cur->current);
         $this->assertTrue(version_compare($readme_data['tested_up_to'], $display_version, '>='), sprintf('%s >= %s', $readme_data['tested_up_to'], $display_version));
     }
 }
开发者ID:robwilde,项目名称:query-monitor,代码行数:20,代码来源:test-plugin.php


示例4: checkCoreUpdates

 /**
  * Check if there is an update to the WordPress core.
  *
  * @return $this
  */
 public function checkCoreUpdates()
 {
     $this->needs_core_update = false;
     if (!function_exists('wp_version_check')) {
         require_once ABSPATH . WPINC . '/update.php';
     }
     if (!function_exists('get_preferred_from_update_core')) {
         require_once ABSPATH . 'wp-admin/includes/update.php';
     }
     wp_version_check();
     // Check for Core updates
     $update = get_preferred_from_update_core();
     if (isset($update->response) && $update->response == 'upgrade') {
         $this->needs_core_update = true;
         $this->core_update_version = $update->current;
     }
     return $this;
 }
开发者ID:adamplabarge,项目名称:bermstyle,代码行数:23,代码来源:wfUpdateCheck.php


示例5: 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


示例6: update

 /**
  * Update the WordPress core
  *
  * @param array $args
  */
 function update($args)
 {
     wp_version_check();
     $from_api = get_site_transient('update_core');
     if (empty($from_api->updates)) {
         $update = false;
     } else {
         list($update) = $from_api->updates;
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $upgrader = WP_CLI::get_upgrader('Core_Upgrader');
     $result = $upgrader->upgrade($update);
     if (is_wp_error($result)) {
         $msg = WP_CLI::errorToString($result);
         if ('up_to_date' != $result->get_error_code()) {
             WP_CLI::error($msg);
         } else {
             WP_CLI::success($msg);
         }
     } else {
         WP_CLI::success('WordPress updated successfully.');
     }
 }
开发者ID:noahmuller,项目名称:wp-cli,代码行数:28,代码来源:core.php


示例7: refresh_updates

 function refresh_updates()
 {
     if (rand(1, 3) == '2') {
         require_once ABSPATH . WPINC . '/update.php';
         wp_update_plugins();
         wp_update_themes();
         wp_version_check();
     }
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:9,代码来源:helper.class.php


示例8: update

 /**
  * Update WordPress.
  *
  * ## OPTIONS
  *
  * [<zip>]
  * : Path to zip file to use, instead of downloading from wordpress.org.
  *
  * [--version=<version>]
  * : Update to this version, instead of to the latest version.
  *
  * [--force]
  * : Update even when installed WP version is greater than the requested version.
  *
  * [--locale=<locale>]
  * : Select which language you want to download.
  *
  * ## EXAMPLES
  *
  *     wp core update
  *
  *     wp core update --version=3.8 ../latest.zip
  *
  *     wp core update --version=3.1 --force
  *
  * @alias upgrade
  */
 function update($args, $assoc_args)
 {
     global $wp_version;
     $update = $from_api = null;
     $upgrader = 'WP_CLI\\CoreUpgrader';
     if (!empty($args[0])) {
         $upgrader = 'WP_CLI\\NonDestructiveCoreUpgrader';
         $version = !empty($assoc_args['version']) ? $assoc_args['version'] : null;
         $update = (object) array('response' => 'upgrade', 'current' => $version, 'download' => $args[0], 'packages' => (object) array('partial' => null, 'new_bundled' => null, 'no_content' => null, 'full' => $args[0]), 'version' => $version, 'locale' => null);
     } else {
         if (empty($assoc_args['version'])) {
             wp_version_check();
             $from_api = get_site_transient('update_core');
             if (empty($from_api->updates)) {
                 $update = false;
             } else {
                 list($update) = $from_api->updates;
             }
         } else {
             if (version_compare($wp_version, $assoc_args['version'], '<') || isset($assoc_args['force'])) {
                 $version = $assoc_args['version'];
                 $locale = isset($assoc_args['locale']) ? $assoc_args['locale'] : get_locale();
                 $new_package = $this->get_download_url($version, $locale);
                 $update = (object) array('response' => 'upgrade', 'current' => $assoc_args['version'], 'download' => $new_package, 'packages' => (object) array('partial' => null, 'new_bundled' => null, 'no_content' => null, 'full' => $new_package), 'version' => $version, 'locale' => $locale);
             } else {
                 WP_CLI::success('WordPress is up to date.');
                 return;
             }
         }
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     if ($update->version) {
         WP_CLI::log("Updating to version {$update->version} ({$update->locale})...");
     } else {
         WP_CLI::log("Starting update...");
     }
     $GLOBALS['wp_cli_update_obj'] = $update;
     $result = Utils\get_upgrader($upgrader)->upgrade($update);
     unset($GLOBALS['wp_cli_update_obj']);
     if (is_wp_error($result)) {
         $msg = WP_CLI::error_to_string($result);
         if ('up_to_date' != $result->get_error_code()) {
             WP_CLI::error($msg);
         } else {
             WP_CLI::success($msg);
         }
     } else {
         WP_CLI::success('WordPress updated successfully.');
     }
 }
开发者ID:wturrell,项目名称:wp-cli,代码行数:77,代码来源:core.php


示例9: run

 /**
  * Kicks off the background update process, looping through all pending updates.
  *
  * @since 3.7.0
  */
 public function run()
 {
     global $wpdb, $wp_version;
     if ($this->is_disabled()) {
         return;
     }
     if (!is_main_network() || !is_main_site()) {
         return;
     }
     $lock_name = 'auto_updater.lock';
     // Try to lock
     $lock_result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `{$wpdb->options}` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time()));
     if (!$lock_result) {
         $lock_result = get_option($lock_name);
         // If we couldn't create a lock, and there isn't a lock, bail
         if (!$lock_result) {
             return;
         }
         // Check to see if the lock is still valid
         if ($lock_result > time() - HOUR_IN_SECONDS) {
             return;
         }
     }
     // Update the lock, as by this point we've definitely got a lock, just need to fire the actions
     update_option($lock_name, time());
     // Don't automatically run these thins, as we'll handle it ourselves
     remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
     remove_action('upgrader_process_complete', 'wp_version_check');
     remove_action('upgrader_process_complete', 'wp_update_plugins');
     remove_action('upgrader_process_complete', 'wp_update_themes');
     // Next, Plugins
     wp_update_plugins();
     // Check for Plugin updates
     $plugin_updates = get_site_transient('update_plugins');
     if ($plugin_updates && !empty($plugin_updates->response)) {
         foreach ($plugin_updates->response as $plugin) {
             $this->update('plugin', $plugin);
         }
         // Force refresh of plugin update information
         wp_clean_plugins_cache();
     }
     // Next, those themes we all love
     wp_update_themes();
     // Check for Theme updates
     $theme_updates = get_site_transient('update_themes');
     if ($theme_updates && !empty($theme_updates->response)) {
         foreach ($theme_updates->response as $theme) {
             $this->update('theme', (object) $theme);
         }
         // Force refresh of theme update information
         wp_clean_themes_cache();
     }
     // Next, Process any core update
     wp_version_check();
     // Check for Core updates
     $core_update = find_core_auto_update();
     if ($core_update) {
         $this->update('core', $core_update);
     }
     // Clean up, and check for any pending translations
     // (Core_Upgrader checks for core updates)
     $theme_stats = array();
     if (isset($this->update_results['theme'])) {
         foreach ($this->update_results['theme'] as $upgrade) {
             $theme_stats[$upgrade->item->theme] = true === $upgrade->result;
         }
     }
     wp_update_themes($theme_stats);
     // Check for Theme updates
     $plugin_stats = array();
     if (isset($this->update_results['plugin'])) {
         foreach ($this->update_results['plugin'] as $upgrade) {
             $plugin_stats[$upgrade->item->plugin] = true === $upgrade->result;
         }
     }
     wp_update_plugins($plugin_stats);
     // Check for Plugin updates
     // Finally, Process any new translations
     $language_updates = wp_get_translation_updates();
     if ($language_updates) {
         foreach ($language_updates as $update) {
             $this->update('translation', $update);
         }
         // Clear existing caches
         wp_clean_update_cache();
         wp_version_check();
         // check for Core updates
         wp_update_themes();
         // Check for Theme updates
         wp_update_plugins();
         // Check for Plugin updates
     }
     // Send debugging email to all development installs.
     if (!empty($this->update_results)) {
         $development_version = false !== strpos($wp_version, '-');
//.........这里部分代码省略.........
开发者ID:sunyang3721,项目名称:wp-for-sae,代码行数:101,代码来源:class-wp-upgrader.php


示例10: _get_preferred_from_update_core

 function _get_preferred_from_update_core()
 {
     if (!function_exists('get_preferred_from_update_core')) {
         require_once ABSPATH . 'wp-admin/includes/update.php';
     }
     //Validate that we have api data and if not get the normal data so we always have it.
     $preferred = get_preferred_from_update_core();
     if (false === $preferred) {
         wp_version_check();
         $preferred = get_preferred_from_update_core();
     }
     return $preferred;
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:13,代码来源:wp-beta-tester.php


示例11: _maybe_update_core

function _maybe_update_core()
{
    global $wp_version;
    $current = get_transient('update_core');
    if (isset($current->last_checked) && 43200 > time() - $current->last_checked && isset($current->version_checked) && $current->version_checked == $wp_version) {
        return;
    }
    wp_version_check();
}
开发者ID:bluedanbob,项目名称:wordpress,代码行数:9,代码来源:update.php


示例12: doCoreUpdateCheck

 public function doCoreUpdateCheck()
 {
     global $wp_current_filter;
     $wp_current_filter[] = 'load-update-core.php';
     if (function_exists('wp_clean_update_cache')) {
         wp_clean_update_cache();
     }
     wp_version_check();
     array_pop($wp_current_filter);
     do_action('load-plugins.php');
 }
开发者ID:tconte252,项目名称:haute-inhabit,代码行数:11,代码来源:Helper.php


示例13: update

 /**
  * Update WordPress.
  *
  * ## OPTIONS
  *
  * [<zip>]
  * : Path to zip file to use, instead of downloading from wordpress.org.
  *
  * [--minor]
  * : Only perform updates for minor releases (e.g. update from WP 4.3 to 4.3.3 instead of 4.4.2).
  *
  * [--version=<version>]
  * : Update to a specific version, instead of to the latest version.
  *
  * [--force]
  * : Update even when installed WP version is greater than the requested version.
  *
  * [--locale=<locale>]
  * : Select which language you want to download.
  *
  * ## EXAMPLES
  *
  *     wp core update
  *
  *     wp core update --version=3.8 ../latest.zip
  *
  *     wp core update --version=3.1 --force
  *
  * @alias upgrade
  */
 function update($args, $assoc_args)
 {
     global $wp_version;
     $update = $from_api = null;
     $upgrader = 'WP_CLI\\CoreUpgrader';
     if (empty($args[0]) && empty($assoc_args['version']) && \WP_CLI\Utils\get_flag_value($assoc_args, 'minor')) {
         $updates = $this->get_updates(array('minor' => true));
         if (!empty($updates)) {
             $assoc_args['version'] = $updates[0]['version'];
         } else {
             WP_CLI::success('WordPress is at the latest minor release.');
             return;
         }
     }
     if (!empty($args[0])) {
         $upgrader = 'WP_CLI\\NonDestructiveCoreUpgrader';
         $version = \WP_CLI\Utils\get_flag_value($assoc_args, 'version');
         $update = (object) array('response' => 'upgrade', 'current' => $version, 'download' => $args[0], 'packages' => (object) array('partial' => null, 'new_bundled' => null, 'no_content' => null, 'full' => $args[0]), 'version' => $version, 'locale' => null);
     } else {
         if (empty($assoc_args['version'])) {
             wp_version_check();
             $from_api = get_site_transient('update_core');
             if (!empty($from_api->updates)) {
                 list($update) = $from_api->updates;
             }
         } else {
             if (\WP_CLI\Utils\wp_version_compare($assoc_args['version'], '<') || \WP_CLI\Utils\get_flag_value($assoc_args, 'force')) {
                 $version = $assoc_args['version'];
                 $locale = \WP_CLI\Utils\get_flag_value($assoc_args, 'locale', get_locale());
                 $new_package = $this->get_download_url($version, $locale);
                 $update = (object) array('response' => 'upgrade', 'current' => $assoc_args['version'], 'download' => $new_package, 'packages' => (object) array('partial' => null, 'new_bundled' => null, 'no_content' => null, 'full' => $new_package), 'version' => $version, 'locale' => $locale);
             }
         }
     }
     if (!empty($update) && ($update->version != $wp_version || \WP_CLI\Utils\get_flag_value($assoc_args, 'force'))) {
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         if ($update->version) {
             WP_CLI::log("Updating to version {$update->version} ({$update->locale})...");
         } else {
             WP_CLI::log("Starting update...");
         }
         $from_version = $wp_version;
         $GLOBALS['wp_cli_update_obj'] = $update;
         $result = Utils\get_upgrader($upgrader)->upgrade($update);
         unset($GLOBALS['wp_cli_update_obj']);
         if (is_wp_error($result)) {
             $msg = WP_CLI::error_to_string($result);
             if ('up_to_date' != $result->get_error_code()) {
                 WP_CLI::error($msg);
             } else {
                 WP_CLI::success($msg);
             }
         } else {
             if (file_exists(ABSPATH . 'wp-includes/version.php')) {
                 include ABSPATH . 'wp-includes/version.php';
                 $to_version = $wp_version;
             }
             $locale = \WP_CLI\Utils\get_flag_value($assoc_args, 'locale', get_locale());
             $this->cleanup_extra_files($from_version, $to_version, $locale);
             WP_CLI::success('WordPress updated successfully.');
         }
     } else {
         WP_CLI::success('WordPress is up to date.');
     }
 }
开发者ID:anver,项目名称:wp-cli,代码行数:95,代码来源:core.php


示例14: get_updates

 /**
  * Returns update information
  */
 private function get_updates($assoc_args)
 {
     wp_version_check();
     $from_api = get_site_transient('update_core');
     if (!$from_api) {
         return array();
     }
     $compare_version = str_replace('-src', '', $GLOBALS['wp_version']);
     $updates = array('major' => false, 'minor' => false);
     foreach ($from_api->updates as $offer) {
         $update_type = Utils\get_named_sem_ver($offer->version, $compare_version);
         if (!$update_type) {
             continue;
         }
         // WordPress follow its own versioning which is roughly equivalent to semver
         if ('minor' === $update_type) {
             $update_type = 'major';
         } else {
             if ('patch' === $update_type) {
                 $update_type = 'minor';
             }
         }
         if (!empty($updates[$update_type]) && !Comparator::greaterThan($offer->version, $updates[$update_type]['version'])) {
             continue;
         }
         $updates[$update_type] = array('version' => $offer->version, 'update_type' => $update_type, 'package_url' => !empty($offer->packages->partial) ? $offer->packages->partial : $offer->packages->full);
     }
     foreach ($updates as $type => $value) {
         if (empty($value)) {
             unset($updates[$type]);
         }
     }
     foreach (array('major', 'minor') as $type) {
         if (true === \WP_CLI\Utils\get_flag_value($assoc_args, $type)) {
             return !empty($updates[$type]) ? array($updates[$type]) : false;
         }
     }
     return array_values($updates);
 }
开发者ID:wp-cli,项目名称:wp-cli,代码行数:42,代码来源:core.php


示例15: update

 /**
  * Update WordPress.
  *
  * ## OPTIONS
  *
  * [<zip>]
  * : Path to zip file to use, instead of downloading from wordpress.org.
  *
  * [--version=<version>]
  * : Update to this version, instead of to the latest version.
  *
  * [--force]
  * : Will update even when current WP version < passed version. Use with
  * caution.
  *
  * ## EXAMPLES
  *
  *     wp core update
  *
  *     wp core update --version=3.4 ../latest.zip
  *
  *     wp core update --version=3.1 --force
  *
  * @alias upgrade
  */
 function update($args, $assoc_args)
 {
     global $wp_version;
     $update = $from_api = null;
     $upgrader = 'Core_Upgrader';
     if (empty($assoc_args['version'])) {
         wp_version_check();
         $from_api = get_site_transient('update_core');
         if (empty($from_api->updates)) {
             $update = false;
         } else {
             list($update) = $from_api->updates;
         }
     } else {
         if (version_compare($wp_version, $assoc_args['version'], '<') || isset($assoc_args['force'])) {
             $new_package = null;
             if (empty($args[0])) {
                 $new_package = 'https://wordpress.org/wordpress-' . $assoc_args['version'] . '.zip';
                 WP_CLI::log(sprintf('Downloading WordPress %s (%s)...', $assoc_args['version'], 'en_US'));
             } else {
                 $new_package = $args[0];
                 $upgrader = 'WP_CLI\\NonDestructiveCoreUpgrader';
             }
             $update = (object) array('response' => 'upgrade', 'current' => $assoc_args['version'], 'download' => $new_package, 'packages' => (object) array('partial' => null, 'new_bundled' => null, 'no_content' => null, 'full' => $new_package));
         } else {
             WP_CLI::success('WordPress is up to date.');
             return;
         }
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $result = Utils\get_upgrader($upgrader)->upgrade($update);
     if (is_wp_error($result)) {
         $msg = WP_CLI::error_to_string($result);
         if ('up_to_date' != $result->get_error_code()) {
             WP_CLI::error($msg);
         } else {
             WP_CLI::success($msg);
         }
     } else {
         WP_CLI::success('WordPress updated successfully.');
     }
 }
开发者ID:nb,项目名称:wp-cli,代码行数:67,代码来源:core.php


示例16: refresh_core_updates

 public static function refresh_core_updates()
 {
     require_once ABSPATH . 'wp-includes/update.php';
     if (is_callable('wp_version_check')) {
         return wp_version_check(array(), true);
     }
     return false;
 }
开发者ID:AndyA,项目名称:River,代码行数:8,代码来源:functions.php


示例17: upgrade


//.........这里部分代码省略.........
      * If partial update is returned from the API, use that, unless we're doing
      * a reinstall. If we cross the new_bundled version number, then use
      * the new_bundled zip. Don't though if the constant is set to skip bundled items.
      * If the API returns a no_content zip, go with it. Finally, default to the full zip.
      */
     if ($parsed_args['do_rollback'] && $current->packages->rollback) {
         $to_download = 'rollback';
     } elseif ($current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && $partial) {
         $to_download = 'partial';
     } elseif ($current->packages->new_bundled && version_compare($wp_version, $current->new_bundled, '<') && (!defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || !CORE_UPGRADE_SKIP_NEW_BUNDLED)) {
         $to_download = 'new_bundled';
     } elseif ($current->packages->no_content) {
         $to_download = 'no_content';
     } else {
         $to_download = 'full';
     }
     // Lock to prevent multiple Core Updates occuring
     $lock = WP_Upgrader::create_lock('core_updater', 15 * MINUTE_IN_SECONDS);
     if (!$lock) {
         return new WP_Error('locked', $this->strings['locked']);
     }
     $download = $this->download_package($current->packages->{$to_download});
     if (is_wp_error($download)) {
         WP_Upgrader::release_lock('core_updater');
         return $download;
     }
     $working_dir = $this->unpack_package($download);
     if (is_wp_error($working_dir)) {
         WP_Upgrader::release_lock('core_updater');
         return $working_dir;
     }
     // Copy update-core.php from the new version into place.
     if (!$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true)) {
         $wp_filesystem->delete($working_dir, true);
         WP_Upgrader::release_lock('core_updater');
         return new WP_Error('copy_failed_for_update_core_file', __('The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.'), 'wp-admin/includes/update-core.php');
     }
     $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
     require_once ABSPATH . 'wp-admin/includes/update-core.php';
     if (!function_exists('update_core')) {
         WP_Upgrader::release_lock('core_updater');
         return new WP_Error('copy_failed_space', $this->strings['copy_failed_space']);
     }
     $result = update_core($working_dir, $wp_dir);
     // In the event of an issue, we may be able to roll back.
     if ($parsed_args['attempt_rollback'] && $current->packages->rollback && !$parsed_args['do_rollback']) {
         $try_rollback = false;
         if (is_wp_error($result)) {
             $error_code = $result->get_error_code();
             /*
              * Not all errors are equal. These codes are critical: copy_failed__copy_dir,
              * mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
              * do_rollback allows for update_core() to trigger a rollback if needed.
              */
             if (false !== strpos($error_code, 'do_rollback')) {
                 $try_rollback = true;
             } elseif (false !== strpos($error_code, '__copy_dir')) {
                 $try_rollback = true;
             } elseif ('disk_full' === $error_code) {
                 $try_rollback = true;
             }
         }
         if ($try_rollback) {
             /** This filter is documented in wp-admin/includes/update-core.php */
             apply_filters('update_feedback', $result);
             /** This filter is documented in wp-admin/includes/update-core.php */
             apply_filters('update_feedback', $this->strings['start_rollback']);
             $rollback_result = $this->upgrade($current, array_merge($parsed_args, array('do_rollback' => true)));
             $original_result = $result;
             $result = new WP_Error('rollback_was_required', $this->strings['rollback_was_required'], (object) array('update' => $original_result, 'rollback' => $rollback_result));
         }
     }
     /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
     do_action('upgrader_process_complete', $this, array('action' => 'update', 'type' => 'core'));
     // Clear the current updates
     delete_site_transient('update_core');
     if (!$parsed_args['do_rollback']) {
         $stats = array('update_type' => $current->response, 'success' => true, 'fs_method' => $wp_filesystem->method, 'fs_method_forced' => defined('FS_METHOD') || has_filter('filesystem_method'), 'fs_method_direct' => !empty($GLOBALS['_wp_filesystem_direct_method']) ? $GLOBALS['_wp_filesystem_direct_method'] : '', 'time_taken' => time() - $start_time, 'reported' => $wp_version, 'attempted' => $current->version);
         if (is_wp_error($result)) {
             $stats['success'] = false;
             // Did a rollback occur?
             if (!empty($try_rollback)) {
                 $stats['error_code'] = $original_result->get_error_code();
                 $stats['error_data'] = $original_result->get_error_data();
                 // Was the rollback successful? If not, collect its error too.
                 $stats['rollback'] = !is_wp_error($rollback_result);
                 if (is_wp_error($rollback_result)) {
                     $stats['rollback_code'] = $rollback_result->get_error_code();
                     $stats['rollback_data'] = $rollback_result->get_error_data();
                 }
             } else {
                 $stats['error_code'] = $result->get_error_code();
                 $stats['error_data'] = $result->get_error_data();
             }
         }
         wp_version_check($stats);
     }
     WP_Upgrader::release_lock('core_updater');
     return $result;
 }
开发者ID:qaryas,项目名称:qaryas_site,代码行数:101,代码来源:class-core-upgrader.php


示例18: upgrade_core

 function upgrade_core($current, $userid)
 {
     global $iwp_activities_log_post_type, $iwp_mmb_activities_log;
     ob_start();
     if (!function_exists('wp_version_check') || !function_exists('get_core_checksums')) {
         include_once ABSPATH . '/wp-admin/includes/update.php';
     }
     @wp_version_check();
     $current_update = false;
     ob_end_flush();
     ob_end_clean();
     $core = $this->iwp_mmb_get_transient('update_core');
     if (isset($core->updates) && !empty($core->updates)) {
         $updates = $core->updates[0];
         $updated = $core->updates[0];
         if (!isset($updated->response) || $updated->response == 'latest') {
             return array('upgraded' => 'updated');
         }
         if ($updated->response == "development" && $current->response == "upgrade") {
             return array('error' => '<font color="#900">Unexpected error. Please upgrade manually.</font>', 'error_code' => 'unexpected_error_please_upgrade_manually');
         } else {
             if ($updated->response == $current->response || $updated->response == "upgrade" && $current->response == "development") {
                 if ($updated->locale != $current->locale) {
                     foreach ($updates as $update) {
                         if ($update->locale == $current->locale) {
                             $current_update = $update;
                             break;
                         }
                     }
                     if ($current_update == false) {
                         return array('error' => ' Localization mismatch. Try again.', 'error_code' => 'localization_mismatch');
                     }
                 } else {
                     $current_update = $updated;
                 }
             } else {
                 return array('error' => ' Transient mismatch. Try again.', 'error_code' => 'transient_mismatch');
             }
         }
     } else {
         return array('error' => ' Refresh transient failed. Try again.', 'error_code' => 'refresh_transient_failed');
     }
     if ($current_update != false) {
         global $iwp_mmb_wp_version, $wp_filesystem, $wp_version;
         if (version_compare($wp_version, '3.1.9', '>')) {
             if (!class_exists('Core_Upgrader')) {
                 include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
             }
             $core = new Core_Upgrader();
             $result = $core->upgrade($current_update);
             $this->iwp_mmb_maintenance_mode(false);
             if (is_wp_error($result)) {
                 return array('error' => $this->iwp_mmb_get_error($result), 'error_code' => 'maintenance_mode_upgrade_core');
             } else {
                 $iwp_mmb_activities_log->iwp_mmb_save_iwp_activities('core', 'update', $iwp_activities_log_post_type, $current, $userid);
                 return array('upgraded' => 'updated');
             }
         } else {
             if (!class_exists('WP_Upgrader')) {
                 include_once ABSPATH . 'wp-admin/includes/update.php';
                 if (function_exists('wp_update_core')) {
                     $result = wp_update_core($current_update);
                     if (is_wp_error($result)) {
                         return array('error' => $this->iwp_mmb_get_error($result), 'error_code' => 'wp_update_core_upgrade_core');
                     } else {
                         $iwp_mmb_activities_log->iwp_mmb_save_iwp_activities('core', 'update', $iwp_activities_log_post_type, $current, $userid);
                         return array('upgraded' => 'updated');
                     }
                 }
             }
             if (class_exists('WP_Upgrader')) {
                 $upgrader_skin = new WP_Upgrader_Skin();
                 $upgrader_skin->done_header = true;
                 $upgrader = new WP_Upgrader($upgrader_skin);
                 // Is an update available?
                 if (!isset($current_update->response) || $current_update->response == 'latest') {
                     return array('upgraded' => 'updated');
                 }
                 $res = $upgrader->fs_connect(array(ABSPATH, WP_CONTENT_DIR));
                 if (is_wp_error($res)) {
                     return array('error' => $this->iwp_mmb_get_error($res), 'error_code' => 'upgrade_core_wp_error_res');
                 }
                 $wp_dir = trailingslashit($wp_filesystem->abspath());
                 $core_package = false;
                 if (isset($current_update->package) && !empty($current_update->package)) {
                     $core_package = $current_update->package;
                 } elseif (isset($current_update->packages->full) && !empty($current_update->packages->full)) {
                     $core_package = $current_update->packages->full;
                 }
                 $download = $upgrader->download_package($core_package);
                 if (is_wp_error($download)) {
                     return array('error' => $this->iwp_mmb_get_error($download), 'error_code' => 'download_upgrade_core');
                 }
                 $working_dir = $upgrader->unpack_package($download);
                 if (is_wp_error($working_dir)) {
                     return array('error' => $this->iwp_mmb_get_error($working_dir), 'error_code' => 'working_dir_upgrade_core');
                 }
                 if (!$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true)) {
                     $wp_filesystem->delete($working_dir, true);
                     return array('error' => 'Unable to move update files.', 'error_code' => 'unable_to_move_update_files');
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:installer.class.php


示例19: getSiteStats

 function getSiteStats($information = array(), $exit = true)
 {
     global $wp_version;
     if ($exit) {
         $this->updateExternalSettings();
     }
     MainWP_Helper::update_option('mainwp_child_branding_disconnected', '', 'yes');
     if (isset($_POST['server'])) {
         MainWP_Helper::update_option('mainwp_child_server', $_POST['server']);
     }
     if (isset($_POST['numberdaysOutdatePluginTheme']) && !empty($_POST['numberdaysOutdatePluginTheme'])) {
         $days_outdate = get_option('mainwp_child_plugintheme_days_outdate', 365);
         if ($days_outdate !== $_POST['numberdaysOutdatePluginTheme']) {
             $days_outdate = $_POST['numberdaysOutdatePluginTheme'];
             MainWP_Helper::update_option('mainwp_child_plugintheme_days_outdate', $days_outdate);
             MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation(false);
             MainWP_Child_Themes_Check::Instance()->cleanup_deactivation(false);
         }
     }
     $information['version'] = self::$version;
     $information['wpversion'] = $wp_version;
     $information['siteurl'] = get_option('siteurl');
     $information['nossl'] = '1' === get_option('mainwp_child_nossl') ? 1 : 0;
     include_once ABSPATH . '/wp-admin/includes/update.php';
     $timeout = 3 * 60 * 60;
     // 3minutes
     @set_time_limit($timeout);
     @ini_set('max_execution_time', $timeout);
     //Check for new versions
     if (null !== $this->filterFunction) {
         add_filter('pre_site_transient_update_core', $this->filterFunction, 99);
     }
     if (null !== $this->filterFunction) {
         add_filter('pre_transient_update_core', $this->filterFunction, 99);
     }
     @wp_version_check();
     $core_updates = get_core_updates();
     if (count($core_updates) > 0) {
         foreach ($core_updates as $core_update) {
             if ('latest' === $core_update->response) {
                 break;
             }
             if ('upgrade' === $core_update->response && version_compare($wp_version, $core_update->current, '<=')) {
                 $information['wp_updates'] = $core_update->current;
             }
         }
     }
     if (!isset($information['wp_updates'])) {
         $information['wp_updates'] = null;
     }
     if (null !== $this->filterFunction) {
         remove_filter('pre_site_transient_update_core', $this->filterFunction, 99);
     }
     if (null !== $this->filterFunction) {
         remove_filter('pre_transient_update_core', $this->filterFunction, 99);
     }
     add_filter('default_option_active_plugins', array(&$this, 'default_option_active_plugins'));
     add_filter('option_active_plugins', array(&$this, 'default_option_active_plugins'));
     //First check for new premium updates
     $update_check = apply_filters('mwp_premium_update_check', array());
     if (!empty($update_check)) {
         foreach ($update_check as $updateFeedback) {
             if (is_array($updateFeedback['callback']) && isset($updateFeedback['callback'][0]) && isset($updateFeedback['callback'][1])) {
                 @call_user_func(array($updateFeedback['callback'][0], $updateFeedback['callback'][1]));
             } else {
                 if (is_string($updateFeedback['callback'])) {
                     @call_user_func($updateFeedback['callback']);
                 }
             }
         }
     }
     $informationPremiumUpdates = apply_filters('mwp_premium_update_notification', array());
     $premiumPlugins = array();
     $premiumThemes = array();
     if (is_array($informationPremiumUpdates)) {
         $premiumUpdates = array();
         $information['premium_updates'] = array();
         $informationPremiumUpdatesLength = count($informationPremiumUpdates);
         for ($i = 0; $i < $informationPremiumUpdatesLength; $i++) {
             if (!isset($informationPremiumUpdates[$ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_video_shortcode函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_verify_nonce函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap