Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -377,6 +377,9 @@ |
378 | 378 | // URL for alternative uploading form |
379 | 379 | 'altUploadForm' => '', |
380 | 380 | |
| 381 | + // Is titleBlacklist API even available? |
| 382 | + 'useTitleBlacklistApi' => array_key_exists( 'titleblacklist', $wgAPIModules ), |
| 383 | + |
381 | 384 | // Wiki page for reporting issues with the blacklist |
382 | 385 | 'blacklistIssuesPage' => '', |
383 | 386 | |
Index: trunk/extensions/UploadWizard/resources/mw.DestinationChecker.js |
— | — | @@ -150,8 +150,12 @@ |
151 | 151 | callback( { 'blacklist': _this.cachedBlacklist[title] } ); |
152 | 152 | return; |
153 | 153 | } |
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 ) { |
156 | 160 | var result; |
157 | 161 | |
158 | 162 | if( blacklistResult === false ) { |
— | — | @@ -167,7 +171,14 @@ |
168 | 172 | |
169 | 173 | _this.cachedBlacklist[title] = result; |
170 | 174 | 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 | + } |
172 | 183 | }, |
173 | 184 | |
174 | 185 | /** |