http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72842
Revision: 72842 Author: ialex Date: 2010-09-12 09:07:51 +0000 (Sun, 12 Sep 2010) Log Message: ----------- * Use Maintenance::runChild() to get the child script instance * 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 Modified Paths: -------------- trunk/phase3/includes/installer/DatabaseUpdater.php trunk/phase3/maintenance/update.php trunk/phase3/maintenance/updaters.inc Modified: trunk/phase3/includes/installer/DatabaseUpdater.php =================================================================== --- trunk/phase3/includes/installer/DatabaseUpdater.php 2010-09-12 07:58:00 UTC (rev 72841) +++ trunk/phase3/includes/installer/DatabaseUpdater.php 2010-09-12 09:07:51 UTC (rev 72842) @@ -135,6 +135,7 @@ if( $purge ) { $this->purgeCache(); } + $this->checkStats(); } /** @@ -376,4 +377,22 @@ $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 ); + } + } Modified: trunk/phase3/maintenance/update.php =================================================================== --- trunk/phase3/maintenance/update.php 2010-09-12 07:58:00 UTC (rev 72841) +++ trunk/phase3/maintenance/update.php 2010-09-12 09:07:51 UTC (rev 72842) @@ -59,21 +59,11 @@ $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() { Modified: trunk/phase3/maintenance/updaters.inc =================================================================== --- trunk/phase3/maintenance/updaters.inc 2010-09-12 07:58:00 UTC (rev 72841) +++ trunk/phase3/maintenance/updaters.inc 2010-09-12 09:07:51 UTC (rev 72842) @@ -567,21 +567,6 @@ } } -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__ ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs