r114124 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114123‎ | r114124 | r114125 >
Date:09:50, 19 March 2012
Author:tstarling
Status:ok
Tags:
Comment:
During update, defer creation of the AbuseFilter user until after the core updates have run, so that you don't get "Table 'user_properties' doesn't exist" etc.
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
@@ -321,11 +321,17 @@
322322 $updater->addExtensionUpdate( array( 'addPgField', 'abuse_filter_log', 'afl_deleted', 'SMALLINT' ) );
323323 $updater->addExtensionUpdate( array( 'changeField', 'abuse_filter_log', 'afl_filter', 'TEXT' ) );
324324 $updater->addExtensionUpdate( array( 'addPgExtIndex', 'abuse_filter_log', 'abuse_filter_log_ip', "(afl_ip)" ) );
325 - } else {
326 - throw new MWException("No known Schema updates.");
327325 }
328326
329 - // Create the Abuse Filter user.
 327+ $updater->addExtensionUpdate( array( array( __CLASS__, 'createAbuseFilterUser' ) ) );
 328+
 329+ return true;
 330+ }
 331+
 332+ /**
 333+ * Updater callback to create the AbuseFilter user after the user tables have been updated.
 334+ */
 335+ public static function createAbuseFilterUser( $updater ) {
330336 $user = User::newFromName( wfMsgForContent( 'abusefilter-blocker' ) );
331337
332338 if ( $user && !$updater->updateRowExists( 'create abusefilter-blocker-user' ) ) {
@@ -345,8 +351,6 @@
346352 # Promote user so it doesn't look too crazy.
347353 $user->addGroup( 'sysop' );
348354 }
349 -
350 - return true;
351355 }
352356
353357 /**

Status & tagging log