~canonical-sysadmins/wordpress/4.6.1

« back to all changes in this revision

Viewing changes to wp-includes/update.php

  • Committer: Nick Moffitt
  • Date: 2016-04-14 10:44:19 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: nick.moffitt@canonical.com-20160414104419-w6lxcr3ru4enc2w5
Merge WP4.5 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
                return;
27
27
        }
28
28
 
29
 
        global $wp_version, $wpdb, $wp_local_package;
 
29
        global $wpdb, $wp_local_package;
30
30
        // include an unmodified $wp_version
31
31
        include( ABSPATH . WPINC . '/version.php' );
32
32
        $php_version = phpversion();
169
169
                }
170
170
        }
171
171
 
172
 
        // Trigger a background updates check if running non-interactively, and we weren't called from the update handler.
 
172
        // Trigger background updates if running non-interactively, and we weren't called from the update handler.
173
173
        if ( defined( 'DOING_CRON' ) && DOING_CRON && ! doing_action( 'wp_maybe_auto_update' ) ) {
174
174
                do_action( 'wp_maybe_auto_update' );
175
175
        }
192
192
                return;
193
193
        }
194
194
 
195
 
        global $wp_version;
196
195
        // include an unmodified $wp_version
197
196
        include( ABSPATH . WPINC . '/version.php' );
198
197
 
263
262
 
264
263
        $to_send = compact( 'plugins', 'active' );
265
264
 
 
265
        $locales = array_values( get_available_languages() );
 
266
 
266
267
        /**
267
268
         * Filter the locales requested for plugin translations.
268
269
         *
269
270
         * @since 3.7.0
 
271
         * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
270
272
         *
271
 
         * @param array $locales Plugin locale. Default is current locale of the site.
 
273
         * @param array $locales Plugin locales. Default is all available locales of the site.
272
274
         */
273
 
        $locales = apply_filters( 'plugins_update_check_locales', array( get_locale() ) );
 
275
        $locales = apply_filters( 'plugins_update_check_locales', $locales );
 
276
        $locales = array_unique( $locales );
274
277
 
275
278
        if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
276
279
                $timeout = 30;
311
314
        $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
312
315
        foreach ( $response['plugins'] as &$plugin ) {
313
316
                $plugin = (object) $plugin;
 
317
                if ( isset( $plugin->compatibility ) ) {
 
318
                        $plugin->compatibility = (object) $plugin->compatibility;
 
319
                        foreach ( $plugin->compatibility as &$data ) {
 
320
                                $data = (object) $data;
 
321
                        }
 
322
                }
314
323
        }
315
 
        unset( $plugin );
 
324
        unset( $plugin, $data );
316
325
        foreach ( $response['no_update'] as &$plugin ) {
317
326
                $plugin = (object) $plugin;
318
327
        }
340
349
 * installing.
341
350
 *
342
351
 * @since 2.7.0
343
 
 * @uses $wp_version Used to notify the WordPress version.
344
352
 *
345
353
 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
346
354
 */
348
356
        if ( wp_installing() ) {
349
357
                return;
350
358
        }
351
 
        global $wp_version;
 
359
 
352
360
        // include an unmodified $wp_version
353
361
        include( ABSPATH . WPINC . '/version.php' );
354
362
 
428
436
 
429
437
        $request['themes'] = $themes;
430
438
 
 
439
        $locales = array_values( get_available_languages() );
 
440
 
431
441
        /**
432
442
         * Filter the locales requested for theme translations.
433
443
         *
434
444
         * @since 3.7.0
 
445
         * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
435
446
         *
436
 
         * @param array $locales Theme locale. Default is current locale of the site.
 
447
         * @param array $locales Theme locales. Default is all available locales of the site.
437
448
         */
438
 
        $locales = apply_filters( 'themes_update_check_locales', array( get_locale() ) );
 
449
        $locales = apply_filters( 'themes_update_check_locales', $locales );
 
450
        $locales = array_unique( $locales );
439
451
 
440
452
        if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
441
453
                $timeout = 30;
583
595
}
584
596
 
585
597
/**
 
598
 * Determines whether core should be updated.
 
599
 *
 
600
 * @since 2.8.0
 
601
 *
586
602
 * @global string $wp_version
587
603
 */
588
604
function _maybe_update_core() {
589
 
        global $wp_version;
590
 
        include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
 
605
        // include an unmodified $wp_version
 
606
        include( ABSPATH . WPINC . '/version.php' );
591
607
 
592
608
        $current = get_site_transient( 'update_core' );
593
609
 
645
661
 
646
662
        if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_installing() )
647
663
                wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
648
 
 
649
 
        if ( ( wp_next_scheduled( 'wp_maybe_auto_update' ) > ( time() + HOUR_IN_SECONDS ) ) && ! wp_installing() )
650
 
                wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
651
664
}
652
665
 
653
666
/**