r102852 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102851‎ | r102852 | r102853 >
Date:10:04, 12 November 2011
Author:catrope
Status:ok
Tags:
Comment:
[RL2] In the spirit of r102850, also add populateGadgetPageList.php to the updaters and make sure it's only run once
Modified paths:
  • /branches/RL2/extensions/Gadgets/Gadgets.hooks.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/Gadgets.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/populateGadgetPageList.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/Gadgets.php
@@ -141,6 +141,7 @@
142142 $wgAutoloadClasses['GadgetPrefs'] = $dir . 'backend/GadgetPrefs.php';
143143 $wgAutoloadClasses['LocalGadgetRepo'] = $dir . 'backend/LocalGadgetRepo.php';
144144 $wgAutoloadClasses['MigrateGadgets'] = $dir . 'migrateGadgets.php';
 145+$wgAutoloadClasses['PopulateGadgetPageList'] = $dir . 'populateGadgetPageList.php';
145146 $wgAutoloadClasses['SpecialGadgets'] = $dir . 'SpecialGadgets.php';
146147
147148 $wgSpecialPages['Gadgets'] = 'SpecialGadgets';
Index: branches/RL2/extensions/Gadgets/populateGadgetPageList.php
@@ -1,12 +1,14 @@
22 <?php
3 -
4 -$IP = getenv( 'MW_INSTALL_PATH' );
5 -if ( $IP === false ) {
6 - $IP = dirname( __FILE__ ) . '/../..';
 3+// Prevent unnecessary path errors when run from update.php
 4+if ( !class_exists( 'Maintenance' ) ) {
 5+ $IP = getenv( 'MW_INSTALL_PATH' );
 6+ if ( $IP === false ) {
 7+ $IP = dirname( __FILE__ ) . '/../..';
 8+ }
 9+ require( "$IP/maintenance/Maintenance.php" );
710 }
8 -require( "$IP/maintenance/Maintenance.php" );
911
10 -class PopulateGadgetPageList extends Maintenance {
 12+class PopulateGadgetPageList extends LoggedUpdateMaintenance {
1113 const BATCH_SIZE = 100;
1214
1315 public function __construct() {
@@ -14,7 +16,15 @@
1517 $this->mDescription = "Populates the gadgetpagelist table";
1618 }
1719
18 - public function execute() {
 20+ protected function getUpdateKey() {
 21+ return 'populate gadgetpagelist';
 22+ }
 23+
 24+ protected function updateSkippedMessage() {
 25+ return 'gadgetpagelist table already populated.';
 26+ }
 27+
 28+ protected function doDBUpdates() {
1929 $dbr = wfGetDB( DB_SLAVE );
2030 $dbw = wfGetDB( DB_MASTER );
2131
@@ -55,6 +65,7 @@
5666 }
5767
5868 $this->output( "Done\n" );
 69+ return true;
5970 }
6071 }
6172
Index: branches/RL2/extensions/Gadgets/Gadgets.hooks.php
@@ -416,6 +416,7 @@
417417 $updater->addExtensionUpdate( array( 'addtable', 'gadgets', "$dir/sql/gadgets.sql", true ) );
418418 $updater->addExtensionUpdate( array( 'addtable', 'gadgetpagelist', "$dir/sql/patch-gadgetpagelist.sql", true ) );
419419 $updater->addPostDatabaseUpdateMaintenance( 'MigrateGadgets' );
 420+ $updater->addPostDatabaseUpdateMaintenance( 'PopulateGadgetPageList' );
420421 return true;
421422 }
422423

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102850[RL2] Followup r102817: make the migration script inherit LoggedUpdateMainten...catrope09:56, 12 November 2011

Status & tagging log