Permalink
Browse files

Bump Tested To to 4.6.0, and now we all use get_sites()

  • Loading branch information...
lesterchan committed Feb 20, 2018
1 parent ecd59a3 commit ae9706c1290bc56715ebe08e2ad248071c8a7127
Showing with 20 additions and 39 deletions.
  1. +1 −1 README.md
  2. +7 −1 index.php
  3. +8 −8 uninstall.php
  4. +4 −29 wp-sweep.php
View
@@ -2,7 +2,7 @@
Contributors: GamerZ
Donate link: https://lesterchan.net/site/donation/
Tags: sweep, clean, cleanup, clean up, optimize, orphan, unused, duplicated, posts, post meta, comments, comment meta, users, user meta, terms, term meta, term relationships, revisions, auto drafts, transient, database, tables, oembed
Requires at least: 4.4
Requires at least: 4.6
Tested up to: 4.9
Stable tag: 1.1.0
License: GPLv2 or later
View
@@ -1,2 +1,8 @@
<?php
# Silence is golden.
/**
* WP-Sweep index.php
*
* @package wp-sweep
*/
// Silence is golden.
View
@@ -1,20 +1,20 @@
<?php
/*
* Uninstall WP-Sweep
/**
* WP-Sweep uninstall.php
*
* @package wp-sweep
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
if ( is_multisite() ) {
$ms_sites = function_exists( 'get_sites' ) ? get_sites() : wp_get_sites();
$ms_sites = get_sites();
if ( 0 < sizeof( $ms_sites ) ) {
if ( 0 < count( $ms_sites ) ) {
foreach ( $ms_sites as $ms_site ) {
$blog_id = class_exists( 'WP_Site' ) ? $ms_site->blog_id : $ms_site['blog_id'];
switch_to_blog( $blog_id );
switch_to_blog( $ms_site->blog_id );
plugin_uninstalled();
}
}
View
@@ -847,31 +847,6 @@ private function get_parent_termids() {
return $wpdb->get_col( $wpdb->prepare( "SELECT tt.parent FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.parent > %d", 0 ) );
}
/**
* Wrapper to get WordPress Multisite
*
* @since 1.0.9
*
* @access private
* @return array
*/
private function get_sites() {
return function_exists( 'get_sites' ) ? get_sites() : wp_get_sites();
}
/**
* Wrapper to get WordPress Multisite ID
*
* @since 1.0.9
*
* @access private
* @param WP_Site $ms_site
* @return int
*/
private function get_site_blog_id( $ms_site ) {
return class_exists( 'WP_Site' ) ? $ms_site->blog_id : $ms_site['blog_id'];
}
/**
* What to do when the plugin is being deactivated
*
@@ -883,11 +858,11 @@ private function get_site_blog_id( $ms_site ) {
*/
public function plugin_activation( $network_wide ) {
if ( is_multisite() && $network_wide ) {
$ms_sites = $this->get_sites();
$ms_sites = get_sites();
if ( 0 < count( $ms_sites ) ) {
foreach ( $ms_sites as $ms_site ) {
switch_to_blog( $this->get_site_blog_id( $ms_site ) );
switch_to_blog( $ms_site->blog_id );
$this->plugin_activated();
restore_current_blog();
}
@@ -919,11 +894,11 @@ private function plugin_activated() {
*/
public function plugin_deactivation( $network_wide ) {
if ( is_multisite() && $network_wide ) {
$ms_sites = $this->get_sites();
$ms_sites = get_sites();
if ( 0 < count( $ms_sites ) ) {
foreach ( $ms_sites as $ms_site ) {
switch_to_blog( $this->get_site_blog_id( $ms_site ) );
switch_to_blog( $ms_site->blog_id );
$this->plugin_deactivated();
restore_current_blog();
}

0 comments on commit ae9706c

Please sign in to comment.