Make WordPress Core


Ignore:
Timestamp:
05/20/2020 06:47:24 PM (6 years ago)
Author:
whyisjake
Message:

Security: Add user interface to auto-update themes and plugins.

Building on core update mechanisms, this adds the ability to enable automatic updates for themes and plugins to the WordPress admin.

Fixes: #50052.
Props: afercia, afragen, audrasjb, azaozz, bookdude13, davidperonne, desrosj, gmays, gmays, javiercasares, karmatosed, knutsp, mapk, mukesh27, netweb, nicolaskulka, nielsdeblaauw, paaljoachim, passoniate, pbiron, pedromendonca, whodunitagency, whyisjake, wpamitkumar, and xkon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r47808 r47835  
    329329        <tbody class="plugins">
    330330        <?php
     331
     332        $auto_updates = array();
     333        if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) {
     334                $auto_updates       = (array) get_site_option( 'auto_update_plugins', array() );
     335                $auto_update_notice = ' | ' . wp_get_auto_update_message();
     336        }
     337
    331338        foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
    332339                $plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
    … …  
    420427                        );
    421428                        echo ' ' . $details . $compat . $upgrade_notice;
     429                        if ( in_array( $plugin_file, $auto_updates, true ) ) {
     430                                echo $auto_update_notice;
     431                        }
    422432                        ?>
    423433                </p></td>
    … …  
    479489        <tbody class="plugins">
    480490        <?php
     491        $auto_updates = array();
     492        if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) {
     493                $auto_updates       = (array) get_site_option( 'auto_update_themes', array() );
     494                $auto_update_notice = ' | ' . wp_get_auto_update_message();
     495        }
     496
    481497        foreach ( $themes as $stylesheet => $theme ) {
    482498                $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
     499
    483500                ?>
    484501        <tr>
    … …  
    502519                                $theme->update['new_version']
    503520                        );
     521                        if ( in_array( $stylesheet, $auto_updates, true ) ) {
     522                                echo $auto_update_notice;
     523                        }
    504524                        ?>
    505525                </p></td>
Note: See TracChangeset for help on using the changeset viewer.