Make WordPress Core

Ticket #49239: admin.php.patch

File admin.php.patch, 2.7 KB (added by pikamander2, 6 years ago)
  • admin.php

     
    4545         * @since 2.8.0
    4646         */
    4747        do_action( 'after_db_upgrade' );
    48 } elseif ( get_option( 'db_version' ) != $wp_db_version && empty( $_POST ) ) {
     48} elseif ( get_option( 'db_version' ) !== $wp_db_version && empty( $_POST ) ) {
    4949        if ( ! is_multisite() ) {
    5050                wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
    5151                exit;
     
    7272                 * If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
    7373                 * attempt to do no more than threshold value, with some +/- allowed.
    7474                 */
    75                 if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) == 1 ) ) {
     75                if ( $c <= 50 || ( $c > 50 && 1 === mt_rand( 0, (int) ( $c / 50 ) ) ) ) {
    7676                        require_once( ABSPATH . WPINC . '/http.php' );
    7777                        $response = wp_remote_get(
    7878                                admin_url( 'upgrade.php?step=1' ),
     
    181181                $page_hook = get_plugin_page_hook( $plugin_page, $plugin_page );
    182182
    183183                // Back-compat for plugins using add_management_page().
    184                 if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
     184                if ( empty( $page_hook ) && 'edit.php' === $pagenow && '' !== get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
    185185                        // There could be plugin specific params on the URL, so we need the whole query string
    186186                        if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
    187187                                $query_string = $_SERVER['QUERY_STRING'];
     
    370370         * The following hooks are fired to ensure backward compatibility.
    371371         * In all other cases, 'load-' . $pagenow should be used instead.
    372372         */
    373         if ( $typenow == 'page' ) {
    374                 if ( $pagenow == 'post-new.php' ) {
     373        if ( 'page' === $typenow ) {
     374                if ( 'post-new.php' === $pagenow ) {
    375375                        do_action( 'load-page-new.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    376                 } elseif ( $pagenow == 'post.php' ) {
     376                } elseif ( 'post.php' === $pagenow ) {
    377377                        do_action( 'load-page.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    378378                }
    379         } elseif ( $pagenow == 'edit-tags.php' ) {
    380                 if ( $taxnow == 'category' ) {
     379        } elseif ( 'edit-tags.php' === $pagenow ) {
     380                if ( 'category' === $taxnow ) {
    381381                        do_action( 'load-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    382                 } elseif ( $taxnow == 'link_category' ) {
     382                } elseif ( 'link_category' === $taxnow ) {
    383383                        do_action( 'load-edit-link-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    384384                }
    385385        } elseif ( 'term.php' === $pagenow ) {