~canonical-sysadmins/wordpress/4.7

« back to all changes in this revision

Viewing changes to wp-admin/update-core.php

  • Committer: Nick Moffitt
  • Date: 2015-01-15 11:04:26 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: nick.moffitt@canonical.com-20150115110426-5stm1p14cfnxrtme
New Upstream Version 4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
<?php
242
242
        foreach ( (array) $plugins as $plugin_file => $plugin_data) {
243
243
                $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
 
244
                if ( is_wp_error( $info ) ) {
 
245
                        continue;
 
246
                }
 
247
 
244
248
                // Get plugin compat for running version of WordPress.
245
249
                if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) {
246
250
                        $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
377
381
        if ( !$update )
378
382
                return;
379
383
 
 
384
        // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
 
385
        // that it's safe to do so. This only happens when there are no new files to create.
 
386
        $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
 
387
 
380
388
?>
381
389
        <div class="wrap">
382
390
        <h2><?php _e('Update WordPress'); ?></h2>
383
391
<?php
384
392
 
385
 
        if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH ) ) ) {
 
393
        if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array(), $allow_relaxed_file_ownership ) ) ) {
386
394
                echo '</div>';
387
395
                return;
388
396
        }
389
397
 
390
 
        if ( ! WP_Filesystem( $credentials, ABSPATH ) ) {
 
398
        if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
391
399
                // Failed to connect, Error and request again
392
 
                request_filesystem_credentials( $url, '', true, ABSPATH );
 
400
                request_filesystem_credentials( $url, '', true, ABSPATH, array(), $allow_relaxed_file_ownership );
393
401
                echo '</div>';
394
402
                return;
395
403
        }
407
415
        add_filter( 'update_feedback', 'show_message' );
408
416
 
409
417
        $upgrader = new Core_Upgrader();
410
 
        $result = $upgrader->upgrade( $update );
 
418
        $result = $upgrader->upgrade( $update, array(
 
419
                'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
 
420
        ) );
411
421
 
412
422
        if ( is_wp_error($result) ) {
413
423
                show_message($result);
639
649
        /**
640
650
         * Fires for each custom update action on the WordPress Updates screen.
641
651
         *
642
 
         * The dynamic portion of the hook name, $action, refers to the
 
652
         * The dynamic portion of the hook name, `$action`, refers to the
643
653
         * passed update action. The hook fires in lieu of all available
644
654
         * default update actions.
645
655
         *