Make WordPress Core


Ignore:
Timestamp:
03/12/2015 08:52:42 AM (11 years ago)
Author:
jorbin
Message:

Request FTP and SSH credentials when needed during shiny updates

This is a first pass at requesting FTP and SSH credentials when needed during shiny updates. Styling and some UX improvements are still needed, but we do show the prompt and use the passed data when doing plugin installs and updates for shiny updates. There are also a couple of areas that we could improve code wise such how we create the requestFilesystemCredentials part of the localized _wpUpdatesSettings. Over the past half century, we've split the atom, we've spliced the gene and we've roamed Tranquility Base. We've reached for the stars and never have we been closer to having them in our grasp. That has nothing to do with shiny updates.

Props ericlewis, jorbin, and drewapicture for testing
Fixes #31528

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r31746 r31749  
    543543
    544544        $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ) );
     545
     546        /*
     547         * Determine whether the user will need to enter filesystem credentials
     548         * on the front-end.
     549         */
     550        require_once(ABSPATH . 'wp-admin/includes/file.php');
     551        $filesystem_method = get_filesystem_method();
     552        ob_start();
     553        $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
     554        ob_end_clean();
     555        $request_filesystem_credentials = ( $filesystem_method != 'direct' && ! $filesystem_credentials_are_stored ) ? 1 : 0;
     556
    545557        did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array(
    546558            'ajax_nonce' => wp_create_nonce( 'updates' ),
     559            'requestFilesystemCredentials' => $request_filesystem_credentials,
    547560            'l10n'       => array(
    548561                'updating'      => __( 'Updating...' ),
Note: See TracChangeset for help on using the changeset viewer.