WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/16/2011 01:58:13 AM (9 years ago)
Author:
nacin
Message:

Fix typo in filler text cause we all know it'll slip through accidentally. props paulhastings0, fixes #19255.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/update.php

    r19054 r19311  
    144144    $new_option = new stdClass;
    145145    $new_option->last_checked = time();
    146     // Check for updated every 60 minutes if hitting update pages; else, check every 12 hours.
    147     $timeout = in_array( current_filter(), array( 'load-plugins.php', 'load-update.php', 'load-update-core.php' ) ) ? 3600 : 43200;
    148     $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
    149 
    150     $plugin_changed = false;
    151     foreach ( $plugins as $file => $p ) {
    152         $new_option->checked[ $file ] = $p['Version'];
    153 
    154         if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
    155             $plugin_changed = true;
    156     }
    157 
    158     if ( isset ( $current->response ) && is_array( $current->response ) ) {
    159         foreach ( $current->response as $plugin_file => $update_details ) {
    160             if ( ! isset($plugins[ $plugin_file ]) ) {
    161                 $plugin_changed = true;
    162                 break;
     146
     147    // Check for updated every 12 hours, 60 minutes, or immediately, depending on the page.
     148    $filter = current_filter();
     149    if ( 'load-update-core.php' != $filter ) {
     150        $timeout = 'load-plugins.php' == $filter || 'load-update.php' == $filter ? 3600 : 43200;
     151        $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
     152
     153        if ( $time_not_changed ) {
     154            $plugin_changed = false;
     155            foreach ( $plugins as $file => $p ) {
     156                $new_option->checked[ $file ] = $p['Version'];
     157       
     158                if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
     159                    $plugin_changed = true;
    163160            }
     161
     162            if ( isset ( $current->response ) && is_array( $current->response ) ) {
     163                foreach ( $current->response as $plugin_file => $update_details ) {
     164                    if ( ! isset($plugins[ $plugin_file ]) ) {
     165                        $plugin_changed = true;
     166                        break;
     167                    }
     168                }
     169            }
     170
     171            // Bail if we've checked recently and if nothing has changed
     172            if ( ! $plugin_changed )
     173                return false;
    164174        }
    165175    }
    166 
    167     // Bail if we've checked in the last 12 hours and if nothing has changed
    168     if ( $time_not_changed && !$plugin_changed )
    169         return false;
    170176
    171177    // Update last_checked for current to prevent multiple blocking requests if request hangs
     
    223229        $last_update = new stdClass;
    224230
    225     // Check for updated every 60 minutes if hitting update pages; else, check every 12 hours.
    226     $timeout = in_array( current_filter(), array( 'load-themes.php', 'load-update.php', 'load-update-core.php' ) ) ? 3600 : 43200;
    227     $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time( ) - $last_update->last_checked );
    228 
    229231    $themes = array();
    230232    $checked = array();
     
    247249    }
    248250
    249     $theme_changed = false;
    250     foreach ( $checked as $slug => $v ) {
    251         $update_request->checked[ $slug ] = $v;
    252 
    253         if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) )
    254             $theme_changed = true;
    255     }
    256 
    257     if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) {
    258         foreach ( $last_update->response as $slug => $update_details ) {
    259             if ( ! isset($checked[ $slug ]) ) {
    260                 $theme_changed = true;
    261                 break;
     251    // Check for updated every 12 hours, 60 minutes, or immediately, depending on the page.
     252    $filter = current_filter();
     253    if ( 'load-update-core.php' != $filter ) {
     254        $timeout = 'load-themes.php' == $filter || 'load-update.php' == $filter ? 3600 : 43200;
     255        $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time( ) - $last_update->last_checked );
     256
     257        if ( $time_not_changed ) {
     258            $theme_changed = false;
     259            foreach ( $checked as $slug => $v ) {
     260                $update_request->checked[ $slug ] = $v;
     261       
     262                if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) )
     263                    $theme_changed = true;
    262264            }
     265
     266            if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) {
     267                foreach ( $last_update->response as $slug => $update_details ) {
     268                    if ( ! isset($checked[ $slug ]) ) {
     269                        $theme_changed = true;
     270                        break;
     271                    }
     272                }
     273            }
     274
     275            // Bail if we've checked recently and if nothing has changed
     276            if ( ! $theme_changed )
     277                return false;
    263278        }
    264279    }
    265 
    266     if ( $time_not_changed && !$theme_changed )
    267         return false;
    268280
    269281    // Update last_checked for current to prevent multiple blocking requests if request hangs
Note: See TracChangeset for help on using the changeset viewer.