/**
 * Run network-wide (de-)activation of the plugin
 *
 * @param bool $activate True for plugin activation, false for de-activation
 */
function wpseo_network_activate_deactivate($activate = true)
{
    global $wpdb;
    $original_blog_id = get_current_blog_id();
    // alternatively use: $wpdb->blogid
    $all_blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
    if (is_array($all_blogs) && $all_blogs !== array()) {
        foreach ($all_blogs as $blog_id) {
            switch_to_blog($blog_id);
            if ($activate === true) {
                _wpseo_activate();
            } else {
                _wpseo_deactivate();
            }
        }
        // Restore back to original blog
        switch_to_blog($original_blog_id);
    }
}
/**
 * Run network-wide (de-)activation of the plugin
 *
 * @param bool $activate True for plugin activation, false for de-activation.
 */
function wpseo_network_activate_deactivate($activate = true)
{
    global $wpdb;
    $all_blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
    if (is_array($all_blogs) && $all_blogs !== array()) {
        foreach ($all_blogs as $blog_id) {
            switch_to_blog($blog_id);
            if ($activate === true) {
                _wpseo_activate();
            } else {
                _wpseo_deactivate();
            }
            restore_current_blog();
        }
    }
}
/**
 * Run network-wide (de-)activation of the plugin
 *
 * @param bool $activate True for plugin activation, false for de-activation.
 */
function wpseo_network_activate_deactivate($activate = true)
{
    global $wpdb;
    $network_blogs = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = %d", $wpdb->siteid));
    if (is_array($network_blogs) && $network_blogs !== array()) {
        foreach ($network_blogs as $blog_id) {
            switch_to_blog($blog_id);
            if ($activate === true) {
                _wpseo_activate();
            } else {
                _wpseo_deactivate();
            }
            restore_current_blog();
        }
    }
}