当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_version_check函数代码示例

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


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


注:本文中的wp_version_check函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。