r95044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95043‎ | r95044 | r95045 >
Date:21:44, 19 August 2011
Author:neilk
Status:ok
Tags:
Comment:
if TitleBlacklistAPI is not available, then every title has the status "not blacklisted"
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.config.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.config.php
@@ -377,6 +377,9 @@
378378 // URL for alternative uploading form
379379 'altUploadForm' => '',
380380
 381+ // Is titleBlacklist API even available?
 382+ 'useTitleBlacklistApi' => array_key_exists( 'titleblacklist', $wgAPIModules ),
 383+
381384 // Wiki page for reporting issues with the blacklist
382385 'blacklistIssuesPage' => '',
383386
Index: trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js
@@ -150,8 +150,12 @@
151151 callback( { 'blacklist': _this.cachedBlacklist[title] } );
152152 return;
153153 }
154 -
155 - _this.api.isBlacklisted( title, function( blacklistResult ) {
 154+
 155+ /**
 156+ * Processes result of a TitleBlacklist api call with callback()
 157+ * @param mixed - false if not blacklisted, object if blacklisted
 158+ */
 159+ var blacklistResultProcessor = function( blacklistResult ) {
156160 var result;
157161
158162 if( blacklistResult === false ) {
@@ -167,7 +171,14 @@
168172
169173 _this.cachedBlacklist[title] = result;
170174 callback( { 'blacklist': result } );
171 - } );
 175+ };
 176+
 177+ if ( UploadWizardConfig.useTitleBlacklistApi ) {
 178+ _this.api.isBlacklisted( title, blacklistResultProcessor );
 179+ } else {
 180+ // it's not blacklisted, because the API isn't even available
 181+ blacklistResultProcessor( false );
 182+ }
172183 },
173184
174185 /**

Status & tagging log