[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/ -> update.php (source)

   1  <?php
   2  /**
   3   * A simple set of functions to check our version 1.0 update service.
   4   *
   5   * @package WordPress
   6   * @since 2.3.0
   7   */
   8  
   9  /**
  10   * Check WordPress version against the newest version.
  11   *
  12   * The WordPress version, PHP version, and Locale is sent. Checks against the
  13   * WordPress server at api.wordpress.org server. Will only check if WordPress
  14   * isn't installing.
  15   *
  16   * @package WordPress
  17   * @since 2.3.0
  18   * @uses $wp_version Used to check against the newest WordPress version.
  19   *
  20   * @param array $extra_stats Extra statistics to report to the WordPress.org API.
  21   * @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
  22   * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
  23   */
  24  function wp_version_check( $extra_stats = array(), $force_check = false ) {
  25      if ( defined('WP_INSTALLING') )
  26          return;
  27  
  28      global $wpdb, $wp_local_package;
  29      include  ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
  30      $php_version = phpversion();
  31  
  32      $current = get_site_transient( 'update_core' );
  33      $translations = wp_get_installed_translations( 'core' );
  34  
  35      // Invalidate the transient when $wp_version changes
  36      if ( is_object( $current ) && $wp_version != $current->version_checked )
  37          $current = false;
  38  
  39      if ( ! is_object($current) ) {
  40          $current = new stdClass;
  41          $current->updates = array();
  42          $current->version_checked = $wp_version;
  43      }
  44  
  45      if ( ! empty( $extra_stats ) )
  46          $force_check = true;
  47  
  48      // Wait 60 seconds between multiple version check requests
  49      $timeout = 60;
  50      $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
  51      if ( ! $force_check && $time_not_changed )
  52          return false;
  53  
  54      $locale = get_locale();
  55      /**
  56       * Filter the locale requested for WordPress core translations.
  57       *
  58       * @since 2.8.0
  59       *
  60       * @param string $locale Current locale.
  61       */
  62      $locale = apply_filters( 'core_version_check_locale', $locale );
  63  
  64      // Update last_checked for current to prevent multiple blocking requests if request hangs
  65      $current->last_checked = time();
  66      set_site_transient( 'update_core', $current );
  67  
  68      if ( method_exists( $wpdb, 'db_version' ) )
  69          $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
  70      else
  71          $mysql_version = 'N/A';
  72  
  73      if ( is_multisite() ) {
  74          $user_count = get_user_count();
  75          $num_blogs = get_blog_count();
  76          $wp_install = network_site_url();
  77          $multisite_enabled = 1;
  78      } else {
  79          $user_count = count_users();
  80          $user_count = $user_count['total_users'];
  81          $multisite_enabled = 0;
  82          $num_blogs = 1;
  83          $wp_install = home_url( '/' );
  84      }
  85  
  86      $query = array(
  87          'version'           => $wp_version,
  88          'php'               => $php_version,
  89          'locale'            => $locale,
  90          'mysql'             => $mysql_version,
  91          'local_package'     => isset( $wp_local_package ) ? $wp_local_package : '',
  92          'blogs'             => $num_blogs,
  93          'users'             => $user_count,
  94          'multisite_enabled' => $multisite_enabled,
  95      );
  96  
  97      $post_body = array(
  98          'translations' => json_encode( $translations ),
  99      );
 100  
 101      if ( is_array( $extra_stats ) )
 102          $post_body = array_merge( $post_body, $extra_stats );
 103  
 104      $url = $http_url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' );
 105      if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
 106          $url = set_url_scheme( $url, 'https' );
 107  
 108      $options = array(
 109          'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
 110          'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
 111          'headers' => array(
 112              'wp_install' => $wp_install,
 113              'wp_blog' => home_url( '/' )
 114          ),
 115          'body' => $post_body,
 116      );
 117  
 118      $response = wp_remote_post( $url, $options );
 119      if ( $ssl && is_wp_error( $response ) ) {
 120          trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
 121          $response = wp_remote_post( $http_url, $options );
 122      }
 123  
 124      if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
 125          return false;
 126  
 127      $body = trim( wp_remote_retrieve_body( $response ) );
 128      $body = json_decode( $body, true );
 129  
 130      if ( ! is_array( $body ) || ! isset( $body['offers'] ) )
 131          return false;
 132  
 133      $offers = $body['offers'];
 134  
 135      foreach ( $offers as &$offer ) {
 136          foreach ( $offer as $offer_key => $value ) {
 137              if ( 'packages' == $offer_key )
 138                  $offer['packages'] = (object) array_intersect_key( array_map( 'esc_url', $offer['packages'] ),
 139                      array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' ) );
 140              elseif ( 'download' == $offer_key )
 141                  $offer['download'] = esc_url( $value );
 142              else
 143                  $offer[ $offer_key ] = esc_html( $value );
 144          }
 145          $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale',
 146              'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email' ), '' ) );
 147      }
 148  
 149      $updates = new stdClass();
 150      $updates->updates = $offers;
 151      $updates->last_checked = time();
 152      $updates->version_checked = $wp_version;
 153  
 154      if ( isset( $body['translations'] ) )
 155          $updates->translations = $body['translations'];
 156  
 157      set_site_transient( 'update_core',  $updates);
 158  }
 159  
 160  /**
 161   * Check plugin versions against the latest versions hosted on WordPress.org.
 162   *
 163   * The WordPress version, PHP version, and Locale is sent along with a list of
 164   * all plugins installed. Checks against the WordPress server at
 165   * api.wordpress.org. Will only check if WordPress isn't installing.
 166   *
 167   * @package WordPress
 168   * @since 2.3.0
 169   * @uses $wp_version Used to notify the WordPress version.
 170   *
 171   * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 172   */
 173  function wp_update_plugins() {
 174      include  ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
 175  
 176      if ( defined('WP_INSTALLING') )
 177          return false;
 178  
 179      // If running blog-side, bail unless we've not checked in the last 12 hours
 180      if ( !function_exists( 'get_plugins' ) )
 181          require_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
 182  
 183      $plugins = get_plugins();
 184      $translations = wp_get_installed_translations( 'plugins' );
 185  
 186      $active  = get_option( 'active_plugins', array() );
 187      $current = get_site_transient( 'update_plugins' );
 188      if ( ! is_object($current) )
 189          $current = new stdClass;
 190  
 191      $new_option = new stdClass;
 192      $new_option->last_checked = time();
 193  
 194      // Check for update on a different schedule, depending on the page.
 195      switch ( current_filter() ) {
 196          case 'upgrader_process_complete' :
 197              $timeout = 0;
 198              break;
 199          case 'load-update-core.php' :
 200              $timeout = MINUTE_IN_SECONDS;
 201              break;
 202          case 'load-plugins.php' :
 203          case 'load-update.php' :
 204              $timeout = HOUR_IN_SECONDS;
 205              break;
 206          default :
 207              $timeout = 12 * HOUR_IN_SECONDS;
 208      }
 209  
 210      $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
 211  
 212      if ( $time_not_changed ) {
 213          $plugin_changed = false;
 214          foreach ( $plugins as $file => $p ) {
 215              $new_option->checked[ $file ] = $p['Version'];
 216  
 217              if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
 218                  $plugin_changed = true;
 219          }
 220  
 221          if ( isset ( $current->response ) && is_array( $current->response ) ) {
 222              foreach ( $current->response as $plugin_file => $update_details ) {
 223                  if ( ! isset($plugins[ $plugin_file ]) ) {
 224                      $plugin_changed = true;
 225                      break;
 226                  }
 227              }
 228          }
 229  
 230          // Bail if we've checked recently and if nothing has changed
 231          if ( ! $plugin_changed )
 232              return false;
 233      }
 234  
 235      // Update last_checked for current to prevent multiple blocking requests if request hangs
 236      $current->last_checked = time();
 237      set_site_transient( 'update_plugins', $current );
 238  
 239      $to_send = compact( 'plugins', 'active' );
 240  
 241      $locales = array( get_locale() );
 242      /**
 243       * Filter the locales requested for plugin translations.
 244       *
 245       * @since 3.7.0
 246       *
 247       * @param array $locales Plugin locale. Default is current locale of the site.
 248       */
 249      $locales = apply_filters( 'plugins_update_check_locales', $locales );
 250  
 251      $options = array(
 252          'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
 253          'body' => array(
 254              'plugins'      => json_encode( $to_send ),
 255              'translations' => json_encode( $translations ),
 256              'locale'       => json_encode( $locales ),
 257          ),
 258          'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
 259      );
 260  
 261      $url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
 262      if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
 263          $url = set_url_scheme( $url, 'https' );
 264  
 265      $raw_response = wp_remote_post( $url, $options );
 266      if ( $ssl && is_wp_error( $raw_response ) ) {
 267          trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
 268          $raw_response = wp_remote_post( $http_url, $options );
 269      }
 270  
 271      if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
 272          return false;
 273  
 274      $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
 275      foreach ( $response['plugins'] as &$plugin ) {
 276          $plugin = (object) $plugin;
 277      }
 278      unset( $plugin );
 279  
 280      if ( is_array( $response ) ) {
 281          $new_option->response = $response['plugins'];
 282          $new_option->translations = $response['translations'];
 283      } else {
 284          $new_option->response = array();
 285          $new_option->translations = array();
 286      }
 287  
 288      set_site_transient( 'update_plugins', $new_option );
 289  }
 290  
 291  /**
 292   * Check theme versions against the latest versions hosted on WordPress.org.
 293   *
 294   * A list of all themes installed in sent to WP. Checks against the
 295   * WordPress server at api.wordpress.org. Will only check if WordPress isn't
 296   * installing.
 297   *
 298   * @package WordPress
 299   * @since 2.7.0
 300   * @uses $wp_version Used to notify the WordPress version.
 301   *
 302   * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
 303   */
 304  function wp_update_themes() {
 305      include  ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
 306  
 307      if ( defined( 'WP_INSTALLING' ) )
 308          return false;
 309  
 310      $installed_themes = wp_get_themes();
 311      $translations = wp_get_installed_translations( 'themes' );
 312  
 313      $last_update = get_site_transient( 'update_themes' );
 314      if ( ! is_object($last_update) )
 315          $last_update = new stdClass;
 316  
 317      $themes = $checked = $request = array();
 318  
 319      // Put slug of current theme into request.
 320      $request['active'] = get_option( 'stylesheet' );
 321  
 322      foreach ( $installed_themes as $theme ) {
 323          $checked[ $theme->get_stylesheet() ] = $theme->get('Version');
 324  
 325          $themes[ $theme->get_stylesheet() ] = array(
 326              'Name'       => $theme->get('Name'),
 327              'Title'      => $theme->get('Name'),
 328              'Version'    => $theme->get('Version'),
 329              'Author'     => $theme->get('Author'),
 330              'Author URI' => $theme->get('AuthorURI'),
 331              'Template'   => $theme->get_template(),
 332              'Stylesheet' => $theme->get_stylesheet(),
 333          );
 334      }
 335  
 336      // Check for update on a different schedule, depending on the page.
 337      switch ( current_filter() ) {
 338          case 'upgrader_process_complete' :
 339              $timeout = 0;
 340              break;
 341          case 'load-update-core.php' :
 342              $timeout = MINUTE_IN_SECONDS;
 343              break;
 344          case 'load-themes.php' :
 345          case 'load-update.php' :
 346              $timeout = HOUR_IN_SECONDS;
 347              break;
 348          default :
 349              $timeout = 12 * HOUR_IN_SECONDS;
 350      }
 351  
 352      $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
 353  
 354      if ( $time_not_changed ) {
 355          $theme_changed = false;
 356          foreach ( $checked as $slug => $v ) {
 357              if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) )
 358                  $theme_changed = true;
 359          }
 360  
 361          if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) {
 362              foreach ( $last_update->response as $slug => $update_details ) {
 363                  if ( ! isset($checked[ $slug ]) ) {
 364                      $theme_changed = true;
 365                      break;
 366                  }
 367              }
 368          }
 369  
 370          // Bail if we've checked recently and if nothing has changed
 371          if ( ! $theme_changed )
 372              return false;
 373      }
 374  
 375      // Update last_checked for current to prevent multiple blocking requests if request hangs
 376      $last_update->last_checked = time();
 377      set_site_transient( 'update_themes', $last_update );
 378  
 379      $request['themes'] = $themes;
 380  
 381      $locales = array( get_locale() );
 382      /**
 383       * Filter the locales requested for theme translations.
 384       *
 385       * @since 3.7.0
 386       *
 387       * @param array $locales Theme locale. Default is current locale of the site.
 388       */
 389      $locales = apply_filters( 'themes_update_check_locales', $locales );
 390  
 391      $options = array(
 392          'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
 393          'body' => array(
 394              'themes'       => json_encode( $request ),
 395              'translations' => json_encode( $translations ),
 396              'locale'       => json_encode( $locales ),
 397          ),
 398          'user-agent'    => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
 399      );
 400  
 401      $url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
 402      if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
 403          $url = set_url_scheme( $url, 'https' );
 404  
 405      $raw_response = wp_remote_post( $url, $options );
 406      if ( $ssl && is_wp_error( $raw_response ) ) {
 407          trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="http://wordpress.org/support/">support forums</a>.' ) . ' ' . '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)', headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
 408          $raw_response = wp_remote_post( $http_url, $options );
 409      }
 410  
 411      if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
 412          return false;
 413  
 414      $new_update = new stdClass;
 415      $new_update->last_checked = time();
 416      $new_update->checked = $checked;
 417  
 418      $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
 419  
 420      if ( is_array( $response ) ) {
 421          $new_update->response     = $response['themes'];
 422          $new_update->translations = $response['translations'];
 423      }
 424  
 425      set_site_transient( 'update_themes', $new_update );
 426  }
 427  
 428  /**
 429   * Performs WordPress automatic background updates.
 430   *
 431   * @since 3.7.0
 432   */
 433  function wp_maybe_auto_update() {
 434      include_once  ABSPATH . '/wp-admin/includes/admin.php';
 435      include_once  ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
 436  
 437      $upgrader = new WP_Automatic_Updater;
 438      $upgrader->run();
 439  }
 440  
 441  /**
 442   * Retrieves a list of all language updates available.
 443   *
 444   * @since 3.7.0
 445   */
 446  function wp_get_translation_updates() {
 447      $updates = array();
 448      $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );
 449      foreach ( $transients as $transient => $type ) {
 450  
 451          $transient = get_site_transient( $transient );
 452          if ( empty( $transient->translations ) )
 453              continue;
 454  
 455          foreach ( $transient->translations as $translation ) {
 456              $updates[] = (object) $translation;
 457          }
 458      }
 459  
 460      return $updates;
 461  }
 462  
 463  /**
 464   * Collect counts and UI strings for available updates
 465   *
 466   * @since 3.3.0
 467   *
 468   * @return array
 469   */
 470  function wp_get_update_data() {
 471      $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 );
 472  
 473      if ( $plugins = current_user_can( 'update_plugins' ) ) {
 474          $update_plugins = get_site_transient( 'update_plugins' );
 475          if ( ! empty( $update_plugins->response ) )
 476              $counts['plugins'] = count( $update_plugins->response );
 477      }
 478  
 479      if ( $themes = current_user_can( 'update_themes' ) ) {
 480          $update_themes = get_site_transient( 'update_themes' );
 481          if ( ! empty( $update_themes->response ) )
 482              $counts['themes'] = count( $update_themes->response );
 483      }
 484  
 485      if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) {
 486          $update_wordpress = get_core_updates( array('dismissed' => false) );
 487          if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') )
 488              $counts['wordpress'] = 1;
 489      }
 490  
 491      if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() )
 492          $counts['translations'] = 1;
 493  
 494      $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations'];
 495      $titles = array();
 496      if ( $counts['wordpress'] )
 497          $titles['wordpress'] = sprintf( __( '%d WordPress Update'), $counts['wordpress'] );
 498      if ( $counts['plugins'] )
 499          $titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] );
 500      if ( $counts['themes'] )
 501          $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] );
 502      if ( $counts['translations'] )
 503          $titles['translations'] = __( 'Translation Updates' );
 504  
 505      $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';
 506  
 507      $update_data = array( 'counts' => $counts, 'title' => $update_title );
 508      /**
 509       * Filter the returned array of update data for plugins, themes, and WordPress core.
 510       *
 511       * @since 3.5.0
 512       *
 513       * @param array $update_data {
 514       *     Fetched update data.
 515       *
 516       *     @type array   $counts       An array of counts for available plugin, theme, and WordPress updates.
 517       *     @type string  $update_title Titles of available updates.
 518       * }
 519       * @param array $titles An array of update counts and UI strings for available updates.
 520       */
 521      return apply_filters( 'wp_get_update_data', $update_data, $titles );
 522  }
 523  
 524  function _maybe_update_core() {
 525      include  ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
 526  
 527      $current = get_site_transient( 'update_core' );
 528  
 529      if ( isset( $current->last_checked ) &&
 530          12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) &&
 531          isset( $current->version_checked ) &&
 532          $current->version_checked == $wp_version )
 533          return;
 534  
 535      wp_version_check();
 536  }
 537  /**
 538   * Check the last time plugins were run before checking plugin versions.
 539   *
 540   * This might have been backported to WordPress 2.6.1 for performance reasons.
 541   * This is used for the wp-admin to check only so often instead of every page
 542   * load.
 543   *
 544   * @since 2.7.0
 545   * @access private
 546   */
 547  function _maybe_update_plugins() {
 548      $current = get_site_transient( 'update_plugins' );
 549      if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) )
 550          return;
 551      wp_update_plugins();
 552  }
 553  
 554  /**
 555   * Check themes versions only after a duration of time.
 556   *
 557   * This is for performance reasons to make sure that on the theme version
 558   * checker is not run on every page load.
 559   *
 560   * @since 2.7.0
 561   * @access private
 562   */
 563  function _maybe_update_themes() {
 564      $current = get_site_transient( 'update_themes' );
 565      if ( isset( $current->last_checked ) && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) )
 566          return;
 567  
 568      wp_update_themes();
 569  }
 570  
 571  /**
 572   * Schedule core, theme, and plugin update checks.
 573   *
 574   * @since 3.1.0
 575   */
 576  function wp_schedule_update_checks() {
 577      if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
 578          wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
 579  
 580      if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
 581          wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
 582  
 583      if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
 584          wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
 585  
 586      if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
 587          // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
 588          $next = strtotime( 'today 7am' );
 589          $now = time();
 590          // Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
 591          while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
 592              $next += 12 * HOUR_IN_SECONDS;
 593          }
 594          $next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
 595          // Add a random number of minutes, so we don't have all sites trying to update exactly on the hour
 596          $next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS;
 597          wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
 598      }
 599  }
 600  
 601  if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
 602      return;
 603  
 604  add_action( 'admin_init', '_maybe_update_core' );
 605  add_action( 'wp_version_check', 'wp_version_check' );
 606  add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
 607  
 608  add_action( 'load-plugins.php', 'wp_update_plugins' );
 609  add_action( 'load-update.php', 'wp_update_plugins' );
 610  add_action( 'load-update-core.php', 'wp_update_plugins' );
 611  add_action( 'admin_init', '_maybe_update_plugins' );
 612  add_action( 'wp_update_plugins', 'wp_update_plugins' );
 613  add_action( 'upgrader_process_complete', 'wp_update_plugins' );
 614  
 615  add_action( 'load-themes.php', 'wp_update_themes' );
 616  add_action( 'load-update.php', 'wp_update_themes' );
 617  add_action( 'load-update-core.php', 'wp_update_themes' );
 618  add_action( 'admin_init', '_maybe_update_themes' );
 619  add_action( 'wp_update_themes', 'wp_update_themes' );
 620  add_action( 'upgrader_process_complete', 'wp_update_themes' );
 621  
 622  add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
 623  
 624  add_action('init', 'wp_schedule_update_checks');


Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu