r100922 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100921‎ | r100922 | r100923 >
Date:00:46, 27 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Documentation

Deprecated code updates
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiBlock.php (modified) (history)
  • /trunk/phase3/includes/api/ApiDelete.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFeedContributions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFeedWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUsers.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUnblock.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -52,7 +52,7 @@
5353 * Get an array mapping token names to their handler functions.
5454 * The prototype for a token function is func($pageid, $title, $rc)
5555 * it should return a token or false (permission denied)
56 - * @return array(tokenname => function)
 56+ * @return array array(tokenname => function)
5757 */
5858 protected function getTokenFunctions() {
5959 // Don't call the hooks twice
@@ -89,7 +89,7 @@
9090 // The patrol token is always the same, let's exploit that
9191 static $cachedPatrolToken = null;
9292 if ( is_null( $cachedPatrolToken ) ) {
93 - $cachedPatrolToken = $wgUser->editToken( 'patrol' );
 93+ $cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
9494 }
9595
9696 return $cachedPatrolToken;
Index: trunk/phase3/includes/api/ApiParse.php
@@ -390,6 +390,8 @@
391391 /**
392392 * @deprecated since 1.18 No modern skin generates language links this way, please use language links
393393 * data to generate your own HTML.
 394+ * @param $languages array
 395+ * @return string
394396 */
395397 private function languagesHtml( $languages ) {
396398 global $wgContLang, $wgHideInterlanguageLinks;
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -132,7 +132,7 @@
133133
134134 if ( $fld_token ) {
135135 // Undelete tokens are identical for all pages, so we cache one here
136 - $token = $user->editToken( '', $this->getMain()->getRequest() );
 136+ $token = $user->getEditToken( '', $this->getMain()->getRequest() );
137137 }
138138
139139 $dir = $params['dir'];
Index: trunk/phase3/includes/api/ApiDelete.php
@@ -98,20 +98,15 @@
9999 }
100100
101101 /**
102 - *
103 - * @param &$title Title
 102+ * @param $title Title
104103 * @param $token String
 104+ * @return array
105105 */
106106 private static function getPermissionsError( &$title, $token ) {
107107 global $wgUser;
108108
109109 // Check permissions
110 - $errors = $title->getUserPermissionsErrors( 'delete', $wgUser );
111 - if ( count( $errors ) > 0 ) {
112 - return $errors;
113 - }
114 -
115 - return array();
 110+ return $title->getUserPermissionsErrors( 'delete', $wgUser );
116111 }
117112
118113 /**
Index: trunk/phase3/includes/api/ApiFormatBase.php
@@ -235,8 +235,10 @@
236236 public function getBuffer() {
237237 return $this->mBuffer;
238238 }
 239+
239240 /**
240241 * Set the flag to buffer the result instead of printing it.
 242+ * @param $value bool
241243 */
242244 public function setBufferResult( $value ) {
243245 $this->mBufferResult = $value;
@@ -335,6 +337,8 @@
336338
337339 /**
338340 * Feed does its own headers
 341+ *
 342+ * @return null
339343 */
340344 public function getMimeType() {
341345 return null;
Index: trunk/phase3/includes/api/ApiUnblock.php
@@ -49,7 +49,7 @@
5050 $params = $this->extractRequestParams();
5151
5252 if ( $params['gettoken'] ) {
53 - $res['unblocktoken'] = $user->editToken( '', $this->getMain()->getRequest() );
 53+ $res['unblocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
5454 $this->getResult()->addValue( null, $this->getModuleName(), $res );
5555 return;
5656 }
Index: trunk/phase3/includes/api/ApiQueryUserInfo.php
@@ -110,7 +110,7 @@
111111 if ( isset( $this->prop['preferencestoken'] ) &&
112112 is_null( $this->getMain()->getRequest()->getVal( 'callback' ) )
113113 ) {
114 - $vals['preferencestoken'] = $user->editToken( '', $this->getMain()->getRequest() );
 114+ $vals['preferencestoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
115115 }
116116
117117 if ( isset( $this->prop['editcount'] ) ) {
Index: trunk/phase3/includes/api/ApiFeedContributions.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 /**
54 *
65 *
@@ -206,4 +205,4 @@
207206 public function getVersion() {
208207 return __CLASS__ . ': $Id$';
209208 }
210 -}
\ No newline at end of file
 209+}
Index: trunk/phase3/includes/api/ApiBlock.php
@@ -52,7 +52,7 @@
5353 $params = $this->extractRequestParams();
5454
5555 if ( $params['gettoken'] ) {
56 - $res['blocktoken'] = $user->editToken( '', $this->getMain()->getRequest() );
 56+ $res['blocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
5757 $this->getResult()->addValue( null, $this->getModuleName(), $res );
5858 return;
5959 }
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -84,8 +84,8 @@
8585 if ( !$wgUser->isAllowed( 'rollback' ) ) {
8686 return false;
8787 }
88 - return $wgUser->editToken( array( $title->getPrefixedText(),
89 - $rev->getUserText() ) );
 88+ return $wgUser->getEditToken(
 89+ array( $title->getPrefixedText(), $rev->getUserText() ) );
9090 }
9191
9292 public function execute() {
Index: trunk/phase3/includes/api/ApiBase.php
@@ -436,6 +436,7 @@
437437 * Callback for preg_replace_callback() call in makeHelpMsg().
438438 * Replaces a source file name with a link to ViewVC
439439 *
 440+ * @param $matches array
440441 * @return string
441442 */
442443 public function makeHelpMsg_callback( $matches ) {
Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -119,7 +119,7 @@
120120 return $cachedEditToken;
121121 }
122122
123 - $cachedEditToken = $wgUser->editToken();
 123+ $cachedEditToken = $wgUser->getEditToken();
124124 return $cachedEditToken;
125125 }
126126
@@ -134,7 +134,7 @@
135135 return $cachedDeleteToken;
136136 }
137137
138 - $cachedDeleteToken = $wgUser->editToken();
 138+ $cachedDeleteToken = $wgUser->getEditToken();
139139 return $cachedDeleteToken;
140140 }
141141
@@ -149,7 +149,7 @@
150150 return $cachedProtectToken;
151151 }
152152
153 - $cachedProtectToken = $wgUser->editToken();
 153+ $cachedProtectToken = $wgUser->getEditToken();
154154 return $cachedProtectToken;
155155 }
156156
@@ -164,7 +164,7 @@
165165 return $cachedMoveToken;
166166 }
167167
168 - $cachedMoveToken = $wgUser->editToken();
 168+ $cachedMoveToken = $wgUser->getEditToken();
