* Moved do_stats_init() to DatabaseUpdater and call it from doUpdates() for consistency with purgeCache(), this inverts the order of execution with default messages deletion, but I don't think this should break anything
* Removed the early return for postgres, which was a leftover from the old do_postgres_updates() crap
if( $purge ) {
$this->purgeCache();
}
+ $this->checkStats();
}
/**
$this->db->delete( 'objectcache', '*', __METHOD__ );
wfOut( "done.\n" );
}
+
+ /**
+ * Check the site_stats table is not properly populated.
+ */
+ protected function checkStats() {
+ wfOut( "Checking site_stats row..." );
+ $row = $this->db->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ );
+ if ( $row === false ) {
+ wfOut( "data is missing! rebuilding...\n" );
+ } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) {
+ wfOut( "missing ss_total_pages, rebuilding...\n" );
+ } else {
+ wfOut( "done.\n" );
+ return;
+ }
+ SiteStatsInit::doAllAndCommit( false );
+ }
+
}
$updater = DatabaseUpdater::newForDb( $db, $shared );
$updater->doUpdates( $purge );
- if ( !defined( 'MW_NO_SETUP' ) ) {
- define( 'MW_NO_SETUP', true );
- }
-
foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) {
- call_user_func_array( array( new $maint, 'execute' ), array() );
+ $this->runChild( $maint )->execute();
}
- if ( $db->getType() === 'postgres' ) {
- return;
- }
-
- do_stats_init();
-
- $this->output( "Done.\n" );
+ $this->output( "\nDone.\n" );
}
protected function afterFinalSetup() {
}
}
-function do_stats_init() {
- // Sometimes site_stats table is not properly populated.
- wfOut( "\nChecking site_stats row..." );
- $row = wfGetDB( DB_MASTER )->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ );
- if ( $row === false ) {
- wfOut( "data is missing! rebuilding...\n" );
- } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) {
- wfOut( "missing ss_total_pages, rebuilding...\n" );
- } else {
- wfOut( "ok.\n" );
- return;
- }
- SiteStatsInit::doAllAndCommit( false );
-}
-
function do_active_users_init() {
$dbw = wfGetDB( DB_MASTER );
$activeUsers = $dbw->selectField( 'site_stats', 'ss_active_users', false, __METHOD__ );