Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | if ( is_null( $cachedPatrolToken ) ) { |
86 | 86 | $cachedPatrolToken = $wgUser->editToken( 'patrol' ); |
87 | 87 | } |
88 | | - |
| 88 | + |
89 | 89 | return $cachedPatrolToken; |
90 | 90 | } |
91 | 91 | |
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -324,44 +324,44 @@ |
325 | 325 | |
326 | 326 | protected function appendUserGroups( $property, $numberInGroup ) { |
327 | 327 | global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; |
328 | | - |
| 328 | + |
329 | 329 | $data = array(); |
330 | 330 | foreach ( $wgGroupPermissions as $group => $permissions ) { |
331 | 331 | $arr = array( |
332 | 332 | 'name' => $group, |
333 | 333 | 'rights' => array_keys( $permissions, true ), |
334 | 334 | ); |
335 | | - |
| 335 | + |
336 | 336 | if ( $numberInGroup ) { |
337 | 337 | global $wgAutopromote; |
338 | | - |
| 338 | + |
339 | 339 | if ( $group == 'user' ) { |
340 | 340 | $arr['number'] = SiteStats::users(); |
341 | | - |
| 341 | + |
342 | 342 | // '*' and autopromote groups have no size |
343 | 343 | } elseif ( $group !== '*' && !isset( $wgAutopromote[$group] ) ) { |
344 | 344 | $arr['number'] = SiteStats::numberInGroup( $group ); |
345 | 345 | } |
346 | 346 | } |
347 | | - |
| 347 | + |
348 | 348 | $groupArr = array( |
349 | 349 | 'add' => $wgAddGroups, |
350 | 350 | 'remove' => $wgRemoveGroups, |
351 | 351 | 'add-self' => $wgGroupsAddToSelf, |
352 | 352 | 'remove-self' => $wgGroupsRemoveFromSelf |
353 | 353 | ); |
354 | | - |
355 | | - foreach( $groupArr as $type => $rights ) { |
356 | | - if( isset( $rights[$group] ) ) { |
| 354 | + |
| 355 | + foreach ( $groupArr as $type => $rights ) { |
| 356 | + if ( isset( $rights[$group] ) ) { |
357 | 357 | $arr[$type] = $rights[$group]; |
358 | 358 | $this->getResult()->setIndexedTagName( $arr[$type], 'group' ); |
359 | 359 | } |
360 | 360 | } |
361 | | - |
| 361 | + |
362 | 362 | $this->getResult()->setIndexedTagName( $arr['rights'], 'permission' ); |
363 | 363 | $data[] = $arr; |
364 | 364 | } |
365 | | - |
| 365 | + |
366 | 366 | $this->getResult()->setIndexedTagName( $data, 'group' ); |
367 | 367 | return $this->getResult()->addValue( 'query', $property, $data ); |
368 | 368 | } |
Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | |
95 | 95 | $wgTitle = $titleObj; |
96 | 96 | |
97 | | - //If for some reason the "oldid" is actually the current revision, it may be cached |
| 97 | + // If for some reason the "oldid" is actually the current revision, it may be cached |
98 | 98 | if ( $titleObj->getLatestRevID() === $oldid ) { |
99 | 99 | $p_result = false; |
100 | 100 | $pcache = ParserCache::singleton(); |
Index: trunk/phase3/includes/api/ApiQueryAllpages.php |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) ); |
77 | 77 | $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) ); |
78 | 78 | $this->addWhereRange( 'page_title', $dir, $from, $to ); |
79 | | - |
| 79 | + |
80 | 80 | if ( isset( $params['prefix'] ) ) { |
81 | 81 | $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) ); |
82 | 82 | } |
Index: trunk/phase3/includes/api/ApiQueryPageProps.php |
— | — | @@ -44,54 +44,54 @@ |
45 | 45 | |
46 | 46 | public function execute() { |
47 | 47 | $this->params = $this->extractRequestParams(); |
48 | | - |
| 48 | + |
49 | 49 | # Only operate on existing pages |
50 | 50 | $pages = $this->getPageSet()->getGoodTitles(); |
51 | 51 | if ( !count( $pages ) ) { |
52 | 52 | # Nothing to do |
53 | 53 | return; |
54 | 54 | } |
55 | | - |
| 55 | + |
56 | 56 | $this->addTables( 'page_props' ); |
57 | 57 | $this->addFields( array( 'pp_page', 'pp_propname', 'pp_value' ) ); |
58 | 58 | $this->addWhereFld( 'pp_page', array_keys( $pages ) ); |
59 | | - |
| 59 | + |
60 | 60 | if ( $this->params['continue'] ) { |
61 | 61 | $this->addWhere( 'pp_page >=' . intval( $this->params['continue'] ) ); |
62 | 62 | } |
63 | | - |
| 63 | + |
64 | 64 | # Force a sort order to ensure that properties are grouped by page |
65 | 65 | $this->addOption( 'ORDER BY', 'pp_page' ); |
66 | | - |
| 66 | + |
67 | 67 | $res = $this->select( __METHOD__ ); |
68 | 68 | $currentPage = 0; # Id of the page currently processed |
69 | 69 | $props = array(); |
70 | 70 | $result = $this->getResult(); |
71 | | - |
| 71 | + |
72 | 72 | foreach ( $res as $row ) { |
73 | 73 | if ( $currentPage != $row->pp_page ) { |
74 | | - # Different page than previous row, so add the properties to |
| 74 | + # Different page than previous row, so add the properties to |
75 | 75 | # the result and save the new page id |
76 | | - |
| 76 | + |
77 | 77 | if ( $currentPage ) { |
78 | 78 | if ( !$this->addPageProps( $result, $currentPage, $props ) ) { |
79 | 79 | # addPageProps() indicated that the result did not fit |
80 | 80 | # so stop adding data. Reset props so that it doesn't |
81 | 81 | # get added again after loop exit |
82 | | - |
| 82 | + |
83 | 83 | $props = array(); |
84 | 84 | break; |
85 | 85 | } |
86 | | - |
| 86 | + |
87 | 87 | $props = array(); |
88 | 88 | } |
89 | | - |
| 89 | + |
90 | 90 | $currentPage = $row->pp_page; |
91 | 91 | } |
92 | | - |
| 92 | + |
93 | 93 | $props[$row->pp_propname] = $row->pp_value; |
94 | 94 | } |
95 | | - |
| 95 | + |
96 | 96 | if ( count( $props ) ) { |
97 | 97 | # Add any remaining properties to the results |
98 | 98 | $this->addPageProps( $result, $currentPage, $props ); |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | | - * Add page properties to an ApiResult, adding a continue |
| 103 | + * Add page properties to an ApiResult, adding a continue |
104 | 104 | * parameter if it doesn't fit. |
105 | 105 | * |
106 | 106 | * @param $result ApiResult |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | */ |
111 | 111 | private function addPageProps( $result, $page, $props ) { |
112 | 112 | $fit = $result->addValue( array( 'query', 'pages' ), $page, $props ); |
113 | | - |
| 113 | + |
114 | 114 | if ( !$fit ) { |
115 | 115 | $this->setContinueEnumParameter( 'continue', $page ); |
116 | 116 | } |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | return 'public'; |
122 | 122 | } |
123 | 123 | |
124 | | - public function getAllowedParams() { |
| 124 | + public function getAllowedParams() { |
125 | 125 | return array( 'continue' => null ); |
126 | 126 | } |
127 | 127 | |
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php |
— | — | @@ -248,9 +248,9 @@ |
249 | 249 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
250 | 250 | // We need to keep the parent page of this redir in |
251 | 251 | if ( $this->hasNS ) { |
252 | | - $parentID = $this->pageMap[$row->{$this->bl_ns}][$row->{$this->bl_title}]; |
| 252 | + $parentID = $this->pageMap[$row-> { $this->bl_ns } ][$row-> { $this->bl_title } ]; |
253 | 253 | } else { |
254 | | - $parentID = $this->pageMap[NS_IMAGE][$row->{$this->bl_title}]; |
| 254 | + $parentID = $this->pageMap[NS_IMAGE][$row-> { $this->bl_title } ]; |
255 | 255 | } |
256 | 256 | $this->continueStr = $this->getContinueRedirStr( $parentID, $row->page_id ); |
257 | 257 | break; |
Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -57,32 +57,32 @@ |
58 | 58 | if ( !$titleObj || $titleObj->isExternal() ) { |
59 | 59 | $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); |
60 | 60 | } |
61 | | - |
62 | | - if( $params['redirect'] ) { |
63 | | - if( $titleObj->isRedirect() ) { |
| 61 | + |
| 62 | + if ( $params['redirect'] ) { |
| 63 | + if ( $titleObj->isRedirect() ) { |
64 | 64 | $oldTitle = $titleObj; |
65 | | - |
| 65 | + |
66 | 66 | $titles = Title::newFromRedirectArray( Revision::newFromTitle( $oldTitle )->getText( Revision::FOR_THIS_USER ) ); |
67 | | - //array_shift( $titles ); |
68 | | - |
| 67 | + // array_shift( $titles ); |
| 68 | + |
69 | 69 | $this->getResult()->addValue( null, 'foo', $titles ); |
70 | | - |
71 | | - |
| 70 | + |
| 71 | + |
72 | 72 | $redirValues = array(); |
73 | 73 | foreach ( $titles as $id => $newTitle ) { |
74 | | - |
75 | | - if( !isset( $titles[ $id - 1 ] ) ) { |
| 74 | + |
| 75 | + if ( !isset( $titles[ $id - 1 ] ) ) { |
76 | 76 | $titles[ $id - 1 ] = $oldTitle; |
77 | 77 | } |
78 | | - |
| 78 | + |
79 | 79 | $redirValues[] = array( |
80 | 80 | 'from' => $titles[ $id - 1 ]->getPrefixedText(), |
81 | 81 | 'to' => $newTitle->getPrefixedText() |
82 | 82 | ); |
83 | | - |
| 83 | + |
84 | 84 | $titleObj = $newTitle; |
85 | 85 | } |
86 | | - |
| 86 | + |
87 | 87 | $this->getResult()->setIndexedTagName( $redirValues, 'r' ); |
88 | 88 | $this->getResult()->addValue( null, 'redirects', $redirValues ); |
89 | 89 | |
Index: trunk/phase3/includes/api/ApiQueryAllmessages.php |
— | — | @@ -83,8 +83,8 @@ |
84 | 84 | if ( $skip && $message === $params['from'] ) { |
85 | 85 | $skip = false; |
86 | 86 | } |
87 | | - |
88 | | - if( $useto && $message > $params['to'] ) { |
| 87 | + |
| 88 | + if ( $useto && $message > $params['to'] ) { |
89 | 89 | break; |
90 | 90 | } |
91 | 91 | |
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php |
— | — | @@ -285,7 +285,7 @@ |
286 | 286 | if ( $this->fld_userid ) { |
287 | 287 | $vals['userid'] = $row->user_id; |
288 | 288 | } |
289 | | - |
| 289 | + |
290 | 290 | if ( !$row->log_user ) { |
291 | 291 | $vals['anon'] = ''; |
292 | 292 | } |
Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | private $mPropModuleNames, $mListModuleNames, $mMetaModuleNames; |
47 | 47 | |
48 | 48 | /** |
49 | | - * @var ApiPageSet |
| 49 | + * @var ApiPageSet |
50 | 50 | */ |
51 | 51 | private $mPageSet; |
52 | 52 | |
— | — | @@ -471,7 +471,7 @@ |
472 | 472 | private function doExport( $pageSet, $result ) { |
473 | 473 | $exportTitles = array(); |
474 | 474 | $titles = $pageSet->getGoodTitles(); |
475 | | - if( count( $titles ) ) { |
| 475 | + if ( count( $titles ) ) { |
476 | 476 | foreach ( $titles as $title ) { |
477 | 477 | if ( $title->userCanRead() ) { |
478 | 478 | $exportTitles[] = $title; |
Index: trunk/phase3/includes/api/ApiRsd.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | parent::__construct( $main, $format ); |
171 | 171 | $this->setRootElement( 'rsd' ); |
172 | 172 | } |
173 | | - |
| 173 | + |
174 | 174 | public function getMimeType() { |
175 | 175 | return 'application/rsd+xml'; |
176 | 176 | } |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | } |
238 | 238 | |
239 | 239 | if ( $this->fld_userid ) { |
240 | | - $vals['user'] = $row->rc_user; |
| 240 | + $vals['user'] = $row->rc_user; |
241 | 241 | } |
242 | 242 | |
243 | 243 | if ( !$row->rc_user ) { |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | $this->getResult()->setParsedLimit( $this->getModuleName(), $limit ); |
171 | 171 | } |
172 | 172 | |
173 | | - |
| 173 | + |
174 | 174 | if ( !is_null( $this->token ) || $pageCount > 0 ) { |
175 | 175 | $this->addFields( Revision::selectPageFields() ); |
176 | 176 | } |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | | - //Bug 24166 - API error when using rvprop=tags |
| 228 | + // Bug 24166 - API error when using rvprop=tags |
229 | 229 | $this->addTables( 'revision' ); |
230 | 230 | |
231 | 231 | |
— | — | @@ -480,10 +480,10 @@ |
481 | 481 | } |
482 | 482 | if ( $this->parseContent ) { |
483 | 483 | global $wgEnableParserCache; |
484 | | - |
| 484 | + |
485 | 485 | $popts = new ParserOptions(); |
486 | 486 | $popts->setTidy( true ); |
487 | | - |
| 487 | + |
488 | 488 | $articleObj = new Article( $title ); |
489 | 489 | |
490 | 490 | $p_result = false; |
— | — | @@ -498,7 +498,7 @@ |
499 | 499 | $pcache->save( $p_result, $articleObj, $popts ); |
500 | 500 | } |
501 | 501 | } |
502 | | - |
| 502 | + |
503 | 503 | $text = $p_result->getText(); |
504 | 504 | } |
505 | 505 | ApiResult::setContent( $vals, $text ); |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -373,7 +373,7 @@ |
374 | 374 | $isArray = is_array( $paramSettings[self::PARAM_TYPE] ); |
375 | 375 | |
376 | 376 | if ( !$isArray |
377 | | - || $isArray && count( $paramSettings[self::PARAM_TYPE] ) > self::LIMIT_SML1) { |
| 377 | + || $isArray && count( $paramSettings[self::PARAM_TYPE] ) > self::LIMIT_SML1 ) { |
378 | 378 | $desc .= $paramPrefix . "Maximum number of values " . |
379 | 379 | self::LIMIT_SML1 . " (" . self::LIMIT_SML2 . " for bots)"; |
380 | 380 | } |
Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -86,25 +86,25 @@ |
87 | 87 | |
88 | 88 | // Prepare the API result |
89 | 89 | $result = array(); |
90 | | - |
| 90 | + |
91 | 91 | $warnings = $this->getApiWarnings(); |
92 | | - if ( $warnings ) { |
| 92 | + if ( $warnings ) { |
93 | 93 | $result['result'] = 'Warning'; |
94 | 94 | $result['warnings'] = $warnings; |
95 | 95 | // in case the warnings can be fixed with some further user action, let's stash this upload |
96 | 96 | // and return a key they can use to restart it |
97 | | - try { |
| 97 | + try { |
98 | 98 | $result['sessionkey'] = $this->performStash(); |
99 | | - } catch ( MWException $e ) { |
| 99 | + } catch ( MWException $e ) { |
100 | 100 | $result['warnings']['stashfailed'] = $e->getMessage(); |
101 | 101 | } |
102 | | - } elseif ( $this->mParams['stash'] ) { |
| 102 | + } elseif ( $this->mParams['stash'] ) { |
103 | 103 | // Some uploads can request they be stashed, so as not to publish them immediately. |
104 | 104 | // In this case, a failure to stash ought to be fatal |
105 | 105 | try { |
106 | | - $result['result'] = 'Success'; |
| 106 | + $result['result'] = 'Success'; |
107 | 107 | $result['sessionkey'] = $this->performStash(); |
108 | | - } catch ( MWException $e ) { |
| 108 | + } catch ( MWException $e ) { |
109 | 109 | $this->dieUsage( $e->getMessage(), 'stashfailed' ); |
110 | 110 | } |
111 | 111 | } else { |
— | — | @@ -113,12 +113,12 @@ |
114 | 114 | $result = $this->performUpload(); |
115 | 115 | } |
116 | 116 | |
117 | | - if ( $result['result'] === 'Success' ) { |
| 117 | + if ( $result['result'] === 'Success' ) { |
118 | 118 | $result['imageinfo'] = $this->mUpload->getImageInfo( $this->getResult() ); |
119 | 119 | } |
120 | 120 | |
121 | 121 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
122 | | - |
| 122 | + |
123 | 123 | // Cleanup any temporary mess |
124 | 124 | $this->mUpload->cleanupTempFile(); |
125 | 125 | } |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | try { |
135 | 135 | $sessionKey = $this->mUpload->stashSessionFile()->getSessionKey(); |
136 | 136 | } catch ( MWException $e ) { |
137 | | - throw new MWException( 'Stashing temporary file failed: ' . get_class($e) . ' ' . $e->getMessage() ); |
| 137 | + throw new MWException( 'Stashing temporary file failed: ' . get_class( $e ) . ' ' . $e->getMessage() ); |
138 | 138 | } |
139 | 139 | return $sessionKey; |
140 | 140 | } |
— | — | @@ -141,9 +141,9 @@ |
142 | 142 | |
143 | 143 | /** |
144 | 144 | * Select an upload module and set it to mUpload. Dies on failure. If the |
145 | | - * request was a status request and not a true upload, returns false; |
| 145 | + * request was a status request and not a true upload, returns false; |
146 | 146 | * otherwise true |
147 | | - * |
| 147 | + * |
148 | 148 | * @return bool |
149 | 149 | */ |
150 | 150 | protected function selectUploadModule() { |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | // Status request for an async upload |
160 | 160 | $sessionData = UploadFromUrlJob::getSessionData( $this->mParams['statuskey'] ); |
161 | 161 | if ( !isset( $sessionData['result'] ) ) { |
162 | | - $this->dieUsage( 'No result in session data', 'missingresult'); |
| 162 | + $this->dieUsage( 'No result in session data', 'missingresult' ); |
163 | 163 | } |
164 | 164 | if ( $sessionData['result'] == 'Warning' ) { |
165 | 165 | $sessionData['warnings'] = $this->transformWarnings( $sessionData['warnings'] ); |
— | — | @@ -166,16 +166,16 @@ |
167 | 167 | } |
168 | 168 | $this->getResult()->addValue( null, $this->getModuleName(), $sessionData ); |
169 | 169 | return false; |
170 | | - |
171 | | - } |
172 | 170 | |
| 171 | + } |
173 | 172 | |
| 173 | + |
174 | 174 | // The following modules all require the filename parameter to be set |
175 | 175 | if ( is_null( $this->mParams['filename'] ) ) { |
176 | 176 | $this->dieUsageMsg( array( 'missingparam', 'filename' ) ); |
177 | 177 | } |
178 | | - |
179 | 178 | |
| 179 | + |
180 | 180 | if ( $this->mParams['sessionkey'] ) { |
181 | 181 | // Upload stashed in a previous request |
182 | 182 | $sessionData = $request->getSessionData( UploadBase::getSessionKeyName() ); |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | $this->dieUsage( 'Using leavemessage without ignorewarnings is not supported', |
209 | 209 | 'missing-ignorewarnings' ); |
210 | 210 | } |
211 | | - |
| 211 | + |
212 | 212 | if ( $this->mParams['leavemessage'] ) { |
213 | 213 | $async = 'async-leavemessage'; |
214 | 214 | } else { |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | $this->mParams['url'], $async ); |
221 | 221 | |
222 | 222 | } |
223 | | - |
| 223 | + |
224 | 224 | return true; |
225 | 225 | } |
226 | 226 | |
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | 'allrev' => 'Include multiple revisions of the same page within given timeframe', |
191 | 191 | 'wlowner' => "The user whose watchlist you want (must be accompanied by {$this->getModulePrefix()}token if it's not you)", |
192 | 192 | 'wltoken' => 'Security token that requested user set in their preferences', |
193 | | - 'linktodiffs'=> 'Link to change differences instead of article pages' |
| 193 | + 'linktodiffs' => 'Link to change differences instead of article pages' |
194 | 194 | ); |
195 | 195 | } |
196 | 196 | |