r85209 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85208‎ | r85209 | r85210 >
Date:20:36, 2 April 2011
Author:aaron
Status:ok
Tags:
Comment:
* Added doFlaggedImagesTimestampNULL() update
* Re-organized updater stuff
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/mysql (deleted) (history)
  • /trunk/extensions/FlaggedRevs/postgres (deleted) (history)
  • /trunk/extensions/FlaggedRevs/updater (added) (history)
  • /trunk/extensions/FlaggedRevs/updater/FlaggedRevsUpdater.hooks.php (added) (history)
  • /trunk/extensions/FlaggedRevs/updater/mysql (added) (history)
  • /trunk/extensions/FlaggedRevs/updater/postgres (added) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -240,41 +240,43 @@
241241 $dir = dirname( __FILE__ ) . '/';
242242 $langDir = $dir . 'language/';
243243
 244+# Utility classes...
244245 $wgAutoloadClasses['FlaggedRevs'] = $dir . 'FlaggedRevs.class.php';
245246 $wgAutoloadClasses['FRUserCounters'] = $dir . 'FRUserCounters.php';
246 -$wgAutoloadClasses['FRInclusionManager'] = $dir . 'FRInclusionManager.php';
247247 $wgAutoloadClasses['FRUserActivity'] = $dir . 'FRUserActivity.php';
 248+$wgAutoloadClasses['FlaggedPageConfig'] = $dir . 'FlaggedPageConfig.php';
 249+$wgAutoloadClasses['FlaggedRevsLogs'] = $dir . 'FlaggedRevsLogs.php';
 250+$wgAutoloadClasses['FlaggedRevsXML'] = $dir . 'FlaggedRevsXML.php';
 251+
 252+# Event handler classes...
248253 $wgAutoloadClasses['FlaggedRevsHooks'] = $dir . 'FlaggedRevs.hooks.php';
249 -$wgAutoloadClasses['FlaggedRevsLogs'] = $dir . 'FlaggedRevsLogs.php';
 254+$wgAutoloadClasses['FlaggedRevsApiHooks'] = $dir . 'api/FlaggedRevsApi.hooks.php';
 255+$wgAutoloadClasses['FlaggedRevsUpdaterHooks'] = $dir . 'updater/FlaggedRevsUpdater.hooks.php';
 256+
 257+# Object classes...
250258 $wgAutoloadClasses['FRExtraCacheUpdate'] = $dir . 'FRExtraCacheUpdate.php';
251259 $wgAutoloadClasses['FRExtraCacheUpdateJob'] = $dir . 'FRExtraCacheUpdate.php';
252260 $wgAutoloadClasses['FRSquidUpdate'] = $dir . 'FRExtraCacheUpdate.php';
253261 $wgAutoloadClasses['FRDependencyUpdate'] = $dir . 'FRDependencyUpdate.php';
254 -
255 -# Special case cache invalidations
256 -$wgJobClasses['flaggedrevs_CacheUpdate'] = 'FRExtraCacheUpdateJob';
257 -
258 -$wgExtensionMessagesFiles['FlaggedRevs'] = $langDir . 'FlaggedRevs.i18n.php';
259 -$wgExtensionAliasesFiles['FlaggedRevs'] = $langDir . 'FlaggedRevs.alias.php';
260 -
261 -# Load general UI
262 -$wgAutoloadClasses['FlaggedRevsXML'] = $dir . 'FlaggedRevsXML.php';
263 -# Load web request context article stuff
 262+$wgAutoloadClasses['FRInclusionManager'] = $dir . 'FRInclusionManager.php';
264263 $wgAutoloadClasses['FlaggedArticleView'] = $dir . 'FlaggedArticleView.php';
265 -# Load FlaggedArticle object class
266264 $wgAutoloadClasses['FlaggedArticle'] = $dir . 'FlaggedArticle.php';
267 -# Load FlaggedPageConfig object class
268 -$wgAutoloadClasses['FlaggedPageConfig'] = $dir . 'FlaggedPageConfig.php';
269 -# Load FlaggedRevision object class
270265 $wgAutoloadClasses['FlaggedRevision'] = $dir . 'FlaggedRevision.php';
271266
272 -# Load review form
 267+# Review form class
