* 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
This commit is contained in:
parent
fe7ca9b9fd
commit
da62fc431f
3 changed files with 21 additions and 27 deletions
|
|
@ -135,6 +135,7 @@ abstract class DatabaseUpdater {
|
|||
if( $purge ) {
|
||||
$this->purgeCache();
|
||||
}
|
||||
$this->checkStats();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -376,4 +377,22 @@ abstract class DatabaseUpdater {
|
|||
$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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,21 +59,11 @@ class UpdateMediaWiki extends Maintenance {
|
|||
$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() {
|
||||
|
|
|
|||
|
|
@ -567,21 +567,6 @@ function maybe_do_profiling_memory_update() {
|
|||
}
|
||||
}
|
||||
|
||||
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__ );
|
||||
|
|
|
|||
Loading…
Reference in a new issue