PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 5.0
MainWP Dashboard: Self-hosted WordPress Management for Agencies v5.0
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
mainwp / class / class-mainwp-install.php

class-mainwp-install.php in MainWP Dashboard: Self-hosted WordPress Management for Agencies 5.0, at class/class-mainwp-install.php

590 lines 17.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MainWP Install
4 *
5 * This file handles install MainWP DB.
6 *
7 * @package MainWP/Dashboard
8 */
9
10 namespace MainWP\Dashboard;
11
12 /**
13 * Class MainWP_Install
14 *
15 * @package MainWP\Dashboard
16 *
17 * @uses \MainWP\Dashboard\MainWP_DB_Base
18 */
19 class MainWP_Install extends MainWP_DB_Base {
20
21 // phpcs:disable WordPress.DB.RestrictedFunctions, WordPress.DB.PreparedSQL.NotPrepared -- unprepared SQL ok, accessing the database directly to custom database functions.
22
23 /**
24 * Private variable to hold the database version info.
25 *
26 * @var string DB version info.
27 */
28 protected $mainwp_db_version = '9.0.0.4';
29
30 /**
31 * Protected variable to hold the database option name.
32 *
33 * @var string DB version info.
34 */
35 protected $option_db_key = 'mainwp_db_version';
36
37 /**
38 * Private static variable to hold the single instance of the class.
39 *
40 * @static
41 *
42 * @var mixed Default null
43 */
44 private static $instance = null;
45
46 /**
47 * Method instance()
48 *
49 * Return public static instance.
50 *
51 * @static
52 * @return MainWP_DB
53 */
54 public static function instance() {
55 if ( null === self::$instance ) {
56 self::$instance = new self();
57 }
58
59 self::$instance->test_connection();
60
61 return self::$instance;
62 }
63
64 /**
65 * Method install()
66 *
67 * Installs the new DB.
68 *
69 * @return void
70 *
71 * @uses \MainWP\Dashboard\MainWP_Utility::update_option()
72 */
73 public function install() { // phpcs:ignore -- complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated.
74 // get_site_option is multisite aware!
75 $currentVersion = get_site_option( $this->option_db_key );
76
77 if ( empty( $currentVersion ) ) {
78 update_option( 'mainwp_run_quick_setup', 'yes' );
79 MainWP_Utility::update_option( 'mainwp_enableLegacyBackupFeature', 0 );
80 } elseif ( false === get_option( 'mainwp_enableLegacyBackupFeature' ) ) {
81 MainWP_Utility::update_option( 'mainwp_enableLegacyBackupFeature', 1 );
82 }
83
84 if ( empty( $currentVersion ) || version_compare( $currentVersion, '8.8', '<' ) ) {
85 MainWP_Utility::update_option( 'mainwp_selected_theme', 'default' );
86 }
87
88 $rslt = self::instance()->query( "SHOW TABLES LIKE '" . $this->table_name( 'wp' ) . "'" );
89 if ( empty( self::num_rows( $rslt ) ) ) {
90 $currentVersion = false;
91 }
92
93 if ( $currentVersion === $this->mainwp_db_version ) {
94 return;
95 }
96
97 $this->pre_update_tables();
98
99 $charset_collate = $this->wpdb->get_charset_collate();
100
101 $sql = array();
102 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp' ) . " (
103 id int(11) NOT NULL auto_increment,
104 userid int(11) NOT NULL,
105 adminname text NOT NULL,
106 name text NOT NULL,
107 url text NOT NULL,
108 pubkey text NOT NULL,
109 privkey text NOT NULL,
110 siteurl text NOT NULL,
111 ga_id text NOT NULL,
112 gas_id int(11) NOT NULL,
113 offline_checks_last int(11) NOT NULL,
114 offline_check_result int(11) NOT NULL,
115 http_response_code int(11) NOT NULL DEFAULT 0,
116 http_code_noticed tinyint(1) NOT NULL DEFAULT 1,
117 disable_status_check tinyint(1) NOT NULL DEFAULT 0,
118 disable_health_check tinyint(1) NOT NULL DEFAULT 0,
119 status_check_interval tinyint(1) NOT NULL DEFAULT 0,
120 health_threshold int(11) NOT NULL DEFAULT 0,
121 note text NOT NULL,
122 statsUpdate int(11) NOT NULL,
123 directories longtext NOT NULL,
124 plugin_upgrades longtext NOT NULL,
125 theme_upgrades longtext NOT NULL,
126 translation_upgrades longtext NOT NULL,
127 premium_upgrades longtext NOT NULL,
128 securityIssues longtext NOT NULL,
129 themes longtext NOT NULL,
130 ignored_themes longtext NOT NULL,
131 plugins longtext NOT NULL,
132 ignored_plugins longtext NOT NULL,
133 users longtext NOT NULL,
134 categories longtext NOT NULL,
135 pluginDir text NOT NULL,
136 automatic_update tinyint(1) NOT NULL,
137 backup_before_upgrade tinyint(1) NOT NULL DEFAULT 2,
138 mainwpdir tinyint(1) NOT NULL,
139 loadFilesBeforeZip tinyint(1) NOT NULL DEFAULT 1,
140 is_ignoreCoreUpdates tinyint(1) NOT NULL DEFAULT 0,
141 is_ignorePluginUpdates tinyint(1) NOT NULL DEFAULT 0,
142 is_ignoreThemeUpdates tinyint(1) NOT NULL DEFAULT 0,
143 verify_certificate tinyint(1) NOT NULL DEFAULT 1,
144 force_use_ipv4 tinyint(1) NOT NULL DEFAULT 0,
145 ssl_version tinyint(1) NOT NULL DEFAULT 0,
146 ip text NOT NULL DEFAULT '',
147 uniqueId text NOT NULL,
148 maximumFileDescriptorsOverride tinyint(1) NOT NULL DEFAULT 0,
149 maximumFileDescriptorsAuto tinyint(1) NOT NULL DEFAULT 1,
150 maximumFileDescriptors int(11) NOT NULL DEFAULT 150,
151 http_user text NOT NULL DEFAULT '',
152 http_pass text NOT NULL DEFAULT '',
153 wpe tinyint(1) NOT NULL,
154 is_staging tinyint(1) NOT NULL DEFAULT 0,
155 client_id int(11) NOT NULL DEFAULT 0,
156 `suspended` tinyint(1) NOT NULL DEFAULT 0,
157 KEY idx_userid (userid)";
158 if ( empty( $currentVersion ) ) {
159 $tbl .= ',
160 PRIMARY KEY (id) ';
161 }
162 $tbl .= ') ' . $charset_collate;
163 $sql[] = $tbl;
164
165 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_sync' ) . " (
166 sync_id int(11) NOT NULL auto_increment,
167 wpid int(11) NOT NULL,
168 version text NOT NULL DEFAULT '',
169 sync_errors longtext NOT NULL DEFAULT '',
170 uptodate longtext NOT NULL DEFAULT '',
171 dtsAutomaticSync int(11) NOT NULL DEFAULT 0,
172 dtsAutomaticSyncStart int(11) NOT NULL DEFAULT 0,
173 dtsSync int(11) NOT NULL DEFAULT 0,
174 dtsSyncStart int(11) NOT NULL DEFAULT 0,
175 totalsize int(11) NOT NULL DEFAULT 0,
176 dbsize int(11) NOT NULL DEFAULT 0,
177 extauth text NOT NULL DEFAULT '',
178 last_post_gmt int(11) NOT NULL DEFAULT 0,
179 health_value int(11) NOT NULL DEFAULT 0,
180 health_status tinyint(1) NOT NULL DEFAULT 0,
181 health_site_noticed tinyint(1) NOT NULL DEFAULT 1,
182 KEY idx_wpid (wpid)";
183
184 if ( empty( $currentVersion ) ) {
185 $tbl .= ',
186 PRIMARY KEY (sync_id)';
187 }
188
189 $tbl .= ') ' . $charset_collate;
190
191 $sql[] = $tbl;
192
193 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_options' ) . " (
194 opt_id int(11) NOT NULL auto_increment,
195 wpid int(11) NOT NULL,
196 name text NOT NULL DEFAULT '',
197 value longtext NOT NULL DEFAULT '',
198 KEY idx_wpid (wpid)";
199
200 if ( empty( $currentVersion ) ) {
201 $tbl .= ',
202 PRIMARY KEY (opt_id)';
203 }
204 $tbl .= ') ' . $charset_collate;
205 $sql[] = $tbl;
206
207 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_settings_backup' ) . ' (
208 set_id int(11) NOT NULL auto_increment,
209 wpid int(11) NOT NULL,
210 archiveFormat text NOT NULL,
211 KEY idx_wpid (wpid)';
212
213 if ( empty( $currentVersion ) ) {
214 $tbl .= ',
215 PRIMARY KEY (set_id)';
216 }
217 $tbl .= ') ' . $charset_collate;
218 $sql[] = $tbl;
219
220 $tbl = 'CREATE TABLE ' . $this->table_name( 'users' ) . " (
221 userid int(11) NOT NULL,
222 user_email text NOT NULL DEFAULT '',
223 ignored_plugins longtext NOT NULL DEFAULT '',
224 trusted_plugins longtext NOT NULL DEFAULT '',
225 trusted_plugins_notes longtext NOT NULL DEFAULT '',
226 ignored_themes longtext NOT NULL DEFAULT '',
227 trusted_themes longtext NOT NULL DEFAULT '',
228 trusted_themes_notes longtext NOT NULL DEFAULT '',
229 site_view tinyint(1) NOT NULL DEFAULT '0',
230 pluginDir text NOT NULL DEFAULT '',
231 dismissed_plugins longtext NOT NULL DEFAULT '',
232 dismissed_themes longtext NOT NULL DEFAULT ''";
233 if ( empty( $currentVersion ) ) {
234 $tbl .= ',
235 PRIMARY KEY (userid) ';
236 }
237 $tbl .= ') ' . $charset_collate;
238 $sql[] = $tbl;
239
240 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_status' ) . ' (
241 statusid bigint(20) unsigned NOT NULL auto_increment,
242 wpid int(11) NOT NULL,
243 http_code smallint NOT NULL DEFAULT 0,
244 status tinyint(1) NOT NULL DEFAULT 0,
245 event_timestamp int(11) NOT NULL,
246 duration int(11) NOT NULL DEFAULT 0';
247 if ( empty( $currentVersion ) || version_compare( $currentVersion, '8.31', '<=' ) ) {
248 $tbl .= ',
249 PRIMARY KEY (statusid) ';
250 }
251 $tbl .= ') ' . $charset_collate;
252 $sql[] = $tbl;
253
254 $tbl = 'CREATE TABLE ' . $this->table_name( 'group' ) . ' (
255 id int(11) NOT NULL auto_increment,
256 userid int(11) NOT NULL,
257 name text NOT NULL,
258 color varchar(32) NOT NULL DEFAULT ""';
259 if ( empty( $currentVersion ) ) {
260 $tbl .= ',
261 PRIMARY KEY (id) ';
262 }
263 $tbl .= ') ' . $charset_collate;
264 $sql[] = $tbl;
265
266 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_group' ) . ' (
267 wp_group_id int(11) NOT NULL auto_increment,
268 wpid int(11) NOT NULL,
269 groupid int(11) NOT NULL,
270 KEY idx_wpid (wpid),
271 KEY idx_groupid (groupid)';
272 if ( empty( $currentVersion ) || version_compare( $currentVersion, '8.57', '<=' ) ) {
273 $tbl .= ',
274 PRIMARY KEY (wp_group_id) ';
275 }
276 $tbl .= ') ' . $charset_collate;
277 $sql[] = $tbl;
278
279 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_backup_progress' ) . " (
280 task_id int(11) NOT NULL,
281 wp_id int(11) NOT NULL,
282 dtsFetched int(11) NOT NULL DEFAULT 0,
283 fetchResult text NOT NULL DEFAULT '',
284 downloadedDB text NOT NULL DEFAULT '',
285 downloadedFULL text NOT NULL DEFAULT '',
286 downloadedDBComplete tinyint(1) NOT NULL DEFAULT 0,
287 downloadedFULLComplete tinyint(1) NOT NULL DEFAULT 0,
288 removedFiles tinyint(1) NOT NULL DEFAULT 0,
289 attempts int(11) NOT NULL DEFAULT 0,
290 last_error text NOT NULL DEFAULT '',
291 pid int(11) NOT NULL DEFAULT 0,
292 KEY idx_task_id (task_id)";
293 if ( empty( $currentVersion ) || version_compare( $currentVersion, '8.53', '<=' ) ) {
294 $tbl .= ',
295 UNIQUE (task_id)';
296 }
297 $tbl .= ') ' . $charset_collate;
298 $sql[] = $tbl;
299
300 $tbl = 'CREATE TABLE ' . $this->table_name( 'wp_backup' ) . ' (
301 id int(11) NOT NULL auto_increment,
302 userid int(11) NOT NULL,
303 name text NOT NULL,
304 schedule text NOT NULL,
305 type text NOT NULL,
306 exclude text NOT NULL,
307 sites text NOT NULL,
308 `groups` text NOT NULL,
309 last int(11) NOT NULL,
310 last_run int(11) NOT NULL,
311 lastStartNotificationSent int(11) NOT NULL DEFAULT 0,
312 last_run_manually int(11) NOT NULL,
313 completed_sites text NOT NULL,
314 completed int(11) NOT NULL,
315 backup_errors text NOT NULL,
316 subfolder text NOT NULL,
317 filename text NOT NULL,
318 paused tinyint(1) NOT NULL,
319 template tinyint(1) DEFAULT 0,
320 excludebackup tinyint(1) DEFAULT 0,
321 excludecache tinyint(1) DEFAULT 0,
322 excludenonwp tinyint(1) DEFAULT 0,
323 excludezip tinyint(1) DEFAULT 0,
324 archiveFormat text NOT NULL,
325 loadFilesBeforeZip tinyint(1) NOT NULL DEFAULT 1,
326 maximumFileDescriptorsOverride tinyint(1) NOT NULL DEFAULT 0,
327 maximumFileDescriptorsAuto tinyint(1) NOT NULL DEFAULT 1,
328 maximumFileDescriptors int(11) NOT NULL DEFAULT 150';
329 if ( empty( $currentVersion ) ) {
330 $tbl .= ',
331 PRIMARY KEY (id) ';
332 }
333 $tbl .= ') ' . $charset_collate;
334 $sql[] = $tbl;
335
336 $tbl = 'CREATE TABLE ' . $this->table_name( 'action_log' ) . " (
337 id int(11) NOT NULL auto_increment,
338 log_content mediumtext NOT NULL DEFAULT '',
339 log_type tinyint(1) DEFAULT 0,
340 log_color tinyint(1) DEFAULT 0,
341 log_user varchar(128) NOT NULL DEFAULT '',
342 log_timestamp int(11) NOT NULL DEFAULT 0";
343 if ( empty( $currentVersion ) || version_compare( $currentVersion, '8.50', '<=' ) ) {
344 $tbl .= ',
345 PRIMARY KEY (id) ';
346 }
347 $tbl .= ') ' . $charset_collate . ';';
348 $sql[] = $tbl;
349
350 $tbl = 'CREATE TABLE ' . $this->table_name( 'request_log' ) . " (
351 id int(11) NOT NULL auto_increment,
352 wpid int(11) NOT NULL,
353 ip text NOT NULL DEFAULT '',
354 subnet text NOT NULL DEFAULT '',
355 micro_timestamp_stop DECIMAL( 12, 2 ) NOT NULL DEFAULT 0,
356 micro_timestamp_start DECIMAL( 12, 2 ) NOT NULL DEFAULT 0";
357 if ( empty( $currentVersion ) || version_compare( $currentVersion, '5.7', '<=' ) ) {
358 $tbl .= ',
359 PRIMARY KEY (id) ';
360 }
361 $tbl .= ') ' . $charset_collate . ';';
362 $sql[] = $tbl;
363
364 $sql = apply_filters( 'mainwp_db_install_tables', $sql, $currentVersion, $charset_collate );
365
366 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
367
368 global $wpdb;
369
370 if ( MainWP_Utility::instance()->is_disabled_functions( 'error_log' ) || ! function_exists( '\error_log' ) ) {
371 error_reporting(0); // phpcs:ignore -- try to disabled the error_log somewhere in WP.
372 }
373
374 $suppress = $wpdb->suppress_errors();
375 foreach ( $sql as $query ) {
376 dbDelta( $query );
377 }
378 $wpdb->suppress_errors( $suppress );
379
380 $this->post_update();
381
382 if ( ! is_multisite() ) {
383 MainWP_Utility::update_option( $this->option_db_key, $this->mainwp_db_version );
384 } else {
385 update_site_option( $this->option_db_key, $this->mainwp_db_version );
386 }
387 }
388
389 /**
390 * Returns the database version.
391 *
392 * @return string
393 */
394 public function get_db_version() {
395 return get_site_option( $this->option_db_key );
396 }
397
398 /**
399 * Method post_update()
400 *
401 * Update MainWP DB.
402 *
403 * @return void
404 */
405 public function post_update() {
406
407 // get_site_option is multisite aware!
408 $currentVersion = get_site_option( $this->option_db_key );
409
410 if ( false === $currentVersion ) {
411 return;
412 }
413
414 $suppress = $this->wpdb->suppress_errors();
415
416 $this->post_update_81( $currentVersion );
417
418 if ( version_compare( $currentVersion, '8.984', '<' ) ) {
419 $sslColumns = array(
420 'nossl',
421 'nosslkey',
422 );
423 foreach ( $sslColumns as $col ) {
424 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN ' . $col );
425 }
426 }
427
428 // delete old columns.
429 if ( version_compare( $currentVersion, '8.17', '<' ) ) {
430 $rankColumns = array(
431 'pagerank',
432 'indexed',
433 'alexia',
434 'pagerank_old',
435 'indexed_old',
436 'alexia_old',
437 'last_db_backup_size',
438 );
439
440 foreach ( $rankColumns as $rankColumn ) {
441 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN ' . $rankColumn );
442 }
443
444 $syncColumns = array( 'uptodate' );
445 foreach ( $syncColumns as $column ) {
446 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp_sync' ) . ' DROP COLUMN ' . $column );
447 }
448 }
449
450 // delete old columns.
451 if ( version_compare( $currentVersion, '8.35', '<' ) ) {
452 $delColumns = array( 'offline_checks' );
453 foreach ( $delColumns as $column ) {
454 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN ' . $column );
455 }
456 $delColumns = array( 'heatMap' );
457 foreach ( $delColumns as $column ) {
458 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'users' ) . ' DROP COLUMN ' . $column );
459 }
460 }
461
462 // change columns.
463 if ( version_compare( $currentVersion, '8.40', '<' ) && version_compare( $currentVersion, '8.30', '>' ) ) {
464 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp_status' ) . ' CHANGE COLUMN `timestamp_status` `event_timestamp` int(11) NOT NULL' );
465 }
466
467 // delete columns.
468 if ( version_compare( $currentVersion, '8.42', '<' ) ) {
469 $delColumns = array( 'offlineChecksOnlineNotification' );
470 foreach ( $delColumns as $column ) {
471 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'users' ) . ' DROP COLUMN ' . $column );
472 }
473 }
474
475 // fix missing PRIMARY keys.
476 if ( version_compare( $currentVersion, '8.53', '<=' ) ) {
477 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp_options' ) . ' ADD opt_id int NOT NULL AUTO_INCREMENT PRIMARY KEY' );
478 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp_settings_backup' ) . ' ADD set_id int NOT NULL AUTO_INCREMENT PRIMARY KEY' );
479 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp_sync' ) . ' ADD sync_id int NOT NULL AUTO_INCREMENT PRIMARY KEY' );
480 }
481
482 $this->wpdb->suppress_errors( $suppress );
483 MainWP_DB_Client::instance()->check_to_updates_reports_data_861( $currentVersion );
484 }
485
486 /**
487 * Method pre_update_tables()
488 *
489 * Handle pre update tables.
490 *
491 * @return void
492 */
493 public function pre_update_tables() {
494 // get_site_option is multisite aware!
495 $currentVersion = get_site_option( $this->option_db_key );
496
497 if ( false === $currentVersion ) {
498 return;
499 }
500
501 $suppress = $this->wpdb->suppress_errors();
502
503 if ( version_compare( $currentVersion, '8.98', '<=' ) ) {
504 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN backups' );
505 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN note_lastupdate' );
506 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN pages' );
507 }
508
509 $this->wpdb->suppress_errors( $suppress );
510 }
511
512 /**
513 * Method post_update_81()
514 *
515 * Update MainWP DB for version 8.1.
516 *
517 * @param string $current_version Current version DB.
518 *
519 * @return void
520 */
521 public function post_update_81( $current_version ) {
522
523 if ( version_compare( $current_version, '8.1', '<' ) ) {
524
525 // We can't split up here!
526 $wpSyncColumns = array(
527 'version',
528 'totalsize',
529 'dbsize',
530 'extauth',
531 'last_post_gmt',
532 'sync_errors',
533 'dtsSync',
534 'dtsSyncStart',
535 'dtsAutomaticSync',
536 'dtsAutomaticSyncStart',
537 );
538 foreach ( $wpSyncColumns as $wpSyncColumn ) {
539 $rslts = $this->wpdb->get_results( 'SELECT id,' . $wpSyncColumn . ' FROM ' . $this->table_name( 'wp' ), ARRAY_A );
540 if ( empty( $rslts ) ) {
541 continue;
542 }
543
544 foreach ( $rslts as $rslt ) {
545 $exists = $this->wpdb->get_results( $this->wpdb->prepare( 'SELECT wpid FROM ' . $this->table_name( 'wp_sync' ) . ' WHERE wpid = %d', $rslt['id'] ), ARRAY_A );
546 if ( empty( $exists ) ) {
547 $this->wpdb->insert(
548 $this->table_name( 'wp_sync' ),
549 array(
550 'wpid' => $rslt['id'],
551 $wpSyncColumn => $rslt[ $wpSyncColumn ],
552 )
553 );
554 } else {
555 $this->wpdb->update( $this->table_name( 'wp_sync' ), array( $wpSyncColumn => $rslt[ $wpSyncColumn ] ), array( 'wpid' => $rslt['id'] ) );
556 }
557 }
558
559 $suppress = $this->wpdb->suppress_errors();
560 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN ' . $wpSyncColumn );
561 $this->wpdb->suppress_errors( $suppress );
562 }
563
564 $optionColumns = array(
565 'last_wp_upgrades',
566 'last_plugin_upgrades',
567 'last_theme_upgrades',
568 'wp_upgrades',
569 'recent_comments',
570 'recent_posts',
571 'recent_pages',
572 );
573 foreach ( $optionColumns as $optionColumn ) {
574 $rslts = $this->wpdb->get_results( 'SELECT id,' . $optionColumn . ' FROM ' . $this->table_name( 'wp' ), ARRAY_A );
575 if ( empty( $rslts ) ) {
576 continue;
577 }
578
579 foreach ( $rslts as $rslt ) {
580 self::update_website_option( (object) $rslt, $optionColumn, $rslt[ $optionColumn ] );
581 }
582
583 $suppress = $this->wpdb->suppress_errors();
584 $this->wpdb->query( 'ALTER TABLE ' . $this->table_name( 'wp' ) . ' DROP COLUMN ' . $optionColumn );
585 $this->wpdb->suppress_errors( $suppress );
586 }
587 }
588 }
589 }
590