r86052 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86051‎ | r86052 | r86053 >
Date:14:39, 14 April 2011
Author:happy-melon
Status:deferred (Comments)
Tags:
Comment:
Polish off all special-page-by-global-function instances in extensions. The preferred syntax is now exclusively $wgSpecialPages['PageName'] = 'ClassExtendingSpecialPage', where that class has a constructor which calls SpecialPage::__construct('PageName').
Modified paths:
  • /trunk/extensions/Aggregator/Aggregator.php (modified) (history)
  • /trunk/extensions/ArticleComments/ArticleComments.php (modified) (history)
  • /trunk/extensions/CategoryBrowser/CategoryBrowser.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit_body.php (modified) (history)
  • /trunk/extensions/EditConflict/EditConflict.php (modified) (history)
  • /trunk/extensions/GetFamily/GetFamily.php (modified) (history)
  • /trunk/extensions/GoogleMaps/GoogleMaps.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/MogileClient/SpecialUploadMogile.php (modified) (history)
  • /trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber.php (modified) (history)
  • /trunk/extensions/QPoll/qp_user.php (modified) (history)
  • /trunk/extensions/Rdf/Rdf.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php (modified) (history)
  • /trunk/extensions/SemanticNotifyMe/includes/SNM_Initialize.php (modified) (history)
  • /trunk/extensions/Special404/Special404.php (modified) (history)
  • /trunk/extensions/SpecialFileList/SpecialFilelist.php (modified) (history)
  • /trunk/extensions/WikiSync/WikiSync.php (modified) (history)
  • /trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SpecialFileList/SpecialFilelist.php
@@ -22,7 +22,7 @@
2323 $dir = dirname(__FILE__) . '/';
2424 $wgExtensionMessagesFiles['Filelist'] = $dir . 'SpecialFilelist.i18n.php';
2525
26 -$wgSpecialPages[] = 'SpecialFilelist';
 26+$wgSpecialPages['Filelist'] = 'SpecialFilelist';
2727
2828 class SpecialFilelist extends SpecialPage {
2929
Index: trunk/extensions/uniwiki/CustomToolbar/CustomToolbar.php
@@ -78,12 +78,19 @@
7979
8080 }
8181
82 -$wgSpecialPages['CustomToolbarUpload'] = array( 'UnlistedSpecialPage', 'CustomToolbarUpload' );
 82+$wgSpecialPages['CustomToolbarUpload'] = 'SpecialCustomToolbarUpload';
