Index: branches/RL2/extensions/Gadgets/Gadgets.php |
— | — | @@ -141,6 +141,7 @@ |
142 | 142 | $wgAutoloadClasses['GadgetPrefs'] = $dir . 'backend/GadgetPrefs.php'; |
143 | 143 | $wgAutoloadClasses['LocalGadgetRepo'] = $dir . 'backend/LocalGadgetRepo.php'; |
144 | 144 | $wgAutoloadClasses['MigrateGadgets'] = $dir . 'migrateGadgets.php'; |
| 145 | +$wgAutoloadClasses['PopulateGadgetPageList'] = $dir . 'populateGadgetPageList.php'; |
145 | 146 | $wgAutoloadClasses['SpecialGadgets'] = $dir . 'SpecialGadgets.php'; |
146 | 147 | |
147 | 148 | $wgSpecialPages['Gadgets'] = 'SpecialGadgets'; |
Index: branches/RL2/extensions/Gadgets/populateGadgetPageList.php |
— | — | @@ -1,12 +1,14 @@ |
2 | 2 | <?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" ); |
7 | 10 | } |
8 | | -require( "$IP/maintenance/Maintenance.php" ); |
9 | 11 | |
10 | | -class PopulateGadgetPageList extends Maintenance { |
| 12 | +class PopulateGadgetPageList extends LoggedUpdateMaintenance { |
11 | 13 | const BATCH_SIZE = 100; |
12 | 14 | |
13 | 15 | public function __construct() { |
— | — | @@ -14,7 +16,15 @@ |
15 | 17 | $this->mDescription = "Populates the gadgetpagelist table"; |
16 | 18 | } |
17 | 19 | |
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() { |
19 | 29 | $dbr = wfGetDB( DB_SLAVE ); |
20 | 30 | $dbw = wfGetDB( DB_MASTER ); |
21 | 31 | |
— | — | @@ -55,6 +65,7 @@ |
56 | 66 | } |
57 | 67 | |
58 | 68 | $this->output( "Done\n" ); |
| 69 | + return true; |
59 | 70 | } |
60 | 71 | } |
61 | 72 | |
Index: branches/RL2/extensions/Gadgets/Gadgets.hooks.php |
— | — | @@ -416,6 +416,7 @@ |
417 | 417 | $updater->addExtensionUpdate( array( 'addtable', 'gadgets', "$dir/sql/gadgets.sql", true ) ); |
418 | 418 | $updater->addExtensionUpdate( array( 'addtable', 'gadgetpagelist', "$dir/sql/patch-gadgetpagelist.sql", true ) ); |
419 | 419 | $updater->addPostDatabaseUpdateMaintenance( 'MigrateGadgets' ); |
| 420 | + $updater->addPostDatabaseUpdateMaintenance( 'PopulateGadgetPageList' ); |
420 | 421 | return true; |
421 | 422 | } |
422 | 423 | |