169169 return $cachedMoveToken;
170170 }
171171
@@ -179,7 +179,7 @@
180180 return $cachedBlockToken;
181181 }
182182
183 - $cachedBlockToken = $wgUser->editToken();
 183+ $cachedBlockToken = $wgUser->getEditToken();
184184 return $cachedBlockToken;
185185 }
186186
@@ -199,7 +199,7 @@
200200 return $cachedEmailToken;
201201 }
202202
203 - $cachedEmailToken = $wgUser->editToken();
 203+ $cachedEmailToken = $wgUser->getEditToken();
204204 return $cachedEmailToken;
205205 }
206206
@@ -214,7 +214,7 @@
215215 return $cachedImportToken;
216216 }
217217
218 - $cachedImportToken = $wgUser->editToken();
 218+ $cachedImportToken = $wgUser->getEditToken();
219219 return $cachedImportToken;
220220 }
221221
@@ -229,7 +229,7 @@
230230 return $cachedWatchToken;
231231 }
232232
233 - $cachedWatchToken = $wgUser->editToken( 'watch' );
 233+ $cachedWatchToken = $wgUser->getEditToken( 'watch' );
234234 return $cachedWatchToken;
235235 }
236236
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php
@@ -152,6 +152,10 @@
153153 }
154154 }
155155
 156+ /**
 157+ * @param $info array
 158+ * @return FeedItem
 159+ */
156160 private function createFeedItem( $info ) {
157161 $titleStr = $info['title'];
158162 $title = Title::newFromText( $titleStr );
Index: trunk/phase3/includes/api/ApiQueryUsers.php
@@ -74,7 +74,7 @@
7575 global $wgUser;
7676 // Since the permissions check for userrights is non-trivial,
7777 // don't bother with it here
78 - return $wgUser->editToken( $user->getName() );
 78+ return $wgUser->getEditToken( $user->getName() );
7979 }
8080
8181 public function execute() {

Status & tagging log