WordPress.org

Make WordPress Core

Ticket #4169: auto-deactivate.diff

File auto-deactivate.diff, 824 bytes (added by rob1n, 7 years ago)

Automattically disable Automattic Widgets if it's active

  • wp-admin/upgrade-functions.php

     
    188188        if ( $wp_current_db_version < 5200 ) { 
    189189                upgrade_230(); 
    190190        } 
     191         
     192        maybe_disable_automattic_widgets(); 
    191193 
    192194        $wp_rewrite->flush_rules(); 
    193195 
     
    11111113                die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version)); 
    11121114} 
    11131115 
    1114 ?> 
     1116function maybe_disable_automattic_widgets() { 
     1117        $plugins = __get_option( 'active_plugins' ); 
     1118         
     1119        if ( in_array( 'widgets/widgets.php', $plugins ) ) { 
     1120                array_splice( $plugins, array_search( 'widgets/widgets.php', $plugins ), 1 ); 
     1121                update_option( 'active_plugins', $plugins ); 
     1122        } 
     1123} 
     1124 
     1125?> 
     1126 No newline at end of file