WordPress build repository browser

Changeset 64344


Ignore:
Timestamp:
11/02/2026 04:10:54 PM (7 days ago)
Author:
lancewillett
Message:

Code Quality: Declare existing admin globals and simplify variable checks.

Document existing globals in user and plugin administration screens, initialize the remaining redirect and privacy management URL defaults, and remove a redundant old-user-data check from wp_insert_user().

Remove the corresponding PHPStan baseline entries.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/11979

Props huzaifaalmesbah, noruzzaman.
See #65817.

Built from ​https://develop.svn.wordpress.org/trunk@65195

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/plugins.php

    r63823 r64344  
    99/** WordPress Administration Bootstrap */
    1010require_once __DIR__ . '/admin.php';
     11
     12/**
     13 * @global string $status   Current plugin status view, set by WP_Plugins_List_Table.
     14 * @global int    $page     Current page number, set by WP_Plugins_List_Table.
     15 * @global array  $plugins  Set by WP_Plugins_List_Table::prepare_items().
     16 * @global int    $user_ID  ID of the current user, set during authentication.
     17 */
     18global $status, $page, $plugins, $user_ID;
    1119
    1220if ( ! current_user_can( 'activate_plugins' ) ) {
  • trunk/wp-admin/user-edit.php

    r64023 r64344  
    1212/** WordPress Translation Installation API */
    1313require_once ABSPATH . 'wp-admin/includes/translation-install.php';
     14
     15/**
     16 * @global wpdb    $wpdb                  WordPress database abstraction object.
     17 * @global array   $_wp_admin_css_colors  Registered admin color schemes.
     18 * @global WP_Roles $wp_roles             The roles object.
     19 */
     20global $wpdb, $_wp_admin_css_colors, $wp_roles;
    1421
    1522$action          = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
  • trunk/wp-admin/user-new.php

    r63205 r64344  
    99/** WordPress Administration Bootstrap */
    1010require_once __DIR__ . '/admin.php';
     11
     12/**
     13 * @global wpdb $wpdb    WordPress database abstraction object.
     14 * @global int  $blog_id The current site (blog) ID on multisite.
     15 */
     16global $wpdb, $blog_id;
    1117
    1218if ( is_multisite() ) {
    … …  
    241247
    242248                        if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
    243                                 /**
    244                                  * @global wpdb $wpdb WordPress database abstraction object.
    245                                  */
    246                                 global $wpdb;
    247 
    248249                                $key      = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) );
    249250                                $new_user = wpmu_activate_signup( $key );
  • trunk/wp-admin/users.php

    r64023 r64344  
    1010/** WordPress Administration Bootstrap */
    1111require_once __DIR__ . '/admin.php';
     12
     13/**
     14 * @global WP_User    $current_user The current user, set during authentication.
     15 * @global WP_Roles   $wp_roles     The roles object.
     16 * @global wpdb       $wpdb         WordPress database abstraction object.
     17 * @global string     $usersearch   User search query, set by WP_Users_List_Table.
     18 * @global int        $blog_id      The current site (blog) ID on multisite.
     19 */
     20global $current_user, $wp_roles, $wpdb, $usersearch, $blog_id;
    1221
    1322if ( ! current_user_can( 'list_users' ) ) {
    … …  
    94103
    95104if ( empty( $_REQUEST ) ) {
    96         $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
     105        $redirect = '';
     106        $referer  = '<input type="hidden" name="wp_http_referer" value="' . esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
    97107} elseif ( isset( $_REQUEST['wp_http_referer'] ) ) {
    98108        $redirect = remove_query_arg( array( 'wp_http_referer', 'updated', 'delete_count' ), wp_unslash( $_REQUEST['wp_http_referer'] ) );
  • trunk/wp-includes/user.php

    r64147 r64344  
    24292429         * accordingly.
    24302430         */
    2431         if ( ( ! $update || ( ! empty( $old_user_data ) && 0 !== strcasecmp( $user_email, $old_user_data->user_email ) ) )
     2431        if ( ( ! $update || 0 !== strcasecmp( $user_email, $old_user_data->user_email ) )
    24322432                && ! defined( 'WP_IMPORTING' )
    24332433                && email_exists( $user_email )
    … …  
    43274327        }
    43284328
     4329        $manage_url = '';
    43294330        if ( 'export_personal_data' === $request->action_name ) {
    43304331                $manage_url = admin_url( 'export-personal-data.php' );
  • trunk/wp-includes/version.php

    r64343 r64344  
    1717 * @global string $wp_version
    1818 */
    19 $wp_version = '7.2-beta3-65194';
     19$wp_version = '7.2-beta3-65195';
    2020
    2121/**
Note: See TracChangeset for help on using the changeset viewer.