r104716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104715‎ | r104716 | r104717 >
Date:18:56, 30 November 2011
Author:reedy
Status:ok
Tags:
Comment:
Merge r103033 from REL1_18 to fix fatal on fixExtLinksProtocolRelative from r103056
Modified paths:
  • /branches/wmf/1.18wmf1 (modified) (history)
  • /branches/wmf/1.18wmf1/includes (modified) (history)
  • /branches/wmf/1.18wmf1/includes/AutoLoader.php (modified) (history)
  • /branches/wmf/1.18wmf1/maintenance/Maintenance.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/maintenance/Maintenance.php
@@ -1263,3 +1263,71 @@
12641264 return;
12651265 }
12661266 }
 1267+
 1268+/**
 1269+ * Class for scripts that perform database maintenance and want to log the
 1270+ * update in `updatelog` so we can later skip it
 1271+ */
 1272+abstract class LoggedUpdateMaintenance extends Maintenance {
 1273+ public function __construct() {
 1274+ parent::__construct();
 1275+ $this->addOption( 'force', 'Run the update even if it was completed already' );
 1276+ $this->setBatchSize( 200 );
 1277+ }
 1278+
 1279+ public function execute() {
 1280+ $db = $this->getDB( DB_MASTER );
 1281+ $key = $this->getUpdateKey();
 1282+
 1283+ if ( !$this->hasOption( 'force' ) &&
 1284+ $db->selectRow( 'updatelog', '1', array( 'ul_key' => $key ), __METHOD__ ) )
 1285+ {
 1286+ $this->output( "..." . $this->updateSkippedMessage() . "\n" );
 1287+ return true;
 1288+ }
 1289+
 1290+ if ( !$this->doDBUpdates() ) {
 1291+ return false;
 1292+ }
 1293+
 1294+ if (
 1295+ $db->insert( 'updatelog', array( 'ul_key' => $key ), __METHOD__, 'IGNORE' ) )
 1296+ {
 1297+ return true;
 1298+ } else {
 1299+ $this->output( $this->updatelogFailedMessage() . "\n" );
 1300+ return false;
 1301+ }
 1302+ }
 1303+
 1304+ /**
 1305+ * Message to show that the update was done already and was just skipped
 1306+ * @return String
 1307+ */
 1308+ protected function updateSkippedMessage() {
 1309+ $key = $this->getUpdateKey();
 1310+ return "Update '{$key}' already logged as completed.";
 1311+ }
 1312+
 1313+ /**
 1314+ * Message to show the the update log was unable to log the completion of this update
 1315+ * @return String
 1316+ */
 1317+ protected function updatelogFailedMessage() {
 1318+ $key = $this->getUpdateKey();
 1319+ return "Unable to log update '{$key}' as completed.";
 1320+ }
 1321+
 1322+ /**
 1323+ * Do the actual work. All child classes will need to implement this.
 1324+ * Return true to log the update as done or false (usually on failure).
 1325+ * @return Bool
 1326+ */
 1327+ abstract protected function doDBUpdates();
 1328+
 1329+ /**
 1330+ * Get the update key name to go in the update log table
 1331+ * @return String
 1332+ */
 1333+ abstract protected function getUpdateKey();
 1334+}
\ No newline at end of file
Index: branches/wmf/1.18wmf1/includes/AutoLoader.php
@@ -828,6 +828,7 @@
829829 'DeleteArchivedRevisionsImplementation' => 'maintenance/deleteArchivedRevisions.inc',
830830 'DeleteDefaultMessages' => 'maintenance/deleteDefaultMessages.php',
831831 'FakeMaintenance' => 'maintenance/Maintenance.php',
 832+ 'LoggedUpdateMaintenance' => 'maintenance/Maintenance.php',
832833 'Maintenance' => 'maintenance/Maintenance.php',
833834 'FixExtLinksProtocolRelative' => 'maintenance/fixExtLinksProtocolRelative.php',
834835 'PopulateCategory' => 'maintenance/populateCategory.php',
Property changes on: branches/wmf/1.18wmf1/includes/AutoLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
835836 Merged /branches/REL1_18/phase3/includes/AutoLoader.php:r103033
Property changes on: branches/wmf/1.18wmf1/includes
___________________________________________________________________
Modified: svn:mergeinfo
836837 Merged /branches/REL1_18/phase3/includes:r103033
Property changes on: branches/wmf/1.18wmf1
___________________________________________________________________
Modified: svn:mergeinfo
837838 Merged /branches/REL1_18/phase3:r103033

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103033REL1_18 Partial manual merge of r94370, r94382, r96578, r101019 to bring Logg...reedy21:20, 14 November 2011
r103056MFT r102951, r102954reedy22:40, 14 November 2011

Status & tagging log