273268 $wgAutoloadClasses['RevisionReviewForm'] = $dir . 'forms/RevisionReviewForm.php';
274 -# Load protection/stability form
 269+# Protection/stability form classes
275270 $wgAutoloadClasses['PageStabilityForm'] = $dir . 'forms/PageStabilityForm.php';
276271 $wgAutoloadClasses['PageStabilityGeneralForm'] = $dir . 'forms/PageStabilityForm.php';
277272 $wgAutoloadClasses['PageStabilityProtectForm'] = $dir . 'forms/PageStabilityForm.php';
278273
 274+# Special case cache invalidations
 275+$wgJobClasses['flaggedrevs_CacheUpdate'] = 'FRExtraCacheUpdateJob';
 276+
 277+# Load main i18n file and special page alias file
 278+$wgExtensionMessagesFiles['FlaggedRevs'] = $langDir . 'FlaggedRevs.i18n.php';
 279+$wgExtensionAliasesFiles['FlaggedRevs'] = $langDir . 'FlaggedRevs.alias.php';
 280+
279281 # Load revision review UI
280282 $wgAutoloadClasses['RevisionReview'] = $dir . 'specialpages/RevisionReview_body.php';
281283 # Load reviewed versions UI
@@ -317,7 +319,6 @@
318320 $wgSpecialPageGroups['ValidationStatistics'] = 'quality';
319321
320322 # API Modules
321 -$wgAutoloadClasses['FlaggedRevsApiHooks'] = $dir . 'api/FlaggedRevsApi.hooks.php';
322323 # OldReviewedPages for API
323324 $wgAutoloadClasses['ApiQueryOldreviewedpages'] = $dir . 'api/ApiQueryOldreviewedpages.php';
324325 $wgAPIListModules['oldreviewedpages'] = 'ApiQueryOldreviewedpages';
@@ -490,7 +491,7 @@
491492 $wgHooks['UnitTestsList'][] = 'FlaggedRevsHooks::getUnitTests';
492493
493494 # Database schema changes
494 -$wgHooks['LoadExtensionSchemaUpdates'][] = 'FlaggedRevsHooks::addSchemaUpdates';
 495+$wgHooks['LoadExtensionSchemaUpdates'][] = 'FlaggedRevsUpdaterHooks::addSchemaUpdates';
