| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCommunity\Database; |
| 4 |
|
| 5 |
use FluentCommunity\Database\Migrations\FeedCommentsMigrator; |
| 6 |
use FluentCommunity\Database\Migrations\FeedMigrator; |
| 7 |
use FluentCommunity\Database\Migrations\FeedReactionsMigrator; |
| 8 |
use FluentCommunity\Database\Migrations\FeedSpaceMigrator; |
| 9 |
use FluentCommunity\Database\Migrations\FeedSpaceUserMigrator; |
| 10 |
use FluentCommunity\Database\Migrations\MediaArchiveMigrator; |
| 11 |
use FluentCommunity\Database\Migrations\MetaMigrator; |
| 12 |
use FluentCommunity\Database\Migrations\NotificationsMigrator; |
| 13 |
use FluentCommunity\Database\Migrations\NotificationUserMigrator; |
| 14 |
use FluentCommunity\Database\Migrations\TermFeedMigrator; |
| 15 |
use FluentCommunity\Database\Migrations\TermMigrator; |
| 16 |
use FluentCommunity\Database\Migrations\UserActivitiesMigrator; |
| 17 |
use FluentCommunity\Database\Migrations\XProfileMigrator; |
| 18 |
|
| 19 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 20 |
|
| 21 |
class DBMigrator |
| 22 |
{ |
| 23 |
public static function run($network_wide = false) |
| 24 |
{ |
| 25 |
if($network_wide) { |
| 26 |
global $wpdb; |
| 27 |
$blogs = $wpdb->get_results("SELECT blog_id FROM $wpdb->blogs"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 28 |
foreach ($blogs as $blog) { |
| 29 |
switch_to_blog($blog->blog_id); |
| 30 |
self::migrate(); |
| 31 |
restore_current_blog(); |
| 32 |
} |
| 33 |
return; |
| 34 |
} |
| 35 |
|
| 36 |
self::migrate(); |
| 37 |
} |
| 38 |
|
| 39 |
private static function migrate() |
| 40 |
{ |
| 41 |
FeedSpaceMigrator::migrate(); |
| 42 |
FeedMigrator::migrate(); |
| 43 |
FeedReactionsMigrator::migrate(); |
| 44 |
FeedCommentsMigrator::migrate(); |
| 45 |
FeedSpaceUserMigrator::migrate(); |
| 46 |
MetaMigrator::migrate(); |
| 47 |
NotificationsMigrator::migrate(); |
| 48 |
NotificationUserMigrator::migrate(); |
| 49 |
UserActivitiesMigrator::migrate(); |
| 50 |
TermMigrator::migrate(); |
| 51 |
TermFeedMigrator::migrate(); |
| 52 |
MediaArchiveMigrator::migrate(); |
| 53 |
XProfileMigrator::migrate(); |
| 54 |
} |
| 55 |
} |
| 56 |
|