PluginProbe
Moloni / trunk
Moloni vtrunk
5.0.10 5.0.09 5.0.08 5.0.07 5.0.06 trunk 0.4.0.00 0.4.8.1 3.0.10 3.0.11 3.0.35 3.0.36 3.0.37 3.0.38 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.0.46 3.0.47 3.0.48 3.0.49 3.0.50 All 98 releases
moloni / src / Activators / Remove.php

Remove.php in Moloni trunk, at src/Activators/Remove.php

44 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Moloni\Activators;
4
5 use WP_Site;
6
7 class Remove
8 {
9 public static function run()
10 {
11 global $wpdb;
12
13 if (is_multisite() && function_exists('get_sites')) {
14 /** @var WP_Site[] $sites */
15 $sites = get_sites();
16
17 foreach ($sites as $site) {
18 self::dropTables($wpdb->get_blog_prefix($site->blog_id));
19 }
20 } else {
21 self::dropTables($wpdb->get_blog_prefix());
22 }
23
24 wp_clear_scheduled_hook('moloniProductsSync');
25 }
26
27 public static function uninitializeSite(WP_Site $site)
28 {
29 global $wpdb;
30
31 self::dropTables($wpdb->get_blog_prefix($site->blog_id));
32 }
33
34 private static function dropTables($prefix = null)
35 {
36 global $wpdb;
37
38 $wpdb->query("DROP TABLE " . $prefix . "moloni_api");
39 $wpdb->query("DROP TABLE " . $prefix . "moloni_api_config");
40 $wpdb->query("DROP TABLE " . $prefix . "moloni_logs");
41 $wpdb->query("DROP TABLE " . $prefix . "moloni_sync_logs");
42 }
43 }
44