495496
496497 # Performance Don't show content on diff
497498 $wgHooks['ArticleContentOnDiff'][] = 'FlaggedRevsHooks::onArticleContentOnDiff';
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1860,63 +1860,4 @@
18611861 $tables[] = 'valid_tag'; // we need this core table
18621862 return true;
18631863 }
1864 -
1865 - public static function addSchemaUpdates( DatabaseUpdater $du ) {
1866 - global $wgDBtype;
1867 - $base = dirname( __FILE__ );
1868 - if ( $wgDBtype == 'mysql' ) {
1869 - // Initial install tables (current schema)
1870 - $du->addExtensionUpdate( array( 'addTable',
1871 - 'flaggedrevs', "$base/FlaggedRevs.sql", true ) );
1872 - // Updates (in order)...
1873 - $du->addExtensionUpdate( array( 'addField',
1874 - 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-fpc_expiry.sql", true ) );
1875 - $du->addExtensionUpdate( array( 'addIndex',
1876 - 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-expiry-index.sql", true ) );
1877 - $du->addExtensionUpdate( array( 'addTable',
1878 - 'flaggedrevs_promote', "$base/mysql/patch-flaggedrevs_promote.sql", true ) );
1879 - $du->addExtensionUpdate( array( 'addTable',
1880 - 'flaggedpages', "$base/mysql/patch-flaggedpages.sql", true ) );
1881 - $du->addExtensionUpdate( array( 'addField',
1882 - 'flaggedrevs', 'fr_img_name', "$base/mysql/patch-fr_img_name.sql", true ) );
1883 - $du->addExtensionUpdate( array( 'addTable',
1884 - 'flaggedrevs_tracking', "$base/mysql/patch-flaggedrevs_tracking.sql", true ) );
1885 - $du->addExtensionUpdate( array( 'addField',
1886 - 'flaggedpages', 'fp_pending_since', "$base/mysql/patch-fp_pending_since.sql", true ) );
1887 - $du->addExtensionUpdate( array( 'addField',
1888 - 'flaggedpage_config', 'fpc_level', "$base/mysql/patch-fpc_level.sql", true ) );
1889 - $du->addExtensionUpdate( array( 'addTable',
1890 - 'flaggedpage_pending', "$base/mysql/patch-flaggedpage_pending.sql", true ) );
1891 - $du->addExtensionUpdate( array( 'addTable',
1892 - 'flaggedrevs_stats', "$base/mysql/patch-flaggedrevs_stats.sql", true ) );
1893 - } elseif ( $wgDBtype == 'postgres' ) {
1894 - // Initial install tables (current schema)
1895 - $du->addExtensionUpdate( array( 'addTable',
1896 - 'flaggedrevs', "$base/FlaggedRevs.pg.sql", true ) );
1897 - // Updates (in order)...
1898 - $du->addExtensionUpdate( array( 'addField',
1899 - 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ) );
1900 - $du->addExtensionUpdate( array( 'addIndex',
1901 - 'flaggedpage_config', 'fpc_expiry', "$base/postgres/patch-expiry-index.sql", true ) );
1902 - $du->addExtensionUpdate( array( 'addTable',
1903 - 'flaggedrevs_promote', "$base/postgres/patch-flaggedrevs_promote.sql", true ) );
1904 - $du->addExtensionUpdate( array( 'addTable',
1905 - 'flaggedpages', "$base/postgres/patch-flaggedpages.sql", true ) );
1906 - $du->addExtensionUpdate( array( 'addIndex',
1907 - 'flaggedrevs', 'fr_img_sha1', "$base/postgres/patch-fr_img_name.sql", true ) );
1908 - $du->addExtensionUpdate( array( 'addTable',
1909 - 'flaggedrevs_tracking', "$base/postgres/patch-flaggedrevs_tracking.sql", true ) );
1910 - $du->addExtensionUpdate( array( 'addIndex',
1911 - 'flaggedpages', 'fp_pending_since', "$base/postgres/patch-fp_pending_since.sql", true ) );
1912 - $du->addExtensionUpdate( array( 'addField',
1913 - 'flaggedpage_config', 'fpc_level', "TEXT NULL" ) );
1914 - $du->addExtensionUpdate( array( 'addTable',
1915 - 'flaggedpage_pending', "$base/postgres/patch-flaggedpage_pending.sql", true ) );
1916 - // @TODO: PG stats table???
1917 - } elseif ( $wgDBtype == 'sqlite' ) {
1918 - $du->addExtensionUpdate( array( 'addTable',
1919 - 'flaggedrevs', "$base/FlaggedRevs.sql", true ) );
1920 - }
1921 - return true;
1922 - }
19231864 }
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-expiry-index.sql
@@ -0,0 +1,4 @@
 2+-- Add expiration column index
 3+
 4+ALTER TABLE /*$wgDBprefix*/flaggedpage_config
 5+ ADD INDEX (fpc_expiry);
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-expiry-index.sql
___________________________________________________________________
Added: svn:eol-style
16 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/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 unsigned 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/updater/mysql/patch-flaggedrevs_stats.sql
___________________________________________________________________
Added: svn:eol-style
116 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-fpc_expiry.sql
@@ -0,0 +1,4 @@
 2+-- Add expiration column
 3+
 4+ALTER TABLE /*$wgDBprefix*/flaggedpage_config
 5+ ADD fpc_expiry varbinary(14) NOT NULL default 'infinity';
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-fpc_expiry.sql
___________________________________________________________________
Added: svn:eol-style
16 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedpages.sql
@@ -0,0 +1,24 @@
 2+-- Add page metadata for flaggedrevs
 3+CREATE TABLE /*$wgDBprefix*/flaggedpages (
 4+ -- Foreign key to page.page_id
 5+ fp_page_id integer unsigned NOT NULL,
 6+ -- Is the page reviewed up to date?
 7+ fp_reviewed bool NOT NULL default '0',
 8+ -- Foreign key to flaggedrevs.fr_rev_id
 9+ fp_stable integer unsigned NOT NULL,
 10+ -- The highest quality of the page's reviewed revisions.
 11+ -- Note that this may not be set to display by default though.
 12+ fp_quality tinyint(1) default NULL,
 13+
 14+ PRIMARY KEY (fp_page_id),
 15+ INDEX fp_reviewed_page (fp_reviewed,fp_page_id),
 16+ INDEX fp_quality_page (fp_quality,fp_page_id)
 17+) /*$wgDBTableOptions*/;
 18+
 19+-- Migrate old page_ext hacks over
 20+INSERT INTO /*$wgDBprefix*/flaggedpages (fp_page_id,fp_reviewed,fp_stable,fp_quality)
 21+SELECT page_id,page_ext_reviewed,page_ext_stable,page_ext_quality FROM /*$wgDBprefix*/page
 22+WHERE page_ext_stable IS NOT NULL;
 23+
 24+-- Leave the old fields for now
 25+ALTER TABLE /*$wgDBprefix*/page DROP INDEX ext_namespace_reviewed;
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedpages.sql
___________________________________________________________________
Added: svn:eol-style
126 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedpage_pending.sql
@@ -0,0 +1,15 @@
 2+-- Add tracking table for edits needing review (for all levels)
 3+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpage_pending (
 4+ -- Foreign key to page.page_id
 5+ fpp_page_id integer unsigned NOT NULL,
 6+ -- The quality tier (0=stable, 1=quality, 2=pristine)
 7+ fpp_quality tinyint(1) NOT NULL,
 8+ -- The last rev ID with this quality
 9+ fpp_rev_id integer unsigned NOT NULL,
 10+ -- Time (or NULL) of the first edit after the last revision reviewed to this level
 11+ fpp_pending_since varbinary(14) NOT NULL,
 12+
 13+ PRIMARY KEY (fpp_page_id,fpp_quality),
 14+ INDEX fpp_quality_pending (fpp_quality,fpp_pending_since)
 15+) /*$wgDBTableOptions*/;
 16+
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedpage_pending.sql
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-fp_pending_since.sql
@@ -0,0 +1,4 @@
 2+-- Add timestamp column of first unreviewed rev for flaggedrevs
 3+ALTER TABLE /*$wgDBprefix*/flaggedpages
 4+ ADD fp_pending_since varbinary(14) NULL,
 5+ ADD INDEX fp_pending_since (fp_pending_since);
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-fp_pending_since.sql
___________________________________________________________________
Added: svn:eol-style
16 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedrevs_tracking.sql
@@ -0,0 +1,8 @@
 2+-- Track includes/links only in stable versions
 3+CREATE TABLE /*$wgDBprefix*/flaggedrevs_tracking (
 4+ ftr_from integer unsigned NOT NULL default '0',
 5+ ftr_namespace int NOT NULL default '0',
 6+ ftr_title varchar(255) binary NOT NULL default '',
 7+ PRIMARY KEY (ftr_from,ftr_namespace,ftr_title),
 8+ INDEX namespace_title_from (ftr_namespace,ftr_title,ftr_from)
 9+) /*$wgDBTableOptions*/;
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedrevs_tracking.sql
___________________________________________________________________
Added: svn:eol-style
110 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-fi_img_timestamp.sql
@@ -0,0 +1,6 @@
 2+-- Fix bad fi_img_timestamp definition
 3+ALTER TABLE /*$wgDBprefix*/flaggedimages
 4+ CHANGE fi_img_timestamp fi_img_timestamp varbinary(14) NULL;
 5+-- Move bad values over to NULL
 6+UPDATE /*$wgDBprefix*/flaggedimages
 7+ SET fi_img_timestamp = NULL WHERE LOCATE( '\0', fi_img_timestamp );
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-fi_img_timestamp.sql
___________________________________________________________________
Added: svn:eol-style
18 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedrevs_promote.sql
@@ -0,0 +1,9 @@
 2+-- This stores user demotions and stats
 3+CREATE TABLE /*$wgDBprefix*/flaggedrevs_promote (
 4+ -- Foreign key to user.user_id
 5+ frp_user_id integer unsigned NOT NULL,
 6+ frp_user_params mediumblob NOT NULL default '',
 7+
 8+ PRIMARY KEY (frp_user_id)
 9+) /*$wgDBTableOptions*/;
 10+
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-flaggedrevs_promote.sql
___________________________________________________________________
Added: svn:eol-style
111 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-fpc_level.sql
@@ -0,0 +1,3 @@
 2+-- The protection level (Sysop, autoconfirmed, etc) for autoreview
 3+ALTER TABLE /*$wgDBprefix*/flaggedpage_config
 4+ ADD fpc_level varbinary(60) NULL;
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-fpc_level.sql
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: trunk/extensions/FlaggedRevs/updater/mysql/patch-fr_img_name.sql
@@ -0,0 +1,9 @@
 2+-- Add file metadata for flaggedrevs of image pages
 3+ALTER TABLE /*$wgDBprefix*/flaggedrevs
 4+ -- Name of included image
 5+ ADD fr_img_name varchar(255) binary NULL default NULL,
 6+ -- Timestamp of file (when uploaded)
 7+ ADD fr_img_timestamp varbinary(14) NULL default NULL,
 8+ -- Statistically unique SHA-1 key
 9+ ADD fr_img_sha1 varbinary(32) NULL default NULL,
 10+ ADD INDEX fr_img_sha1 (fr_img_sha1);
Property changes on: trunk/extensions/FlaggedRevs/updater/mysql/patch-fr_img_name.sql
___________________________________________________________________
Added: svn:eol-style
111 + native
Index: trunk/extensions/FlaggedRevs/updater/FlaggedRevsUpdater.hooks.php
@@ -0,0 +1,83 @@
 2+<?php
 3+if ( !defined( 'MEDIAWIKI' ) ) {
 4+ echo "FlaggedRevs extension\n";
 5+ exit( 1 );
 6+}
 7+/**
 8+ * Class containing updater functions for a FlaggedRevs environment
 9+ */
 10+class FlaggedRevsUpdaterHooks {
 11+ public static function addSchemaUpdates( DatabaseUpdater $du ) {
 12+ global $wgDBtype;
 13+ $base = dirname( __FILE__ );
 14+ if ( $wgDBtype == 'mysql' ) {
 15+ // Initial install tables (current schema)
 16+ $du->addExtensionUpdate( array( 'addTable',
 17+ 'flaggedrevs', "$base/FlaggedRevs.sql", true ) );
 18+ // Updates (in order)...
 19+ $du->addExtensionUpdate( array( 'addField',
 20+ 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-fpc_expiry.sql", true ) );
 21+ $du->addExtensionUpdate( array( 'addIndex',
 22+ 'flaggedpage_config', 'fpc_expiry', "$base/mysql/patch-expiry-index.sql", true ) );
 23+ $du->addExtensionUpdate( array( 'addTable',
 24+ 'flaggedrevs_promote', "$base/mysql/patch-flaggedrevs_promote.sql", true ) );
 25+ $du->addExtensionUpdate( array( 'addTable',
 26+ 'flaggedpages', "$base/mysql/patch-flaggedpages.sql", true ) );
 27+ $du->addExtensionUpdate( array( 'addField',
 28+ 'flaggedrevs', 'fr_img_name', "$base/mysql/patch-fr_img_name.sql", true ) );
 29+ $du->addExtensionUpdate( array( 'addTable',
 30+ 'flaggedrevs_tracking', "$base/mysql/patch-flaggedrevs_tracking.sql", true ) );
 31+ $du->addExtensionUpdate( array( 'addField',
 32+ 'flaggedpages', 'fp_pending_since', "$base/mysql/patch-fp_pending_since.sql", true ) );
 33+ $du->addExtensionUpdate( array( 'addField',
 34+ 'flaggedpage_config', 'fpc_level', "$base/mysql/patch-fpc_level.sql", true ) );
 35+ $du->addExtensionUpdate( array( 'addTable',
 36+ 'flaggedpage_pending', "$base/mysql/patch-flaggedpage_pending.sql", true ) );
 37+ $du->addExtensionUpdate( array( 'addTable',
 38+ 'flaggedrevs_stats', "$base/mysql/patch-flaggedrevs_stats.sql", true ) );
 39+ $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedImagesTimestampNULL',
 40+ "$base/mysql/patch-fi_img_timestamp.sql" ) );
 41+ } elseif ( $wgDBtype == 'postgres' ) {
 42+ // Initial install tables (current schema)
 43+ $du->addExtensionUpdate( array( 'addTable',
 44+ 'flaggedrevs', "$base/FlaggedRevs.pg.sql", true ) );
 45+ // Updates (in order)...
 46+ $du->addExtensionUpdate( array( 'addField',
 47+ 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ) );
 48+ $du->addExtensionUpdate( array( 'addIndex',
 49+ 'flaggedpage_config', 'fpc_expiry', "$base/postgres/patch-expiry-index.sql", true ) );
 50+ $du->addExtensionUpdate( array( 'addTable',
 51+ 'flaggedrevs_promote', "$base/postgres/patch-flaggedrevs_promote.sql", true ) );
 52+ $du->addExtensionUpdate( array( 'addTable',
 53+ 'flaggedpages', "$base/postgres/patch-flaggedpages.sql", true ) );
 54+ $du->addExtensionUpdate( array( 'addIndex',
 55+ 'flaggedrevs', 'fr_img_sha1', "$base/postgres/patch-fr_img_name.sql", true ) );
 56+ $du->addExtensionUpdate( array( 'addTable',
 57+ 'flaggedrevs_tracking', "$base/postgres/patch-flaggedrevs_tracking.sql", true ) );
 58+ $du->addExtensionUpdate( array( 'addIndex',
 59+ 'flaggedpages', 'fp_pending_since', "$base/postgres/patch-fp_pending_since.sql", true ) );
 60+ $du->addExtensionUpdate( array( 'addField',
 61+ 'flaggedpage_config', 'fpc_level', "TEXT NULL" ) );
 62+ $du->addExtensionUpdate( array( 'addTable',
 63+ 'flaggedpage_pending', "$base/postgres/patch-flaggedpage_pending.sql", true ) );
 64+ // @TODO: PG stats table???
 65+ $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedImagesTimestampNULL',
 66+ "$base/postgres/patch-fi_img_timestamp.sql" ) );
 67+ } elseif ( $wgDBtype == 'sqlite' ) {
 68+ $du->addExtensionUpdate( array( 'addTable',
 69+ 'flaggedrevs', "$base/FlaggedRevs.sql", true ) );
 70+ }
 71+ return true;
 72+ }
 73+
 74+ public static function doFlaggedImagesTimestampNULL( $du, $patch ) {
 75+ $info = $du->getDB()->fieldInfo( 'flaggedimages', 'fi_img_timestamp' );
 76+ if ( $info->isNullable() ) {
 77+ $du->output( "...fi_img_timestamp is already nullable.\n" );
 78+ return;
 79+ }
 80+ $du->output( "Making fi_img_timestamp nullable... " );
 81+ $du->getDB()->sourceFile( $patch );
 82+ $du->output( "done.\n" );
 83+ }
 84+}
Property changes on: trunk/extensions/FlaggedRevs/updater/FlaggedRevsUpdater.hooks.php
___________________________________________________________________
Added: svn:eol-style
185 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-expiry-index.sql
@@ -0,0 +1,3 @@
 2+-- Add expiration column index
 3+
 4+CREATE INDEX fpc_expiry ON flaggedpage_config (fpc_expiry);
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-expiry-index.sql
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-reader_feedback.sql
@@ -0,0 +1,31 @@
 2+
 3+BEGIN;
 4+
 5+CREATE TABLE reader_feedback (
 6+ rfb_rev_id INTEGER NOT NULL DEFAULT 0,
 7+ rfb_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE SET NULL,
 8+ rfb_ip TEXT NOT NULL DEFAULT '',
 9+ PRIMARY KEY (rfb_rev_id,rfb_user,rfb_ip)
 10+);
 11+
 12+CREATE TABLE reader_feedback_history (
 13+ rfh_page_id INTEGER NOT NULL DEFAULT 0,
 14+ rfh_tag TEXT NOT NULL DEFAULT '',
 15+ rfh_total INTEGER NOT NULL DEFAULT 0,
 16+ rfh_count INTEGER NOT NULL DEFAULT 0,
 17+ -- MW date of the day this average corresponds to
 18+ rfh_date TEXT NOT NULL DEFAULT '',
 19+ PRIMARY KEY (rfh_page_id,rfh_tag,rfh_date)
 20+);
 21+
 22+CREATE TABLE reader_feedback_pages (
 23+ rfp_page_id INTEGER NOT NULL DEFAULT 0,
 24+ rfp_tag TEXT NOT NULL DEFAULT '',
 25+ rfp_ave_val REAL NOT NULL DEFAULT 0,
 26+ rfp_count INTEGER NOT NULL DEFAULT 0,
 27+ rfp_touched TIMESTAMPTZ NULL,
 28+ PRIMARY KEY (rfp_page_id,rfp_tag)
 29+);
 30+CREATE INDEX rfp_tag_val_page ON reader_feedback_pages (rfp_tag,rfp_ave_val,rfp_page_id)
 31+
 32+COMMIT;
\ No newline at end of file
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-reader_feedback.sql
___________________________________________________________________
Added: svn:eol-style
133 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedpages.sql
@@ -0,0 +1,20 @@
 2+BEGIN;
 3+
 4+CREATE TABLE flaggedpages (
 5+ fp_page_id BIGINT NOT NULL DEFAULT 0,
 6+ fp_reviewed INTEGER NOT NULL DEFAULT 0,
 7+ fp_stable BIGINT NOT NULL DEFAULT 0,
 8+ fp_quality INTEGER default NULL,
 9+ PRIMARY KEY (fp_page_id)
 10+);
 11+CREATE INDEX fp_reviewed_page ON flaggedpages (fp_reviewed,fp_page_id),
 12+CREATE INDEX fp_quality_page ON flaggedpages (fp_quality,fp_page_id)
 13+
 14+-- Migrate old page_ext hacks over
 15+INSERT INTO /*$wgDBprefix*/flaggedpages (fp_page_id,fp_reviewed,fp_stable,fp_quality)
 16+SELECT page_id,page_ext_reviewed,page_ext_stable,page_ext_quality FROM /*$wgDBprefix*/page
 17+WHERE page_ext_stable IS NOT NULL;
 18+
 19+-- Leave the old fields and indexes for now
 20+
 21+COMMIT;
\ No newline at end of file
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedpages.sql
___________________________________________________________________
Added: svn:eol-style
122 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedpage_pending.sql
@@ -0,0 +1,12 @@
 2+BEGIN;
 3+
 4+CREATE TABLE flaggedpage_pending (
 5+ fpp_page_id BIGINT NOT NULL,
 6+ fpp_quality INTEGER NOT NULL,
 7+ fpp_rev_id BIGINT NOT NULL,
 8+ fpp_pending_since TIMESTAMPTZ NULL,
 9+ PRIMARY KEY (fpp_page_id,fpp_quality)
 10+);
 11+CREATE INDEX fpp_quality_pending ON flaggedpage_pending (fpp_quality,fpp_pending_since);
 12+
 13+COMMIT;
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedpage_pending.sql
___________________________________________________________________
Added: svn:eol-style
114 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-fp_pending_since.sql
@@ -0,0 +1,8 @@
 2+BEGIN;
 3+
 4+ALTER TABLE flaggedpages
 5+ ADD fp_pending_since TIMESTAMPTZ NULL;
 6+
 7+CREATE INDEX fp_pending_since ON flaggedpages (fp_pending_since);
 8+
 9+COMMIT;
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-fp_pending_since.sql
___________________________________________________________________
Added: svn:eol-style
110 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedrevs_tracking.sql
@@ -0,0 +1,11 @@
 2+BEGIN;
 3+
 4+CREATE TABLE flaggedrevs_tracking (
 5+ ftr_from INTEGER NOT NULL DEFAULT 0,
 6+ ftr_namespace SMALLINT NOT NULL DEFAULT 0,
 7+ ftr_title TEXT NOT NULL DEFAULT '',
 8+ PRIMARY KEY (ftr_from,ftr_namespace,ftr_title)
 9+);
 10+CREATE INDEX namespace_title_from ON flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from)
 11+
 12+COMMIT;
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedrevs_tracking.sql
___________________________________________________________________
Added: svn:eol-style
113 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-fi_img_timestamp.sql
@@ -0,0 +1,6 @@
 2+BEGIN;
 3+
 4+ALTER TABLE flaggedimages
 5+ CHANGE fi_img_timestamp fi_img_timestamp TIMESTAMPTZ NULL;
 6+
 7+COMMIT;
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-fi_img_timestamp.sql
___________________________________________________________________
Added: svn:eol-style
18 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedrevs_promote.sql
@@ -0,0 +1,9 @@
 2+
 3+BEGIN;
 4+
 5+CREATE TABLE flaggedrevs_promote (
 6+ frp_user_id INTEGER NOT NULL PRIMARY KEY default 0,
 7+ frp_user_params TEXT NOT NULL default ''
 8+);
 9+
 10+COMMIT;
