1
0
Fork 0
mirror of https://github.com/inretio/WordPress-Plugin-Boilerplate synced 2024-12-22 11:53:53 +02:00

moving $wpdb outside of the conditional so both cases work

Fixes #182
This commit is contained in:
Tom McFarlin 2014-05-09 09:35:11 -04:00
parent f6917437fc
commit 2c29f1ca04

View file

@ -13,13 +13,16 @@
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit; exit;
} }
if (is_multisite()) {
global $wpdb; global $wpdb;
$blogs = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A);
/* @TODO: delete all transient, options and files you may have added if ( is_multisite() ) {
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
/* @TODO: delete all transient, options and files you may have added
delete_transient( 'TRANSIENT_NAME' ); delete_transient( 'TRANSIENT_NAME' );
delete_option('OPTION_NAME'); delete_option('OPTION_NAME');
//info: remove custom file directory for main site //info: remove custom file directory for main site
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
$directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR; $directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR;
if (is_dir($directory)) { if (is_dir($directory)) {
@ -29,13 +32,14 @@ if (is_multisite()) {
rmdir($directory); rmdir($directory);
} }
*/ */
if ($blogs) { if ( $blogs ) {
foreach($blogs as $blog) {
switch_to_blog($blog['blog_id']); foreach ( $blogs as $blog ) {
/* @TODO: delete all transient, options and files you may have added switch_to_blog( $blog['blog_id'] );
/* @TODO: delete all transient, options and files you may have added
delete_transient( 'TRANSIENT_NAME' ); delete_transient( 'TRANSIENT_NAME' );
delete_option('OPTION_NAME'); delete_option('OPTION_NAME');
//info: remove custom file directory for main site //info: remove custom file directory for main site
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
$directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR; $directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR;
if (is_dir($directory)) { if (is_dir($directory)) {
@ -51,13 +55,12 @@ if (is_multisite()) {
restore_current_blog(); restore_current_blog();
} }
} }
}
else } else {
{ /* @TODO: delete all transient, options and files you may have added
/* @TODO: delete all transient, options and files you may have added
delete_transient( 'TRANSIENT_NAME' ); delete_transient( 'TRANSIENT_NAME' );
delete_option('OPTION_NAME'); delete_option('OPTION_NAME');
//info: remove custom file directory for main site //info: remove custom file directory for main site
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
$directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR; $directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR;
if (is_dir($directory)) { if (is_dir($directory)) {