Skip to content

Commit

Permalink
Add uninstall tests
Browse files Browse the repository at this point in the history
  • Loading branch information
keesiemeijer committed Feb 20, 2016
1 parent e5d4691 commit b9cc9af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<file>tests/test-functions.php</file>
<file>tests/test-query.php</file>
<file>tests/test-admin.php</file>
<file>tests/test-uninstall.php</file>
</testsuite>
</testsuites>
</phpunit>
16 changes: 15 additions & 1 deletion uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit;

global $wp_rewrite;
$wp_rewrite->flush_rules();
$wp_rewrite->flush_rules();

if ( is_multisite() ) {
global $wpdb;
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
if ( $blogs ) {
foreach ( (array) $blogs as $blog ) {
switch_to_blog( $blog['blog_id'] );
delete_option( 'custom_post_type_date_archives' );
}
restore_current_blog();
}
} else {
delete_option( 'custom_post_type_date_archives' );
}

0 comments on commit b9cc9af

Please sign in to comment.