本文整理汇总了PHP中find_core_auto_update函数的典型用法代码示例。如果您正苦于以下问题:PHP find_core_auto_update函数的具体用法?PHP find_core_auto_update怎么用?PHP find_core_auto_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_core_auto_update函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find_latest_update_offer
protected function find_latest_update_offer()
{
// Select the latest update.
// Remove filters to bypass automattic updates.
add_filter('request_filesystem_credentials', '__return_true');
add_filter('automatic_updates_is_vcs_checkout', '__return_false');
add_filter('allow_major_auto_core_updates', '__return_true');
add_filter('send_core_update_notification_email', '__return_false');
$update = find_core_auto_update();
remove_filter('request_filesystem_credentials', '__return_true');
remove_filter('automatic_updates_is_vcs_checkout', '__return_false');
remove_filter('allow_major_auto_core_updates', '__return_true');
remove_filter('send_core_update_notification_email', '__return_false');
return $update;
}
示例2: 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, '-');
//.........这里部分代码省略.........
示例3: perform_auto_updates
/**
* Kicks off a upgrade request for each item in the upgrade "queue"
*/
static function perform_auto_updates()
{
$lock_name = 'auto_upgrader.lock';
if (get_site_option($lock_name)) {
// Test to see if it was set more than an hour ago, if so, cleanup.
if (get_site_option($lock_name) < time() - HOUR_IN_SECONDS) {
delete_site_option($lock_name);
} else {
// The process is already locked
return;
}
}
// Lock upgrades for us for half an hour
if (!add_site_option($lock_name, microtime(true), HOUR_IN_SECONDS / 2)) {
return;
}
// Don't automatically run these thins, as we'll handle it ourselves
remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20, 3);
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 (array_keys($plugin_updates->response) as $plugin) {
self::upgrade('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 (array_keys($theme_updates->response) as $theme) {
self::upgrade('theme', $theme);
}
// Force refresh of theme update information
wp_clean_themes_cache();
}
// Next, Process any core upgrade
wp_version_check();
// Check for Core updates
$core_update = find_core_auto_update();
if ($core_update) {
self::upgrade('core', $core_update);
delete_site_transient('update_core');
}
// Cleanup, and check for any pending translations
wp_version_check();
// check for Core updates
wp_update_themes();
// Check for Theme updates
wp_update_plugins();
// Check for Plugin updates
// Finally, Process any new translations
$language_updates = wp_get_translation_updates();
if ($language_updates) {
foreach ($language_updates as $update) {
self::upgrade('language', $update);
}
// Clear existing caches
wp_clean_plugins_cache();
wp_clean_themes_cache();
delete_site_transient('update_core');
wp_version_check();
// check for Core updates
wp_update_themes();
// Check for Theme updates
wp_update_plugins();
// Check for Plugin updates
}
/**
* Filter whether to email an update summary to the site administrator.
*
* @since 3.7.0
*
* @param bool Whether or not email should be sent to administrator. Default true.
* @param bool|array $core_update An array of core update data, false otherwise.
* @param object $theme_updates Object containing theme update properties.
* @param object $plugin_updates Object containing plugin update properties.
* @param array $language_updates Array containing the Language updates available.
* @param array $upgrade_results Array of the upgrade results keyed by upgrade type, and plugin/theme slug.
*/
if (apply_filters('enable_auto_upgrade_email', true, $core_update, $theme_updates, $plugin_updates, $language_updates, self::$upgrade_results)) {
self::send_email();
}
// Clear the lock
delete_site_option($lock_name);
}
示例4: run
/**
* Kicks off the background update process, looping through all pending updates.
*
* @since 3.7.0
* @access public
*
* @global wpdb $wpdb
* @global string $wp_version
*/
public function run()
{
global $wpdb, $wp_version;
if ($this->is_disabled()) {
return;
}
if (!is_main_network() || !is_main_site()) {
return;
}
if (!$this->create_lock('auto_updater')) {
return;
}
// 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, '-');
/**
* Filter whether to send a debugging email for each automatic background update.
*
* @since 3.7.0
*
* @param bool $development_version By default, emails are sent if the
* install is a development version.
* Return false to avoid the email.
*/
//.........这里部分代码省略.........