Index: trunk/phase3/maintenance/update.php |
— | — | @@ -59,21 +59,11 @@ |
60 | 60 | $updater = DatabaseUpdater::newForDb( $db, $shared ); |
61 | 61 | $updater->doUpdates( $purge ); |
62 | 62 | |
63 | | - if ( !defined( 'MW_NO_SETUP' ) ) { |
64 | | - define( 'MW_NO_SETUP', true ); |
65 | | - } |
66 | | - |
67 | 63 | foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) { |
68 | | - call_user_func_array( array( new $maint, 'execute' ), array() ); |
| 64 | + $this->runChild( $maint )->execute(); |
69 | 65 | } |
70 | 66 | |
71 | | - if ( $db->getType() === 'postgres' ) { |
72 | | - return; |
73 | | - } |
74 | | - |
75 | | - do_stats_init(); |
76 | | - |
77 | | - $this->output( "Done.\n" ); |
| 67 | + $this->output( "\nDone.\n" ); |
78 | 68 | } |
79 | 69 | |
80 | 70 | protected function afterFinalSetup() { |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -567,21 +567,6 @@ |
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | | -function do_stats_init() { |
572 | | - // Sometimes site_stats table is not properly populated. |
573 | | - wfOut( "\nChecking site_stats row..." ); |
574 | | - $row = wfGetDB( DB_MASTER )->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ ); |
575 | | - if ( $row === false ) { |
576 | | - wfOut( "data is missing! rebuilding...\n" ); |
577 | | - } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) { |
578 | | - wfOut( "missing ss_total_pages, rebuilding...\n" ); |
579 | | - } else { |
580 | | - wfOut( "ok.\n" ); |
581 | | - return; |
582 | | - } |
583 | | - SiteStatsInit::doAllAndCommit( false ); |
584 | | -} |
585 | | - |
586 | 571 | function do_active_users_init() { |
587 | 572 | $dbw = wfGetDB( DB_MASTER ); |
588 | 573 | $activeUsers = $dbw->selectField( 'site_stats', 'ss_active_users', false, __METHOD__ ); |
Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -135,6 +135,7 @@ |
136 | 136 | if( $purge ) { |
137 | 137 | $this->purgeCache(); |
138 | 138 | } |
| 139 | + $this->checkStats(); |
139 | 140 | } |
140 | 141 | |
141 | 142 | /** |
— | — | @@ -376,4 +377,22 @@ |
377 | 378 | $this->db->delete( 'objectcache', '*', __METHOD__ ); |
378 | 379 | wfOut( "done.\n" ); |
379 | 380 | } |
| 381 | + |
| 382 | + /** |
| 383 | + * Check the site_stats table is not properly populated. |
| 384 | + */ |
| 385 | + protected function checkStats() { |
| 386 | + wfOut( "Checking site_stats row..." ); |
| 387 | + $row = $this->db->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ ); |
| 388 | + if ( $row === false ) { |
| 389 | + wfOut( "data is missing! rebuilding...\n" ); |
| 390 | + } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) { |
| 391 | + wfOut( "missing ss_total_pages, rebuilding...\n" ); |
| 392 | + } else { |
| 393 | + wfOut( "done.\n" ); |
| 394 | + return; |
| 395 | + } |
| 396 | + SiteStatsInit::doAllAndCommit( false ); |
| 397 | + } |
| 398 | + |
380 | 399 | } |