WordPress.org

Make WordPress Core

Changeset 29839


Ignore:
Timestamp:
10/05/2014 08:36:11 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Network Admin: Properly check if the theme is active on the main site to avoid deleting it via bulk actions.

props ocean90.
fixes #29861.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/themes.php

    r28308 r29839  
    103103            $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
    104104
    105             unset( $themes[ get_option( 'stylesheet' ) ], $themes[ get_option( 'template' ) ] );
    106 
    107105            if ( empty( $themes ) ) {
    108106                wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
     107                exit;
     108            }
     109
     110            $themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) );
     111
     112            if ( empty( $themes ) ) {
     113                wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) );
    109114                exit;
    110115            }
     
    114119                $theme_info[ $theme ] = wp_get_theme( $theme );
    115120                $files_to_delete = array_merge( $files_to_delete, list_files( $theme_info[ $theme ]->get_stylesheet_directory() ) );
    116             }
    117 
    118             if ( empty( $themes ) ) {
    119                 wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) );
    120                 exit;
    121121            }
    122122
Note: See TracChangeset for help on using the changeset viewer.