mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Use transient for update_core, update_plugins, update_themes. see #9048
git-svn-id: http://svn.automattic.com/wordpress/trunk@10515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0d258926e7
commit
7aec230e33
@ -254,7 +254,7 @@ function update_core($from, $to) {
|
||||
$wp_filesystem->delete($from, true);
|
||||
|
||||
// Force refresh of update information
|
||||
delete_option('update_core');
|
||||
delete_transient('update_core');
|
||||
|
||||
// Remove maintenance file, we're done.
|
||||
$wp_filesystem->delete($maintenance_file);
|
||||
|
@ -33,7 +33,7 @@ function get_core_updates( $options = array() ) {
|
||||
$options = array_merge( array('available' => true, 'dismissed' => false ), $options );
|
||||
$dismissed = get_option( 'dismissed_update_core' );
|
||||
if ( !is_array( $dismissed ) ) $dismissed = array();
|
||||
$from_api = get_option( 'update_core' );
|
||||
$from_api = get_transient( 'update_core' );
|
||||
if ( empty($from_api) )
|
||||
return false;
|
||||
if ( !is_array( $from_api->updates ) ) return false;
|
||||
@ -71,7 +71,7 @@ function undismiss_core_update( $version, $locale ) {
|
||||
}
|
||||
|
||||
function find_core_update( $version, $locale ) {
|
||||
$from_api = get_option( 'update_core' );
|
||||
$from_api = get_transient( 'update_core' );
|
||||
if ( !is_array( $from_api->updates ) ) return false;
|
||||
$updates = $from_api->updates;
|
||||
foreach($updates as $update) {
|
||||
@ -146,7 +146,7 @@ function update_right_now_message() {
|
||||
}
|
||||
|
||||
function wp_plugin_update_row( $file, $plugin_data ) {
|
||||
$current = get_option( 'update_plugins' );
|
||||
$current = get_transient( 'update_plugins' );
|
||||
if ( !isset( $current->response[ $file ] ) )
|
||||
return false;
|
||||
|
||||
@ -173,7 +173,7 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
add_filter('update_feedback', $feedback);
|
||||
|
||||
// Is an update available?
|
||||
$current = get_option( 'update_plugins' );
|
||||
$current = get_transient( 'update_plugins' );
|
||||
if ( !isset( $current->response[ $plugin ] ) )
|
||||
return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
|
||||
|
||||
@ -268,7 +268,7 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
$wp_filesystem->delete($working_dir, true);
|
||||
|
||||
// Force refresh of plugin update information
|
||||
delete_option('update_plugins');
|
||||
delete_transient('update_plugins');
|
||||
|
||||
if( empty($filelist) )
|
||||
return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
|
||||
|
@ -58,7 +58,7 @@ $menu[40] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-to
|
||||
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
|
||||
$submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
|
||||
|
||||
$update_plugins = get_option( 'update_plugins' );
|
||||
$update_plugins = get_transient( 'update_plugins' );
|
||||
$update_count = 0;
|
||||
if ( !empty($update_plugins->response) )
|
||||
$update_count = count( $update_plugins->response );
|
||||
|
@ -26,7 +26,7 @@ function wp_version_check() {
|
||||
global $wp_version, $wpdb, $wp_local_package;
|
||||
$php_version = phpversion();
|
||||
|
||||
$current = get_option( 'update_core' );
|
||||
$current = get_transient( 'update_core' );
|
||||
if ( ! is_object($current) )
|
||||
$current = new stdClass;
|
||||
|
||||
@ -40,7 +40,7 @@ function wp_version_check() {
|
||||
|
||||
// Update last_checked for current to prevent multiple blocking requests if request hangs
|
||||
$current->last_checked = time();
|
||||
update_option( 'update_core', $current );
|
||||
set_transient( 'update_core', $current );
|
||||
|
||||
if ( method_exists( $wpdb, 'db_version' ) )
|
||||
$mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users));
|
||||
@ -84,7 +84,7 @@ function wp_version_check() {
|
||||
$updates->updates = $new_options;
|
||||
$updates->last_checked = time();
|
||||
$updates->version_checked = $wp_version;
|
||||
update_option( 'update_core', $updates);
|
||||
set_transient( 'update_core', $updates);
|
||||
}
|
||||
add_action( 'init', 'wp_version_check' );
|
||||
|
||||
@ -113,7 +113,7 @@ function wp_update_plugins() {
|
||||
|
||||
$plugins = get_plugins();
|
||||
$active = get_option( 'active_plugins' );
|
||||
$current = get_option( 'update_plugins' );
|
||||
$current = get_transient( 'update_plugins' );
|
||||
if ( ! is_object($current) )
|
||||
$current = new stdClass;
|
||||
|
||||
@ -145,7 +145,7 @@ function wp_update_plugins() {
|
||||
|
||||
// Update last_checked for current to prevent multiple blocking requests if request hangs
|
||||
$current->last_checked = time();
|
||||
update_option( 'update_plugins', $current );
|
||||
set_transient( 'update_plugins', $current );
|
||||
|
||||
$to_send = (object)compact('plugins', 'active');
|
||||
|
||||
@ -170,7 +170,7 @@ function wp_update_plugins() {
|
||||
else
|
||||
$new_option->response = array();
|
||||
|
||||
update_option( 'update_plugins', $new_option );
|
||||
set_transient( 'update_plugins', $new_option );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,7 +196,7 @@ function wp_update_themes( ) {
|
||||
require_once( ABSPATH . 'wp-includes/theme.php' );
|
||||
|
||||
$installed_themes = get_themes( );
|
||||
$current_theme = get_option( 'update_themes' );
|
||||
$current_theme = get_transient( 'update_themes' );
|
||||
if ( ! is_object($current_theme) )
|
||||
$current_theme = new stdClass;
|
||||
|
||||
@ -210,7 +210,7 @@ function wp_update_themes( ) {
|
||||
|
||||
// Update last_checked for current to prevent multiple blocking requests if request hangs
|
||||
$current_theme->last_checked = time();
|
||||
update_option( 'update_themes', $current_theme );
|
||||
set_transient( 'update_themes', $current_theme );
|
||||
|
||||
$themes = array( );
|
||||
$themes['current_theme'] = $current_theme;
|
||||
@ -240,7 +240,7 @@ function wp_update_themes( ) {
|
||||
if( $response )
|
||||
$new_option->response = $response;
|
||||
|
||||
update_option( 'update_themes', $new_option );
|
||||
set_transient( 'update_themes', $new_option );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,7 +254,7 @@ function wp_update_themes( ) {
|
||||
* @access private
|
||||
*/
|
||||
function _maybe_update_plugins() {
|
||||
$current = get_option( 'update_plugins' );
|
||||
$current = get_transient( 'update_plugins' );
|
||||
if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
|
||||
return;
|
||||
wp_update_plugins();
|
||||
@ -270,7 +270,7 @@ function _maybe_update_plugins() {
|
||||
* @access private
|
||||
*/
|
||||
function _maybe_update_themes( ) {
|
||||
$current = get_option( 'update_themes' );
|
||||
$current = get_transient( 'update_themes' );
|
||||
if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user