\ No newline at end of file
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-flaggedrevs_promote.sql
___________________________________________________________________
Added: svn:eol-style
111 + native
Index: trunk/extensions/FlaggedRevs/updater/postgres/patch-fr_img_name.sql
@@ -0,0 +1,16 @@
 2+BEGIN;
 3+
 4+ALTER TABLE flaggedrevs
 5+ -- Name of included image
 6+ ADD fr_img_name TEXT NULL default NULL,
 7+ -- Timestamp of file (when uploaded)
 8+ ADD fr_img_timestamp TIMESTAMPTZ NULL default NULL,
 9+ -- Statistically unique SHA-1 key
 10+ ADD fr_img_sha1 TEXT NULL default NULL;
 11+
 12+CREATE INDEX fr_img_sha1 ON flaggedrevs (fr_img_sha1);
 13+
 14+DROP INDEX fr_namespace_title;
 15+CREATE INDEX page_qal_rev ON flaggedrevs (fr_page_id,fr_quality,fr_rev_id);
 16+
 17+COMMIT;
Property changes on: trunk/extensions/FlaggedRevs/updater/postgres/patch-fr_img_name.sql
___________________________________________________________________
Added: svn:eol-style
118 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r86018* Renamed /updater to /schema and moved main sql files there...aaron00:29, 14 April 2011

Status & tagging log