r68536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68535‎ | r68536 | r68537 >
Date:00:39, 25 June 2010
Author:demon
Status:deferred (Comments)
Tags:
Comment:
Move flaggedrevs_stats creation to actual patch files rather than this DIY stuff
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.sql (modified) (history)
  • /trunk/extensions/FlaggedRevs/archives/patch-flaggedrevs_stats.sql (added) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateStats.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/updateStats.inc
@@ -224,6 +224,15 @@
225225 $dbCache->set( $key, $data, 30*24*3600 );
226226 // Save the data
227227 $dbw = wfGetDB( DB_MASTER );
 228+
 229+ // Make sure the master has flaggedrevs_stats and _stats2
 230+ if( !$dbw->tableExists( 'flaggedrevs_stats' ) ||
 231+ !$dbw->tableExists( 'flaggedrevs_stats2' ) )
 232+ {
 233+ print( "Need to run update.php to create flaggedrevs_stats and flaggedrevs_stats2. Stopping." );
 234+ die( 1 );
 235+ }
 236+
228237 $dbw->begin();
229238 // Create small stats tables if not present
230239 $flaggedrevs_stats = $dbr->tableName('flaggedrevs_stats');
@@ -268,27 +277,3 @@
269278 $dbCache->delete( $keySQL );
270279 print( "done updating!\n" );
271280 }
272 -
273 -// Per-Namespace stats
274 -function createFlaggedRevsStatsTable( $dbw, $flaggedrevs_stats ) {
275 - $dbw->query(
276 - "CREATE TABLE $flaggedrevs_stats (
277 - namespace INTEGER UNSIGNED NOT NULL DEFAULT 0 PRIMARY KEY,
278 - total INTEGER UNSIGNED NOT NULL DEFAULT 0,
279 - reviewed INTEGER UNSIGNED NOT NULL DEFAULT 0,
280 - synced INTEGER UNSIGNED NOT NULL DEFAULT 0
281 - );"
282 - );
283 -}
284 -
285 -// General stats
286 -function createFlaggedRevsStatsTable2( $dbw, $flaggedrevs_stats2 ) {
287 - $dbw->query(
288 - "CREATE TABLE $flaggedrevs_stats2 (
289 - stat_id INTEGER UNSIGNED NOT NULL DEFAULT 1 PRIMARY KEY,
290 - ave_review_time INTEGER UNSIGNED NOT NULL DEFAULT 0,
291 - med_review_time INTEGER UNSIGNED NOT NULL DEFAULT 0,
292 - ave_pending_time INTEGER UNSIGNED NOT NULL DEFAULT 0
293 - );"
294 - );
295 -}
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql
@@ -136,3 +136,17 @@
137137 frp_user_id integer unsigned NOT NULL PRIMARY KEY,
138138 frp_user_params mediumblob NOT NULL
139139 ) /*$wgDBTableOptions*/;
 140+
 141+CREATE TABLE /*_*/flaggedrevs_stats (
 142+ namespace int unsigned NOT NULL DEFAULT 0 PRIMARY KEY,
 143+ total int unsigend NOT NULL DEFAULT 0,
 144+ reviewed int unsigned NOT NULL DEFAULT 0,
 145+ synced int unsigned NOT NULL DEFAULT 0
 146+) /*$wgDBTableOptions*/;
 147+
 148+CREATE TABLE /*_*/flaggedrevs_stats2 (
 149+ stat_id int unsigned NOT NULL DEFAULT 1 PRIMARY KEY,
 150+ ave_review_time int unsigned NOT NULL DEFAULT 0,
 151+ med_review_time int unsigned NOT NULL DEFAULT 0,
 152+ ave_pending_time int unsigned NOT NULL DEFAULT 0
 153+) /*$wgDBTableOptions*/;
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -2203,6 +2203,8 @@
22042204 "$base/archives/patch-fpc_level.sql" );
22052205 $wgExtNewTables[] = array( 'flaggedpage_pending',
22062206 "$base/archives/patch-flaggedpage_pending.sql" );
 2207+ $wgExtNewTables[] = array( 'flaggedrevs_stats',
 2208+ "$base/archives/patch-flaggedrevs_stats.sql" );
22072209 } elseif ( $wgDBtype == 'postgres' ) {
22082210 // Initial install tables (current schema)
22092211 $wgExtNewTables[] = array( 'flaggedrevs', "$base/FlaggedRevs.pg.sql" );
Index: trunk/extensions/FlaggedRevs/archives/patch-flaggedrevs_stats.sql
@@ -0,0 +1,14 @@
 2+-- Various statistics about the reviewed namespaces
 3+CREATE TABLE /*_*/flaggedrevs_stats (
 4+ namespace int unsigned NOT NULL DEFAULT 0 PRIMARY KEY,
 5+ total int unsigend NOT NULL DEFAULT 0,
 6+ reviewed int unsigned NOT NULL DEFAULT 0,
 7+ synced int unsigned NOT NULL DEFAULT 0
 8+) /*$wgDBTableOptions*/;
 9+
 10+CREATE TABLE /*_*/flaggedrevs_stats2 (
 11+ stat_id int unsigned NOT NULL DEFAULT 1 PRIMARY KEY,
 12+ ave_review_time int unsigned NOT NULL DEFAULT 0,
 13+ med_review_time int unsigned NOT NULL DEFAULT 0,
 14+ ave_pending_time int unsigned NOT NULL DEFAULT 0
 15+) /*$wgDBTableOptions*/;
Property changes on: trunk/extensions/FlaggedRevs/archives/patch-flaggedrevs_stats.sql
___________________________________________________________________
Name: svn:eol-style
116 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r68539Followup r68536, typo in sqldemon01:39, 25 June 2010

Comments

#Comment by Aaron Schulz (talk | contribs)   03:52, 25 June 2010

This tables are getting removed and redone (with a patch file) soon.

Status & tagging log