8383
84 -function wfSpecialCustomToolbarUpload() {
85 - global $wgRequest;
86 - $form = new CustomToolbarUploadForm($wgRequest);
87 - $form->execute();
 84+class SpecialCustomToolbarUpload extends SpecialPage {
 85+
 86+ public function __construct(){
 87+ parent::__construct( 'CustomToolbarUpload' );
 88+ }
 89+
 90+ function execute() {
 91+ global $wgRequest;
 92+ $form = new CustomToolbarUploadForm($wgRequest);
 93+ $form->execute();
 94+ }
8895 }
8996 $wgHooks['UploadComplete'][] = array('CustomToolbarUploadForm::showSuccess');
9097 //XX TODO investigate FileUpload hook for attachment purposes
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SetupLight.php
@@ -196,50 +196,50 @@
197197 ///// Register specials, do that early on in case some other extension calls "addPage" /////
198198 $wgAutoloadClasses['SMWQueryPage'] = $smwgIP . 'specials/QueryPages/SMW_QueryPage.php';
199199 // $wgAutoloadClasses['SMWAskPage'] = $smwgIP . 'specials/AskSpecial/SMW_SpecialAsk.php';
200 -// $wgSpecialPages['Ask'] = array( 'SMWAskPage' );
 200+// $wgSpecialPages['Ask'] = 'SMWAskPage';
201201 // $wgSpecialPageGroups['Ask'] = 'smw_group';
202202
203203 $wgAutoloadClasses['SMWSpecialBrowse'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialBrowse.php';
204 - $wgSpecialPages['Browse'] = array( 'SMWSpecialBrowse' );
 204+ $wgSpecialPages['Browse'] = 'SMWSpecialBrowse';
205205 $wgSpecialPageGroups['Browse'] = 'smw_group';
206206
207207 $wgAutoloadClasses['SMWPageProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialPageProperty.php';
208 - $wgSpecialPages['PageProperty'] = array( 'SMWPageProperty' );
 208+ $wgSpecialPages['PageProperty'] = 'SMWPageProperty';
209209 $wgSpecialPageGroups['PageProperty'] = 'smw_group';
210210
211211 $wgAutoloadClasses['SMWSearchByProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialSearchByProperty.php';
212 - $wgSpecialPages['SearchByProperty'] = array( 'SMWSearchByProperty' );
 212+ $wgSpecialPages['SearchByProperty'] = 'SMWSearchByProperty';
213213 $wgSpecialPageGroups['SearchByProperty'] = 'smw_group';
214214
215215 // $wgAutoloadClasses['SMWURIResolver'] = $smwgIP . 'specials/URIResolver/SMW_SpecialURIResolver.php';
216 -// $wgSpecialPages['URIResolver'] = array( 'SMWURIResolver' );
 216+// $wgSpecialPages['URIResolver'] = 'SMWURIResolver';
217217
218218 $wgAutoloadClasses['SMWAdmin'] = $smwgIP . 'specials/SMWAdmin/SMW_SpecialSMWAdmin.php';
219 - $wgSpecialPages['SMWAdmin'] = array( 'SMWAdmin' );
 219+ $wgSpecialPages['SMWAdmin'] = 'SMWAdmin';
220220 $wgSpecialPageGroups['SMWAdmin'] = 'smw_group';
221221
222222 // $wgAutoloadClasses['SMWSpecialSemanticStatistics'] = $smwgIP . 'specials/Statistics/SMW_SpecialStatistics.php';
223 -// $wgSpecialPages['SemanticStatistics'] = array( 'SMWSpecialSemanticStatistics' );
 223+// $wgSpecialPages['SemanticStatistics'] = 'SMWSpecialSemanticStatistics';
224224 // $wgSpecialPageGroups['SemanticStatistics'] = 'wiki'; // Similar to Special:Statistics
225225 //
226226 // $wgAutoloadClasses['SMWSpecialOWLExport'] = $smwgIP . 'specials/Export/SMW_SpecialOWLExport.php';
227 -// $wgSpecialPages['ExportRDF'] = array( 'SMWSpecialOWLExport' );
 227+// $wgSpecialPages['ExportRDF'] = 'SMWSpecialOWLExport';
228228 // $wgSpecialPageGroups['ExportRDF'] = 'smw_group';
229229 //
230230 // $wgAutoloadClasses['SMWSpecialProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialProperties.php';
231 -// $wgSpecialPages['Properties'] = array( 'SMWSpecialProperties' );
 231+// $wgSpecialPages['Properties'] = 'SMWSpecialProperties';
232232 // $wgSpecialPageGroups['Properties'] = 'pages';
233233 //
234234 // $wgAutoloadClasses['SMWSpecialTypes'] = $smwgIP . 'specials/QueryPages/SMW_SpecialTypes.php';
235 -// $wgSpecialPages['Types'] = array( 'SMWSpecialTypes' );
 235+// $wgSpecialPages['Types'] = 'SMWSpecialTypes';
236236 // $wgSpecialPageGroups['Types'] = 'pages';
237237 //
238238 // $wgAutoloadClasses['SMWSpecialUnusedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialUnusedProperties.php';
239 -// $wgSpecialPages['UnusedProperties'] = array( 'SMWSpecialUnusedProperties' );
 239+// $wgSpecialPages['UnusedProperties'] = 'SMWSpecialUnusedProperties';
240240 // $wgSpecialPageGroups['UnusedProperties'] = 'maintenance';
241241 //
242242 // $wgAutoloadClasses['SMWSpecialWantedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialWantedProperties.php';
243 -// $wgSpecialPages['WantedProperties'] = array( 'SMWSpecialWantedProperties' );
 243+// $wgSpecialPages['WantedProperties'] = 'SMWSpecialWantedProperties';
244244 // $wgSpecialPageGroups['WantedProperties'] = 'maintenance';
245245
246246 // Register Jobs
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php
@@ -227,50 +227,50 @@
228228 ///// Register specials, do that early on in case some other extension calls "addPage" /////
229229 $wgAutoloadClasses['SMWQueryPage'] = $smwgIP . 'specials/QueryPages/SMW_QueryPage.php';
230230 $wgAutoloadClasses['SMWAskPage'] = $smwgIP . 'specials/AskSpecial/SMW_SpecialAsk.php';
231 - $wgSpecialPages['Ask'] = array( 'SMWAskPage' );
 231+ $wgSpecialPages['Ask'] = 'SMWAskPage';
232232 $wgSpecialPageGroups['Ask'] = 'smw_group';
233233
234234 $wgAutoloadClasses['SMWSpecialBrowse'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialBrowse.php';
235 - $wgSpecialPages['Browse'] = array( 'SMWSpecialBrowse' );
 235+ $wgSpecialPages['Browse'] = 'SMWSpecialBrowse';
236236 $wgSpecialPageGroups['Browse'] = 'smw_group';
237237
238238 $wgAutoloadClasses['SMWPageProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialPageProperty.php';
239 - $wgSpecialPages['PageProperty'] = array( 'SMWPageProperty' );
 239+ $wgSpecialPages['PageProperty'] = 'SMWPageProperty';
240240 $wgSpecialPageGroups['PageProperty'] = 'smw_group';
241241
242242 $wgAutoloadClasses['SMWSearchByProperty'] = $smwgIP . 'specials/SearchTriple/SMW_SpecialSearchByProperty.php';
243 - $wgSpecialPages['SearchByProperty'] = array( 'SMWSearchByProperty' );
 243+ $wgSpecialPages['SearchByProperty'] = 'SMWSearchByProperty';
244244 $wgSpecialPageGroups['SearchByProperty'] = 'smw_group';
245245
246246 $wgAutoloadClasses['SMWURIResolver'] = $smwgIP . 'specials/URIResolver/SMW_SpecialURIResolver.php';
247 - $wgSpecialPages['URIResolver'] = array( 'SMWURIResolver' );
 247+ $wgSpecialPages['URIResolver'] = 'SMWURIResolver';
248248
249249 $wgAutoloadClasses['SMWAdmin'] = $smwgIP . 'specials/SMWAdmin/SMW_SpecialSMWAdmin.php';
250 - $wgSpecialPages['SMWAdmin'] = array( 'SMWAdmin' );
 250+ $wgSpecialPages['SMWAdmin'] = 'SMWAdmin';
251251 $wgSpecialPageGroups['SMWAdmin'] = 'smw_group';
252252
253253 $wgAutoloadClasses['SMWSpecialSemanticStatistics'] = $smwgIP . 'specials/Statistics/SMW_SpecialStatistics.php';
254 - $wgSpecialPages['SemanticStatistics'] = array( 'SMWSpecialSemanticStatistics' );
 254+ $wgSpecialPages['SemanticStatistics'] = 'SMWSpecialSemanticStatistics';
255255 $wgSpecialPageGroups['SemanticStatistics'] = 'wiki'; // Similar to Special:Statistics
256256
257257 $wgAutoloadClasses['SMWSpecialOWLExport'] = $smwgIP . 'specials/Export/SMW_SpecialOWLExport.php';
258 - $wgSpecialPages['ExportRDF'] = array( 'SMWSpecialOWLExport' );
 258+ $wgSpecialPages['ExportRDF'] = 'SMWSpecialOWLExport';
259259 $wgSpecialPageGroups['ExportRDF'] = 'smw_group';
260260
261261 $wgAutoloadClasses['SMWSpecialProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialProperties.php';
262 - $wgSpecialPages['Properties'] = array( 'SMWSpecialProperties' );
 262+ $wgSpecialPages['Properties'] = 'SMWSpecialProperties';
263263 $wgSpecialPageGroups['Properties'] = 'pages';
264264
265265 $wgAutoloadClasses['SMWSpecialTypes'] = $smwgIP . 'specials/QueryPages/SMW_SpecialTypes.php';
266 - $wgSpecialPages['Types'] = array( 'SMWSpecialTypes' );
 266+ $wgSpecialPages['Types'] = 'SMWSpecialTypes';
267267 $wgSpecialPageGroups['Types'] = 'pages';
268268
269269 $wgAutoloadClasses['SMWSpecialUnusedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialUnusedProperties.php';
270 - $wgSpecialPages['UnusedProperties'] = array( 'SMWSpecialUnusedProperties' );
 270+ $wgSpecialPages['UnusedProperties'] = 'SMWSpecialUnusedProperties';
271271 $wgSpecialPageGroups['UnusedProperties'] = 'maintenance';
272272
273273 $wgAutoloadClasses['SMWSpecialWantedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialWantedProperties.php';
274 - $wgSpecialPages['WantedProperties'] = array( 'SMWSpecialWantedProperties' );
 274+ $wgSpecialPages['WantedProperties'] = 'SMWSpecialWantedProperties';
275275 $wgSpecialPageGroups['WantedProperties'] = 'maintenance';
276276
277277 // Register Jobs
Index: trunk/extensions/WikiSync/WikiSync.php
@@ -49,7 +49,7 @@
5050 $dir = dirname(__FILE__);
5151 $wgExtensionMessagesFiles['WikiSync'] = $dir . '/WikiSync.i18n.php';
5252 $wgExtensionAliasesFiles['WikiSync'] = $dir . '/WikiSync.alias.php';
53 -$wgSpecialPages['WikiSync'] = array( 'WikiSyncPage' );
 53+$wgSpecialPages['WikiSync'] = 'WikiSyncPage';
5454 $wgSpecialPageGroups['WikiSync'] = 'pagetools';
5555
5656 if ( !isset( $wgAutoloadClasses['FormatJson'] ) ) {
Index: trunk/extensions/ConfirmEdit/ConfirmEdit.php
@@ -179,7 +179,7 @@
180180 $wgCaptchaRegexes = array();
181181
182182 /** Register special page */
183 -$wgSpecialPages['Captcha'] = array( /*class*/'CaptchaSpecialPage', /*name*/'Captcha' );
 183+$wgSpecialPages['Captcha'] = 'CaptchaSpecialPage';
184184
185185 $wgConfirmEditIP = dirname( __FILE__ );
186186 $wgExtensionMessagesFiles['ConfirmEdit'] = "$wgConfirmEditIP/ConfirmEdit.i18n.php";
Index: trunk/extensions/ConfirmEdit/ConfirmEdit_body.php
@@ -53,6 +53,9 @@
5454 }
5555
5656 class CaptchaSpecialPage extends UnlistedSpecialPage {
 57+ public function __construct(){
 58+ parent::__construct( 'Captcha' );
 59+ }
5760 function execute( $par ) {
5861 $this->setHeaders();
5962 $instance = ConfirmEditHooks::getInstance();
Index: trunk/extensions/Special404/Special404.php
@@ -27,7 +27,7 @@
2828 $wgExtensionMessagesFiles['Special404'] = $dir . '/Special404.i18n.php';
2929 $wgExtensionAliasesFiles['Special404'] = $dir . '/Special404.alias.php';
3030
31 -$wgSpecialPages['Error404'] = array( 'Special404' );
 31+$wgSpecialPages['Error404'] = 'Special404';
3232 $wgAutoloadClasses['Special404'] = $dir . '/Special404_body.php';
3333
3434 // Enable this to force an automatic 301 Moved Permanently redirect if a matching title exists
Index: trunk/extensions/SemanticNotifyMe/includes/SNM_Initialize.php
@@ -100,7 +100,7 @@
101101 }
102102 } else { // otherwise register special pages
103103 $wgAutoloadClasses['SMWNotifyMe'] = $smwgNMIP . '/specials/SMWNotifyMe/SMWNotifyMe.php';
104 - $wgSpecialPages['NotifyMe'] = array( 'SMWNotifyMe' );
 104+ $wgSpecialPages['NotifyMe'] = 'SMWNotifyMe';
105105 $wgSpecialPageGroups['NotifyMe'] = 'smw_group';
106106 }
107107
Index: trunk/extensions/CategoryBrowser/CategoryBrowser.php
@@ -54,7 +54,7 @@
5555 $dir = dirname(__FILE__);
5656 $wgExtensionMessagesFiles['CategoryBrowser'] = $dir . '/CategoryBrowser.i18n.php';
5757 $wgExtensionAliasesFiles['CategoryBrowser'] = $dir . '/CategoryBrowser.alias.php';
58 -$wgSpecialPages['CategoryBrowser'] = array( 'CategoryBrowserPage' );
 58+$wgSpecialPages['CategoryBrowser'] = 'CategoryBrowserPage';
5959 $wgSpecialPageGroups['CategoryBrowser'] = 'pages';
6060
6161 CB_Setup::init();
Index: trunk/extensions/Aggregator/Aggregator.php
@@ -37,7 +37,7 @@
3838 require_once 'rss_fetch.inc';
3939 }
4040
41 -$wgSpecialPages[] = array( 'Aggregator', /*perm*/false, /*listed*/ true, /*function*/ false, /*file*/ false );
 41+$wgSpecialPages['Aggregator'] = 'SpecialAggregator';
4242
4343 /**
4444 * Parser extension hook
@@ -93,7 +93,7 @@
9494 }
9595
9696 function _feedLink( $type, $mime ) {
97 - $special = wfAggregatorFeedPage( $this->mName, $type );
 97+ $special = SpecialPage::getTitleFor( 'Aggregator', "$type/{$this->mName}" );
9898 $link = Xml::element( 'link', array(
9999 'rel' => 'alternate',
100100 'type' => $mime,
@@ -102,41 +102,30 @@
103103 }
104104 }
105105
106 -function wfAggregatorFeedPage( $name, $type ) {
107 - return SpecialPage::getTitleFor( 'Aggregator', "$type/$name" );
108 -}
109 -
110 -
111106 /**
112107 * Special page management interface
113108 */
114 -function wfSpecialAggregator( $par = null ) {
115 - $bits = explode( '/', $par, 2 );
116 - if ( count( $bits ) < 2 ) {
117 - // editor form not yet implemented
118 - } else {
119 - list( $type, $target ) = $bits;
120 - return wfAggregatorFeed( $target, $type );
 109+class SpecialAggregator extends SpecialPage {
 110+
 111+ function __construct(){
 112+ parent::__construct( 'Aggregator' );
121113 }
122 -}
123114
124 -/**
125 - * Spit out a re-exported feed
126 - */
127 -function wfAggregatorFeed( $target, $type ) {
128 - global $wgFeedClasses, $wgOut;
129 - $wgOut->disable();
 115+ function execute( $par = null ) {
 116+ $bits = explode( '/', $par, 2 );
 117+ if ( count( $bits ) < 2 ) {
 118+ // editor form not yet implemented
 119+ } else {
 120+ list( $type, $target ) = $bits;
 121+ global $wgFeedClasses, $wgOut;
 122+ $wgOut->disable();
130123
131 - $aggro = new Aggregator( $target );
132 - $aggro->outputFeed( $type, 10 );
 124+ $aggro = new Aggregator( $target );
 125+ $aggro->outputFeed( $type, 10 );
 126+ }
 127+ }
133128 }
134129
135 -function wfAggregatorFeedError( $message ) {
136 - wfHttpError( 400, "Bad request", $message );
137 -}
138 -
139 -
140 -
141130 class Aggregator {
142131 public function __construct( $target ) {
143132 $this->mName = $target;
@@ -177,10 +166,10 @@
178167 public function outputFeed( $type, $count ) {
179168 global $wgFeedClasses;
180169 if ( !isset( $wgFeedClasses[$type] ) ) {
181 - return wfAggregatorFeedError( "Requested feed type \"$type\" not recognized." );
 170+ return wfHttpError( 400, "Bad request", "Requested feed type \"$type\" not recognized." );
182171 }
183172
184 - $special = wfAggregatorFeedPage( $this->mName, $type );
 173+ $special = SpecialPage::getTitleFor( 'Aggregator', "$type/{$this->mName}" );
185174 $feed = new $wgFeedClasses[$type]( 'my cool feed', 'my feed rocks',
186175 $special->getFullUrl() );
187176
Index: trunk/extensions/QPoll/qp_user.php
@@ -162,7 +162,7 @@
163163 $wgAutoloadClasses['qp_QuestionData'] = self::$ExtDir . '/qp_pollstore.php';
164164 $wgAutoloadClasses['qp_QueryPage'] = self::$ExtDir . '/qp_results.php';
165165 // TODO: Use the new technique for i18n of special page aliases
166 - $wgSpecialPages['PollResults'] = array('PollResults');
 166+ $wgSpecialPages['PollResults'] = 'PollResults';
167167 // TODO: Use the new technique for i18n of magic words
168168 // instantiating fake instance for PHP < 5.2.3, which does not support 'Class::method' type of callbacks
169169 $wgHooks['LanguageGetMagic'][] =
Index: trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber.php
@@ -88,7 +88,7 @@
8989 */
9090 $wgExtensionMessagesFiles['PlayerStatsGrabber'] = dirname( __FILE__ ) . '/PlayerStatsGrabber.i18n.php';
9191 $wgAutoloadClasses['SpecialPlayerStatsGrabber'] = dirname( __FILE__ ) . '/PlayerStatsGrabber_body.php';
92 -$wgSpecialPages['PlayerStatsGrabber'] = array( 'SpecialPlayerStatsGrabber' );
 92+$wgSpecialPages['PlayerStatsGrabber'] = 'SpecialPlayerStatsGrabber';
9393
9494 $wgSpecialPageGroups['PlayerStatsGrabber'] = 'wiki'; // like Special:Statistics
9595
Index: trunk/extensions/ArticleComments/ArticleComments.php
@@ -116,7 +116,7 @@
117117 $wgArticleCommentsNSDisplayList = array();
118118
119119 # Sets up special page to handle comment submission
120 -$wgSpecialPages[] = array( 'ProcessComment', '', true, 'specialProcessComment', false );
 120+$wgSpecialPages['ProcessComment'] = 'SpecialProcessComment';
121121
122122 # Sets up the ArticleComments Parser hook for <comments />
123123 function wfArticleCommentsParserSetup( &$parser ) {
@@ -358,161 +358,167 @@
359359 /**
360360 * Special page for comment processing.
361361 */
362 -function specialProcessComment() {
363 - global $wgOut, $wgParser, $wgUser, $wgContLang, $wgRequest;
 362+class SpecialProcessComment extends SpecialPage {
 363+ function __construct(){
 364+ parent::__construct( 'ProcessComment' );
 365+ }
364366
365 - # Retrieve submitted values
366 - $titleText = $wgRequest->getVal( 'commentArticle' );
367 - $commenterName = $wgRequest->getVal( 'commenterName' );
368 - $commenterURL = trim( $wgRequest->getVal( 'commenterURL' ) );
369 - $comment = $wgRequest->getVal( 'comment' );
 367+ function execute() {
 368+ global $wgOut, $wgParser, $wgUser, $wgContLang, $wgRequest;
370369
371 - // The default value is the same as not providing a URL
372 - if ( $commenterURL == 'http://' ) {
373 - $commenterURL = '';
374 - }
 370+ # Retrieve submitted values
 371+ $titleText = $wgRequest->getVal( 'commentArticle' );
 372+ $commenterName = $wgRequest->getVal( 'commenterName' );
 373+ $commenterURL = trim( $wgRequest->getVal( 'commenterURL' ) );
 374+ $comment = $wgRequest->getVal( 'comment' );
375375
376 - $title = Title::newFromText( $titleText );
 376+ // The default value is the same as not providing a URL
 377+ if ( $commenterURL == 'http://' ) {
 378+ $commenterURL = '';
 379+ }
377380
378 - # Perform validation checks on supplied fields
379 - $messages = array();
 381+ $title = Title::newFromText( $titleText );
380382
381 - if ( !$wgRequest->wasPosted() ) {
382 - $messages[] = wfMsg( 'article-comments-not-posted' );
383 - }
 383+ # Perform validation checks on supplied fields
 384+ $messages = array();
384385
385 - if ( $titleText === '' || !$title ) {
386 - $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-title-string' ), $titleText );
387 - }
 386+ if ( !$wgRequest->wasPosted() ) {
 387+ $messages[] = wfMsg( 'article-comments-not-posted' );
 388+ }
388389
389 - if ( !$commenterName || strpos( $commenterName, "\n" ) !== false ) {
390 - $messages[] = wfMsg( 'article-comments-required-field', wfMsgForContent( 'article-comments-name-string' ) );
391 - }
 390+ if ( $titleText === '' || !$title ) {
 391+ $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-title-string' ), $titleText );
 392+ }
392393
393 - if ( ( $commenterURL != '' ) && !preg_match( "/^(" . wfUrlProtocols() . ')' . Parser::EXT_LINK_URL_CLASS . '+$/', $commenterURL ) ) {
394 - $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-url-string' ), $commenterURL );
395 - }
 394+ if ( !$commenterName || strpos( $commenterName, "\n" ) !== false ) {
 395+ $messages[] = wfMsg( 'article-comments-required-field', wfMsgForContent( 'article-comments-name-string' ) );
 396+ }
396397
397 - if ( !$comment ) {
398 - $messages[] = wfMsg( 'article-comments-required-field', wfMsg( 'article-comments-comment-string' ) );
399 - }
 398+ if ( ( $commenterURL != '' ) && !preg_match( "/^(" . wfUrlProtocols() . ')' . Parser::EXT_LINK_URL_CLASS . '+$/', $commenterURL ) ) {
 399+ $messages[] = wfMsg( 'article-comments-invalid-field', wfMsgForContent( 'article-comments-url-string' ), $commenterURL );
 400+ }
400401
401 - if ( !empty( $messages ) ) {
402 - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) );
403 - $wikiText = "<div class='errorbox'>\n";
404 - $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', count( $messages ) ) . "\n\n";
405 - foreach ( $messages as $message ) {
406 - $wikiText .= "* $message\n";
 402+ if ( !$comment ) {
 403+ $messages[] = wfMsg( 'article-comments-required-field', wfMsg( 'article-comments-comment-string' ) );
407404 }
408 - $wgOut->addWikiText( $wikiText . '</div>' );
409 - return;
410 - }
411405
412 - # Setup title and talkTitle object
413 - $article = new Article( $title );
 406+ if ( !empty( $messages ) ) {
 407+ $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) );
 408+ $wikiText = "<div class='errorbox'>\n";
 409+ $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', count( $messages ) ) . "\n\n";
 410+ foreach ( $messages as $message ) {
 411+ $wikiText .= "* $message\n";
 412+ }
 413+ $wgOut->addWikiText( $wikiText . '</div>' );
 414+ return;
 415+ }
414416
415 - $talkTitle = $title->getTalkPage();
416 - $talkArticle = new Article( $talkTitle );
 417+ # Setup title and talkTitle object
 418+ $article = new Article( $title );
417419
418 - # Check whether user is blocked from editing the talk page
419 - if ( $wgUser->isBlockedFrom( $talkTitle ) ) {
420 - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) );
421 - $wikiText = "<div class='errorbox'>\n";
422 - # 1 error only but message is used above for n errors too
423 - $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', 1 ) . "\n\n";
424 - $wikiText .= '* ' . wfMsg( 'article-comments-user-is-blocked', $talkTitle->getPrefixedText() ) . "\n";
425 - $wgOut->addWikiText( $wikiText . '</div>' );
426 - return;
427 - }
 420+ $talkTitle = $title->getTalkPage();
 421+ $talkArticle = new Article( $talkTitle );
428422
429 - # Retrieve article content
430 - $articleContent = '';
431 - if ( $title->exists() ) {
432 - $articleContent = $article->getContent();
433 - }
 423+ # Check whether user is blocked from editing the talk page
 424+ if ( $wgUser->isBlockedFrom( $talkTitle ) ) {
 425+ $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) );
 426+ $wikiText = "<div class='errorbox'>\n";
 427+ # 1 error only but message is used above for n errors too
 428+ $wikiText .= wfMsgExt( 'article-comments-failure-reasons', 'parsemag', 1 ) . "\n\n";
 429+ $wikiText .= '* ' . wfMsg( 'article-comments-user-is-blocked', $talkTitle->getPrefixedText() ) . "\n";
 430+ $wgOut->addWikiText( $wikiText . '</div>' );
 431+ return;
 432+ }
434433
435 - # Retrieve existing talk content
436 - $talkContent = '';
437 - if ( $talkTitle->exists() ) {
438 - $talkContent = $talkArticle->getContent();
439 - }
 434+ # Retrieve article content
 435+ $articleContent = '';
 436+ if ( $title->exists() ) {
 437+ $articleContent = $article->getContent();
 438+ }
440439
441 - # Check if talk NS is in the namespace display list
442 - # Note: if so, then there's no need to confirm that <comments /> appears in the article or talk page.
443 - global $wgArticleCommentsNSDisplayList;
444 - $skipCheck = (
445 - is_array( $wgArticleCommentsNSDisplayList ) ?
446 - in_array( $talkTitle->getNamespace(), $wgArticleCommentsNSDisplayList ):
447 - false
448 - );
 440+ # Retrieve existing talk content
 441+ $talkContent = '';
 442+ if ( $talkTitle->exists() ) {
 443+ $talkContent = $talkArticle->getContent();
 444+ }
449445
450 - # Check whether the article or its talk page contains a <comments /> flag
451 - if ( !$skipCheck &&
452 - preg_match( '/<comments( +[^>]*)?\\/>/', $articleContent ) === 0 &&
453 - preg_match( '/<comments( +[^>]*)?\\/>/', $talkContent ) === 0
454 - ) {
455 - $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) );
456 - $wgOut->addWikiText(
457 - '<div class="errorbox">' .
458 - wfMsg( 'article-comments-no-comments', $title->getPrefixedText() ) .
459 - '</div>'
 446+ # Check if talk NS is in the namespace display list
 447+ # Note: if so, then there's no need to confirm that <comments /> appears in the article or talk page.
 448+ global $wgArticleCommentsNSDisplayList;
 449+ $skipCheck = (
 450+ is_array( $wgArticleCommentsNSDisplayList ) ?
 451+ in_array( $talkTitle->getNamespace(), $wgArticleCommentsNSDisplayList ):
 452+ false
460453 );
461 - return;
462 - }
463454
464 - # Run spam checks
465 - $isSpam = false;
466 - wfRunHooks( 'ArticleCommentsSpamCheck', array( $comment, $commenterName, $commenterURL, &$isSpam ) );
 455+ # Check whether the article or its talk page contains a <comments /> flag
 456+ if ( !$skipCheck &&
 457+ preg_match( '/<comments( +[^>]*)?\\/>/', $articleContent ) === 0 &&
 458+ preg_match( '/<comments( +[^>]*)?\\/>/', $talkContent ) === 0
 459+ ) {
 460+ $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) );
 461+ $wgOut->addWikiText(
 462+ '<div class="errorbox">' .
 463+ wfMsg( 'article-comments-no-comments', $title->getPrefixedText() ) .
 464+ '</div>'
 465+ );
 466+ return;
 467+ }
467468
468 - # If it's spam - it's gone!
469 - if ( $isSpam ) {
470 - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) );
471 - $wgOut->addWikiText(
472 - '<div class="errorbox">' .
473 - wfMsg( 'article-comments-no-spam' ) .
474 - '</div>'
475 - );
476 - return;
477 - }
 469+ # Run spam checks
 470+ $isSpam = false;
 471+ wfRunHooks( 'ArticleCommentsSpamCheck', array( $comment, $commenterName, $commenterURL, &$isSpam ) );
478472
479 - # Initialize the talk page's content.
480 - if ( $talkContent == '' ) {
481 - $talkContent = wfMsgForContent( 'article-comments-talk-page-starter', $title->getPrefixedText() );
482 - }
 473+ # If it's spam - it's gone!
 474+ if ( $isSpam ) {
 475+ $wgOut->setPageTitle( wfMsg( 'article-comments-submission-failed' ) );
 476+ $wgOut->addWikiText(
 477+ '<div class="errorbox">' .
 478+ wfMsg( 'article-comments-no-spam' ) .
 479+ '</div>'
 480+ );
 481+ return;
 482+ }
483483
484 - # Search for insertion point, or append most recent comment.
485 - $commentText = wfMsgForContent( 'article-comments-new-comment-heading', $commenterName, $commenterURL, '~~~~', $comment );
486 - $commentText .= '<comment date="' . htmlspecialchars( wfTimestamp( TS_ISO_8601 ) ) . '" name="' . htmlspecialchars( $commenterName ) . '"';
487 - if ( $commenterURL != '' ) {
488 - $commentText .= ' url="' . htmlspecialchars( $commenterURL ) . '"';
489 - }
490 - if ( $wgUser->isLoggedIn() ) {
491 - $commentText .= ' signature="' . htmlspecialchars( $wgParser->getUserSig( $wgUser ) ) . '"';
492 - }
493 - $commentText .= ">\n" . str_replace( '</comment', '&lt;/comment', $comment ) . "\n</comment>";
 484+ # Initialize the talk page's content.
 485+ if ( $talkContent == '' ) {
 486+ $talkContent = wfMsgForContent( 'article-comments-talk-page-starter', $title->getPrefixedText() );
 487+ }
494488
495 - $posAbove = stripos( $talkContent, '<!--COMMENTS_ABOVE-->' );
496 - if ( $posAbove === false ) {
497 - $posBelow = stripos( $talkContent, '<!--COMMENTS_BELOW-->' );
498 - }
499 - if ( $posAbove !== false ) {
500 - # Insert comments above HTML marker
501 - $talkContent = substr( $talkContent, 0, $posAbove ) . $commentText . substr( $talkContent, $posAbove );
502 - } elseif ( $posBelow !== false ) {
503 - # Insert comments below HTML marker
504 - $talkContent = substr( $talkContent, 0, $posBelow + 21 ) . $commentText . substr( $talkContent, $posBelow + 21 );
505 - } else {
506 - # No marker found, append to bottom (default)
507 - $talkContent .= $commentText;
508 - }
 489+ # Search for insertion point, or append most recent comment.
 490+ $commentText = wfMsgForContent( 'article-comments-new-comment-heading', $commenterName, $commenterURL, '~~~~', $comment );
 491+ $commentText .= '<comment date="' . htmlspecialchars( wfTimestamp( TS_ISO_8601 ) ) . '" name="' . htmlspecialchars( $commenterName ) . '"';
 492+ if ( $commenterURL != '' ) {
 493+ $commentText .= ' url="' . htmlspecialchars( $commenterURL ) . '"';
 494+ }
 495+ if ( $wgUser->isLoggedIn() ) {
 496+ $commentText .= ' signature="' . htmlspecialchars( $wgParser->getUserSig( $wgUser ) ) . '"';
 497+ }
 498+ $commentText .= ">\n" . str_replace( '</comment', '&lt;/comment', $comment ) . "\n</comment>";
509499
510 - # Update the talkArticle with the new comment
511 - $summary = wfMsgForContent( 'article-comments-summary', $commenterName );
512 - $talkArticle->doEdit( $talkContent, $summary );
 500+ $posAbove = stripos( $talkContent, '<!--COMMENTS_ABOVE-->' );
 501+ if ( $posAbove === false ) {
 502+ $posBelow = stripos( $talkContent, '<!--COMMENTS_BELOW-->' );
 503+ }
 504+ if ( $posAbove !== false ) {
 505+ # Insert comments above HTML marker
 506+ $talkContent = substr( $talkContent, 0, $posAbove ) . $commentText . substr( $talkContent, $posAbove );
 507+ } elseif ( $posBelow !== false ) {
 508+ # Insert comments below HTML marker
 509+ $talkContent = substr( $talkContent, 0, $posBelow + 21 ) . $commentText . substr( $talkContent, $posBelow + 21 );
 510+ } else {
 511+ # No marker found, append to bottom (default)
 512+ $talkContent .= $commentText;
 513+ }
513514
514 - $wgOut->setPageTitle( wfMsg( 'article-comments-submission-succeeded' ) );
515 - $wgOut->addWikiMsg( 'article-comments-submission-success', $title->getPrefixedText() );
516 - $wgOut->addWikiMsg( 'article-comments-submission-view-all', $talkTitle->getPrefixedText() );
 515+ # Update the talkArticle with the new comment
 516+ $summary = wfMsgForContent( 'article-comments-summary', $commenterName );
 517+ $talkArticle->doEdit( $talkContent, $summary );
 518+
 519+ $wgOut->setPageTitle( wfMsg( 'article-comments-submission-succeeded' ) );
 520+ $wgOut->addWikiMsg( 'article-comments-submission-success', $title->getPrefixedText() );
 521+ $wgOut->addWikiMsg( 'article-comments-submission-view-all', $talkTitle->getPrefixedText() );
 522+ }
517523 }
518524
519525 /**
Index: trunk/extensions/Rdf/Rdf.php
@@ -99,7 +99,7 @@
100100 $wgHooks['TitleMoveComplete'][] = 'MwRdfOnTitleMoveComplete';
101101 $wgHooks['ArticleDeleteComplete'][] = 'MwRdfOnArticleDeleteComplete';
102102
103 -$wgSpecialPages[] = array( 'Rdf', '', true, 'wfSpecialRdf', 'extensions/MwRdf.php' );
 103+$wgSpecialPages['Rdf'] = 'SpecialRdf';
104104
105105 function setupMwRdf() {
106106 global $wgRequest, $wgOut;
@@ -153,43 +153,49 @@
154154 return true;
155155 }
156156
157 -function wfSpecialRdf($par) {
158 - global $wgRequest, $wgRdfDefaultModels, $wgRdfOutputFunctions;
 157+class SpecialRdf extends SpecialPage {
 158+ public function __construct(){
 159+ parent::__construct( 'Rdf' );
 160+ }
159161
160 - $target = $wgRequest->getVal('target');
 162+ function execute( $par ) {
 163+ global $wgRequest, $wgRdfDefaultModels, $wgRdfOutputFunctions;
161164
162 - if (!isset($target)) { # no target parameter
163 - MwRdfShowForm();
164 - } else if (strlen($target) == 0) { # no target contents
165 - MwRdfShowForm(wfMsg('badtitle'));
166 - } else {
167 - $nt = Title::newFromText($target);
168 - if ($nt->getArticleID() == 0) { # not an article
 165+ $target = $wgRequest->getVal('target');
 166+
 167+ if (!isset($target)) { # no target parameter
 168+ MwRdfShowForm();
 169+ } else if (strlen($target) == 0) { # no target contents
169170 MwRdfShowForm(wfMsg('badtitle'));
170171 } else {
171 - $article = new Article($nt);
 172+ $nt = Title::newFromText($target);
 173+ if ($nt->getArticleID() == 0) { # not an article
 174+ MwRdfShowForm(wfMsg('badtitle'));
 175+ } else {
 176+ $article = new Article($nt);
172177
173 - # Note: WebRequest chokes on arrays here
174 - $modelnames = $_REQUEST['modelnames'];
175 - if (is_null($modelnames)) {
176 - $modelnames = $wgRdfDefaultModels;
177 - }
 178+ # Note: WebRequest chokes on arrays here
 179+ $modelnames = $_REQUEST['modelnames'];
 180+ if (is_null($modelnames)) {
 181+ $modelnames = $wgRdfDefaultModels;
 182+ }
178183
179 - if (is_string($modelnames)) {
180 - $modelnames = explode(',', $modelnames);
181 - }
 184+ if (is_string($modelnames)) {
 185+ $modelnames = explode(',', $modelnames);
 186+ }
182187
183 - $format = $wgRequest->getVal('format', 'xml');
 188+ $format = $wgRequest->getVal('format', 'xml');
184189
185 - $outfun = $wgRdfOutputFunctions[$format];
 190+ $outfun = $wgRdfOutputFunctions[$format];
186191
187 - if (!isset($outfun)) {
188 - wfDebugDieBacktrace("No output function for format '$format'.");
189 - }
 192+ if (!isset($outfun)) {
 193+ wfDebugDieBacktrace("No output function for format '$format'.");
 194+ }
190195
191 - $fullModel = MwRdfGetModel($article, $modelnames);
 196+ $fullModel = MwRdfGetModel($article, $modelnames);
192197
193 - $outfun($fullModel);
 198+ $outfun($fullModel);
 199+ }
194200 }
195201 }
196202 }
Index: trunk/extensions/GoogleMaps/GoogleMaps.php
@@ -142,7 +142,7 @@
143143 $wgParser->setHook( 'googlemapkml', array( $wgGoogleMaps, 'renderKmlLink' ) );
144144
145145 // Set up the special page
146 - $wgSpecialPages['GoogleMapsKML'] = array('GoogleMapsKML', 'GoogleMapsKML');
 146+ $wgSpecialPages['GoogleMapsKML'] = 'GoogleMapsKML';
147147 }
148148
149149 // add the install extension function
Index: trunk/extensions/MogileClient/SpecialUploadMogile.php
@@ -18,6 +18,8 @@
1919
2020 /**
2121 * Entry point
 22+ * FIXME: this isn't actually called from anywhere?!? The wfSpecialFoo() function method
 23+ * is deprecated unofficially since forever, officially sinc e1.18
2224 */
2325 function wfSpecialUploadMogile() {
2426 global $wgRequest;
Index: trunk/extensions/GetFamily/GetFamily.php
@@ -31,181 +31,191 @@
3232 $dir = dirname( __FILE__ ) . '/';
3333 $wgExtensionMessagesFiles['GetFamily'] = $dir . 'GetFamily.i18n.php';
3434 // FIXME: add $wgExtensionAliasesFiles
35 -$wgSpecialPages['GetFamily'] = array( 'SpecialPage', 'GetFamily', 'getfamily' );
 35+$wgSpecialPages['GetFamily'] = 'SpecialGetFamily';
3636
3737 // New user right
3838 $wgAvailableRights[] = 'getfamily';
3939 $wgGroupPermissions['*']['getfamily'] = true;
4040
4141 // FIXME: split off into GetFamily_body.php
42 -function wfSpecialGetFamily() {
43 - global $wgRequest, $wgLanguageNames;
44 - global $wgScript, $wgDBname, $wgLanguageCode, $wgSitename, $wgServer, $wgArticlePath, $wgVersion;
 42+class SpecialGetFamily extends SpecialPage {
 43+ public function __construct(){
 44+ parent::__construct( 'GetFamily' );
 45+ }
4546
46 - $out = '';
 47+ function execute() {
 48+ global $wgRequest, $wgLanguageNames, $wgUser, $wgOut;
 49+ global $wgScript, $wgDBname, $wgLanguageCode, $wgSitename, $wgServer, $wgArticlePath, $wgVersion;
4750
48 - if ( $wgRequest->getVal( 'action' ) == 'GetLocal' ) {
49 - $dbr = wfGetDB( DB_SLAVE );
50 - $fromLang = $wgRequest->getVal( 'fromLang' );
51 - $result = $dbr->select( 'interwiki', array( 'iw_url' ), array( 'iw_prefix' => $fromLang ), __METHOD__ );
52 - if ( $object = $dbr->fetchObject( $result ) ) {
53 - $fromLang = $object->iw_url;
54 - } else {
55 - $fromLang = '';
 51+ if( !$wgUser->isAllowed( 'getfamily' ) ){
 52+ $wgOut->permissionRequired( 'getfamily' );
5653 }
5754
58 - header( 'Content-Type: text/xml' );
59 - $out .= "<family>\n";
 55+ $out = '';
6056
61 - $out .= Xml::element( 'urlcheck', array(), $fromLang ) . "\n";
62 - $out .= Xml::element( 'language', array(), $wgLanguageCode ) . "\n";
63 - $out .= Xml::element( 'hostname', array(), str_replace( 'http://', '', $wgServer ) ) . "\n";
64 - $out .= Xml::element( 'path', array(), $wgScript ) . "\n";
 57+ if ( $wgRequest->getVal( 'action' ) == 'GetLocal' ) {
 58+ $dbr = wfGetDB( DB_SLAVE );
 59+ $fromLang = $wgRequest->getVal( 'fromLang' );
 60+ $result = $dbr->select( 'interwiki', array( 'iw_url' ), array( 'iw_prefix' => $fromLang ), __METHOD__ );
 61+ if ( $object = $dbr->fetchObject( $result ) ) {
 62+ $fromLang = $object->iw_url;
 63+ } else {
 64+ $fromLang = '';
 65+ }
6566
66 - // $keys = array_keys ($wgCanonicalNamespaceNames);
67 - $language = Language::factory( $wgLanguageCode );
68 - $array = $language->getNamespaces();
69 - $keys = array_keys( $array );
 67+ header( 'Content-Type: text/xml' );
 68+ $out .= "<family>\n";
7069
71 - foreach ( $keys as $key ) {
72 - $out .= Xml::openElement( 'namespace', array() ) . "\n";
73 - $out .= Xml::element( 'key', array(), $key ) . "\n";
74 - // $out .= Xml::element('name', array(), $wgCanonicalNamespaceNames[$key]) . "\n";
75 - $out .= Xml::element( 'name', array(), $array[$key] ) . "\n";
76 - $out .= Xml::closeElement( 'namespace' );
77 - }
78 - $out .= "</family>\n";
79 - } else {
80 - header( 'Content-Type: text/plain' );
 70+ $out .= Xml::element( 'urlcheck', array(), $fromLang ) . "\n";
 71+ $out .= Xml::element( 'language', array(), $wgLanguageCode ) . "\n";
 72+ $out .= Xml::element( 'hostname', array(), str_replace( 'http://', '', $wgServer ) ) . "\n";
 73+ $out .= Xml::element( 'path', array(), $wgScript ) . "\n";
8174
82 - $langcodes = array_keys( $wgLanguageNames );
 75+ // $keys = array_keys ($wgCanonicalNamespaceNames);
 76+ $language = Language::factory( $wgLanguageCode );
 77+ $array = $language->getNamespaces();
 78+ $keys = array_keys( $array );
8379
84 - $dbr = wfGetDB( DB_SLAVE );
85 - foreach ( $langcodes as $lang_code ) {
86 - $where .= ', ' . $dbr->addQuotes( $lang_code );
87 - }
88 - $where = substr( $where, 1 );
89 - $result = $dbr->select( 'interwiki', array( 'iw_prefix', 'iw_url' ),
90 - array( "iw_prefix IN ( $where )" ), __METHOD__ );
 80+ foreach ( $keys as $key ) {
 81+ $out .= Xml::openElement( 'namespace', array() ) . "\n";
 82+ $out .= Xml::element( 'key', array(), $key ) . "\n";
 83+ // $out .= Xml::element('name', array(), $wgCanonicalNamespaceNames[$key]) . "\n";
 84+ $out .= Xml::element( 'name', array(), $array[$key] ) . "\n";
 85+ $out .= Xml::closeElement( 'namespace' );
 86+ }
 87+ $out .= "</family>\n";
 88+ } else {
 89+ header( 'Content-Type: text/plain' );
9190
92 - $datalinks = array();
 91+ $langcodes = array_keys( $wgLanguageNames );
9392
94 - while ( $dbObject = $dbr->fetchObject( $result ) ) {
95 - $datalinks[$dbObject->iw_prefix] = $dbObject->iw_url;
96 - }
 93+ $dbr = wfGetDB( DB_SLAVE );
 94+ foreach ( $langcodes as $lang_code ) {
 95+ $where .= ', ' . $dbr->addQuotes( $lang_code );
 96+ }
 97+ $where = substr( $where, 1 );
 98+ $result = $dbr->select( 'interwiki', array( 'iw_prefix', 'iw_url' ),
 99+ array( "iw_prefix IN ( $where )" ), __METHOD__ );
97100
98 - $datalinks[$wgLanguageCode] = $wgServer . $wgArticlePath;
 101+ $datalinks = array();
99102
100 - unset( $datalinks['bug'] );
 103+ while ( $dbObject = $dbr->fetchObject( $result ) ) {
 104+ $datalinks[$dbObject->iw_prefix] = $dbObject->iw_url;
 105+ }
101106
102 - $metadata = array();
103 - $metadata['langs'] = array();
104 - $metadata['path'] = array();
105 - $namespacedata = array();
 107+ $datalinks[$wgLanguageCode] = $wgServer . $wgArticlePath;
106108
107 - foreach ( $datalinks as $lang => $link ) {
108 - $link = str_replace( '$1', 'Special:GetFamily?action=GetLocal&fromLang=' . $wgLanguageCode, $link );
109 - if ( !class_exists( 'WikiCurl' ) ) {
110 - global $IP;
111 - require_once( "$IP/extensions/WikiCurl/WikiCurl.php" );
112 - }
113 - $handler = new WikiCurl();
114 - $content = $handler->get( $link );
115 - if ( strpos( $content, '<family>' ) === false ) {
 109+ unset( $datalinks['bug'] );
 110+
 111+ $metadata = array();
 112+ $metadata['langs'] = array();
 113+ $metadata['path'] = array();
 114+ $namespacedata = array();
 115+
 116+ foreach ( $datalinks as $lang => $link ) {
 117+ $link = str_replace( '$1', 'Special:GetFamily?action=GetLocal&fromLang=' . $wgLanguageCode, $link );
 118+ if ( !class_exists( 'WikiCurl' ) ) {
 119+ global $IP;
 120+ require_once( "$IP/extensions/WikiCurl/WikiCurl.php" );
 121+ }
 122+ $handler = new WikiCurl();
 123+ $content = $handler->get( $link );
 124+ if ( strpos( $content, '<family>' ) === false ) {
 125+ unset( $handler );
 126+ continue;
 127+ }
 128+ $content = substr( $content, strpos( $content, "\r\n\r\n" ) + 4 );
116129 unset( $handler );
117 - continue;
118 - }
119 - $content = substr( $content, strpos( $content, "\r\n\r\n" ) + 4 );
120 - unset( $handler );
121130
122 - try {
123 - $xml = new SimpleXMLElement( $content );
124 - } catch ( Exception $e ) {
125 - continue;
126 - }
 131+ try {
 132+ $xml = new SimpleXMLElement( $content );
 133+ } catch ( Exception $e ) {
 134+ continue;
 135+ }
127136
128 - // $urlcheck = (string)$xml->urlcheck;
129 - // if ( strcmp( $urlcheck, $wgServer.$wgArticlePath ) != 0 ){
130 - // continue;
131 - // }
132 - $metadata['langs'][$lang] = (string)$xml->hostname;
133 - $metadata['path'][$lang] = (string)$xml->path;
 137+ // $urlcheck = (string)$xml->urlcheck;
 138+ // if ( strcmp( $urlcheck, $wgServer.$wgArticlePath ) != 0 ){
 139+ // continue;
 140+ // }
 141+ $metadata['langs'][$lang] = (string)$xml->hostname;
 142+ $metadata['path'][$lang] = (string)$xml->path;
134143
135 - foreach ( $xml->namespace as $namespace ) {
136 - $namespacedata[(int)$namespace->key][$lang] = (string)$namespace->name;
 144+ foreach ( $xml->namespace as $namespace ) {
 145+ $namespacedata[(int)$namespace->key][$lang] = (string)$namespace->name;
 146+ }
137147 }
138 - }
139148
140 - if ( $namespacedata != array() ) {
141 - $out .= "# -*- coding: utf-8 -*-
 149+ if ( $namespacedata != array() ) {
 150+ $out .= "# -*- coding: utf-8 -*-
142151
143 -'''
144 -The $wgSitename family.
 152+ '''
 153+ The $wgSitename family.
145154
146 -This is config file for pywikipediabot framework.
147 -It was generated by Special:GetFamily (a Wikia extension).
 155+ This is config file for pywikipediabot framework.
 156+ It was generated by Special:GetFamily (a Wikia extension).
148157
149 -Save this file to families/{$wgDBname}_family.py in your pywikibot installation
150 -The pywikipediabot itself is available for free download from svn.wikimedia.org
151 -'''
 158+ Save this file to families/{$wgDBname}_family.py in your pywikibot installation
 159+ The pywikipediabot itself is available for free download from svn.wikimedia.org
 160+ '''
152161
153 -import family
 162+ import family
154163
155 -class Family(family.Family):
 164+ class Family(family.Family):
156165
157 - def __init__(self):
158 - family.Family.__init__(self)
159 - self.name = '$wgDBname' # Set the family name; this should be the same as in the filename.
 166+ def __init__(self):
 167+ family.Family.__init__(self)
 168+ self.name = '$wgDBname' # Set the family name; this should be the same as in the filename.
160169
161 - self.langs = {\n";
 170+ self.langs = {\n";
162171
163 - $keys = array_keys( $metadata['langs'] );
 172+ $keys = array_keys( $metadata['langs'] );
164173
165 - foreach ( $keys as $key ) {
166 - $out .= " '$key': '{$metadata['langs'][$key]}', \n";
167 - }
 174+ foreach ( $keys as $key ) {
 175+ $out .= " '$key': '{$metadata['langs'][$key]}', \n";
 176+ }
168177
169 - $out .= " }\n \n";
 178+ $out .= " }\n \n";
170179
171 - $namespace_keys = array_keys( $namespacedata );
 180+ $namespace_keys = array_keys( $namespacedata );
172181
173 - foreach ( $namespace_keys as $key ) {
174 - $langs = array_keys( $namespacedata[$key] );
175 - $out .= " self.namespaces[$key] = {\n";
 182+ foreach ( $namespace_keys as $key ) {
 183+ $langs = array_keys( $namespacedata[$key] );
 184+ $out .= " self.namespaces[$key] = {\n";
176185
177 - foreach ( $langs as $lang ) {
178 - $out .= " '$lang': u'{$namespacedata[$key][$lang]}',\n";
 186+ foreach ( $langs as $lang ) {
 187+ $out .= " '$lang': u'{$namespacedata[$key][$lang]}',\n";
 188+ }
 189+ $out .= " }\n \n";
179190 }
180 - $out .= " }\n \n";
181 - }
182 - $version = array();
183 - preg_match( '/[0-9]*\.[0-9]*/', $wgVersion, $version );
184 - $version = $version[0];
 191+ $version = array();
 192+ preg_match( '/[0-9]*\.[0-9]*/', $wgVersion, $version );
 193+ $version = $version[0];
185194
186 - $out .= "
187 - def hostname(self, code):
188 - return self.langs[code]
 195+ $out .= "
 196+ def hostname(self, code):
 197+ return self.langs[code]
189198
190 - def path(self, code):
191 - path = ''\n";
 199+ def path(self, code):
 200+ path = ''\n";
192201
193 - $keys = array_keys( $metadata['langs'] );
 202+ $keys = array_keys( $metadata['langs'] );
194203
195 - foreach ( $keys as $key ) {
196 - $out .= " if code == '$key':\n path = '{$metadata['path'][$key]}'\n";
197 - }
 204+ foreach ( $keys as $key ) {
 205+ $out .= " if code == '$key':\n path = '{$metadata['path'][$key]}'\n";
 206+ }
198207
199 - $out .= " return path
 208+ $out .= " return path
200209
201 - def login_address(self, code):
202 - return '%s?title=%s:Userlogin&action=submitlogin' % (self.path(code), self.special_namespace_url(code))
 210+ def login_address(self, code):
 211+ return '%s?title=%s:Userlogin&action=submitlogin' % (self.path(code), self.special_namespace_url(code))
203212
204 - def version(self, code):
205 - return '" . $version . "' # The MediaWiki version used. Not very important in most cases.
206 -";
207 - } else {
208 - $out .= wfMsg( 'getfamily-interwikierror' );
 213+ def version(self, code):
 214+ return '" . $version . "' # The MediaWiki version used. Not very important in most cases.
 215+ ";
 216+ } else {
 217+ $out .= wfMsg( 'getfamily-interwikierror' );
 218+ }
209219 }
 220+ die( $out );
210221 }
211 - die( $out );
212222 }
Index: trunk/extensions/EditConflict/EditConflict.php
@@ -57,7 +57,7 @@
5858
5959 $wgExtensionMessagesFiles['EditConflict'] = EditConflict::$ExtDir . '/EditConflict_i18n.php';
6060 $wgAutoloadClasses['ec_CurrentEdits'] = EditConflict::$ExtDir . '/CurrentEdits.php';
61 -$wgSpecialPages['CurrentEdits'] = array( 'ec_CurrentEdits' );
 61+$wgSpecialPages['CurrentEdits'] = 'ec_CurrentEdits';
6262
6363 $wgHooks['EditPageMergeChanges'][] = 'EditConflict::doEditConflict';
6464 $wgHooks['MakeGlobalVariablesScript'][] = 'EditConflict::jsWikiMessages';
Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -144,10 +144,10 @@
145145 /***** register special pages hooks *****/
146146 /**********************************************/
147147 $wgAutoloadClasses['MV_SpecialCRUDStream'] = dirname( __FILE__ ) . '/specials/MV_SpecialCRUDStream.php';
148 - $wgSpecialPages['Mv_Add_Stream'] = array( 'MV_SpecialCRUDStream' );
 148+ $wgSpecialPages['Mv_Add_Stream'] = 'MV_SpecialCRUDStream';
149149
150150 $wgAutoloadClasses['MV_SpecialListStreams'] = dirname( __FILE__ ) . '/specials/MV_SpecialListStreams.php';
151 - $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' );
 151+ $wgSpecialPages['Mv_List_Streams'] = 'MV_SpecialListStreams';
152152
153153 /* special export views */
154154 $wgAutoloadClasses['MV_SpecialExport'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
@@ -158,21 +158,21 @@
159159 $wgAutoloadClasses['MvExportSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
160160 $wgAutoloadClasses['MvExportAsk'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
161161
162 - $wgSpecialPages['MvVideoFeed'] = array( 'MvVideoFeed' );
163 - $wgSpecialPages['MvExportStream'] = array( 'MvExportStream' );
164 - $wgSpecialPages['MvExportSequence'] = array( 'MvExportSequence' );
165 - $wgSpecialPages['MvExportSearch'] = array( 'MvExportSearch' );
166 - $wgSpecialPages['MvExportAsk'] = array( 'MvExportAsk' );
 162+ $wgSpecialPages['MvVideoFeed'] = 'MvVideoFeed';
 163+ $wgSpecialPages['MvExportStream'] = 'MvExportStream';
 164+ $wgSpecialPages['MvExportSequence'] = 'MvExportSequence';
 165+ $wgSpecialPages['MvExportSearch'] = 'MvExportSearch';
 166+ $wgSpecialPages['MvExportAsk'] = 'MvExportAsk';
167167
168168 $wgAutoloadClasses['MV_SpecialMediaSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php';
169 - $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' );
 169+ $wgSpecialPages['Mv_List_Streams'] = 'MV_SpecialListStreams';
170170
171171 $wgAutoloadClasses['MediaSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php';
172 - $wgSpecialPages['MediaSearch'] = array( 'MediaSearch' );
173 - $wgSpecialPages['MV_SpecialSearch'] = array( 'MV_SpecialSearch' );
 172+ $wgSpecialPages['MediaSearch'] = 'MediaSearch';
 173+ $wgSpecialPages['MV_SpecialSearch'] = 'MV_SpecialSearch';
174174
175175 $wgAutoloadClasses['MVAdmin'] = dirname( __FILE__ ) . '/specials/MV_SpecialMVAdmin.php';
176 - $wgSpecialPages['MVAdmin'] = array( 'MVAdmin' );
 176+ $wgSpecialPages['MVAdmin'] = 'MVAdmin';
177177 // require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php');
178178 // require_once( dirname(__FILE__) . '/specials/MV_SpecialListStreams.php');
179179 // require_once( dirname(__FILE__) . '/specials/MV_SpecialExport.php');

Comments

#Comment by 😂 (talk | contribs)   14:47, 14 April 2011

No, where it calls parent::__construct() :)

#Comment by Happy-melon (talk | contribs)   14:48, 14 April 2011

Given that I just slapped a wfDeprecated() on the B/C for old constructors, yes indeed :D

Status & tagging log