r111092 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111091‎ | r111092 | r111093 >
Date:21:08, 9 February 2012
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Fixing up undefined types in maintenance documentation
Modified paths:
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)
  • /trunk/phase3/maintenance/backup.inc (modified) (history)
  • /trunk/phase3/maintenance/dumpTextPass.php (modified) (history)
  • /trunk/phase3/maintenance/findHooks.php (modified) (history)
  • /trunk/phase3/maintenance/fuzz-tester.php (modified) (history)
  • /trunk/phase3/maintenance/generateSitemap.php (modified) (history)
  • /trunk/phase3/maintenance/importImages.inc (modified) (history)
  • /trunk/phase3/maintenance/language/checkLanguage.inc (modified) (history)
  • /trunk/phase3/maintenance/language/languages.inc (modified) (history)
  • /trunk/phase3/maintenance/language/rebuildLanguage.php (modified) (history)
  • /trunk/phase3/maintenance/language/writeMessagesArray.inc (modified) (history)
  • /trunk/phase3/maintenance/locking/LockServerDaemon.php (modified) (history)
  • /trunk/phase3/maintenance/reassignEdits.php (modified) (history)
  • /trunk/phase3/maintenance/rebuildLocalisationCache.php (modified) (history)
  • /trunk/phase3/maintenance/refreshLinks.php (modified) (history)
  • /trunk/phase3/maintenance/removeUnusedAccounts.php (modified) (history)
  • /trunk/phase3/maintenance/upgrade1_5.php (modified) (history)
  • /trunk/phase3/maintenance/userOptions.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/fuzz-tester.php
@@ -817,7 +817,7 @@
818818 * Returns the matched character slash-escaped as in a C string
819819 * Helper for makeTitleSafe callback
820820 * @param $matches
821 - * @return atring
 821+ * @return string
822822 */
823823 static private function stringEscape( $matches ) {
824824 return sprintf( "\\x%02x", ord( $matches[1] ) );
Index: trunk/phase3/maintenance/generateSitemap.php
@@ -264,7 +264,7 @@
265265 * @return String
266266 */
267267 function guessPriority( $namespace ) {
268 - return MWNamespace::isMain( $namespace ) ? $this->priorities[self::GS_MAIN] : $this->priorities[self::GS_TALK];
 268+ return MWNamespace::isSubject( $namespace ) ? $this->priorities[self::GS_MAIN] : $this->priorities[self::GS_TALK];
269269 }
270270
271271 /**
Index: trunk/phase3/maintenance/refreshLinks.php
@@ -230,8 +230,8 @@
231231 * Removes non-existing links from pages from pagelinks, imagelinks,
232232 * categorylinks, templatelinks, externallinks, interwikilinks, langlinks and redirect tables.
233233 *
234 - * @param $maxLag
235 - * @param $batchSize The size of deletion batches
 234+ * @param $maxLag int
 235+ * @param $batchSize int The size of deletion batches
236236 *
237237 * @author Merlijn van Deen <valhallasw@arctus.nl>
238238 */
Index: trunk/phase3/maintenance/userOptions.inc
@@ -76,7 +76,7 @@
7777 * @param $opts array
7878 * @param $args array
7979 *
80 - * @return true
 80+ * @return bool
8181 */
8282 private function initializeOpts( $opts, $args ) {
8383
Index: trunk/phase3/maintenance/removeUnusedAccounts.php
@@ -86,7 +86,7 @@
8787 * (No edits, no deleted edits, no log entries, no current/old uploads)
8888 *
8989 * @param $id User's ID
90 - * @param $master Perform checking on the master
 90+ * @param $master bool Perform checking on the master
9191 * @return bool
9292 */
9393 private function isInactiveAccount( $id, $master = false ) {
Index: trunk/phase3/maintenance/importImages.inc
@@ -26,7 +26,7 @@
2727 /**
2828 * Search a directory for files with one of a set of extensions
2929 *
30 - * @param $dir Path to directory to search
 30+ * @param $dir string Path to directory to search
3131 * @param $exts Array of extensions to search for
3232 * @return mixed Array of filenames on success, or false on failure
3333 */
@@ -74,9 +74,9 @@
7575 * files for acme.foo.bar and the extension ".txt". With $maxStrip = 2,
7676 * acme.txt would also be acceptable.
7777 *
78 - * @param $file base path
79 - * @param $auxExtension the extension to be appended to the base path
80 - * @param $maxStrip the maximum number of extensions to strip from the base path (default: 1)
 78+ * @param $file string base path
 79+ * @param $auxExtension string the extension to be appended to the base path
 80+ * @param $maxStrip int the maximum number of extensions to strip from the base path (default: 1)
8181 * @return string or false
8282 */
8383 function findAuxFile( $file, $auxExtension, $maxStrip = 1 ) {
Index: trunk/phase3/maintenance/backup.inc
@@ -262,7 +262,7 @@
263263
264264 // Discourage the server from disconnecting us if it takes a long time
265265 // to read out the big ol' batch query.
266 - $db->setTimeout( 3600 * 24 );
 266+ $db->setSessionOptions( array( 'connTimeout' => 3600 * 24 ) );
267267
268268 return $db;
269269 }
Index: trunk/phase3/maintenance/findHooks.php
@@ -157,7 +157,7 @@
158158
159159 /**
160160 * Get hooks from a PHP file
161 - * @param $file Full filename to the PHP file.
 161+ * @param $file string Full filename to the PHP file.
162162 * @return array of hooks found.
163163 */
164164 private function getHooksFromFile( $file ) {
@@ -188,7 +188,7 @@
189189
190190 /**
191191 * Get bad hooks (where the hook name could not be determined) from a PHP file
192 - * @param $file Full filename to the PHP file.
 192+ * @param $file string Full filename to the PHP file.
193193 * @return array of bad wfRunHooks() lines
194194 */
195195 private function getBadHooksFromFile( $file ) {
Index: trunk/phase3/maintenance/Maintenance.php
@@ -366,7 +366,7 @@
367367 * same channel are concatenated, but any intervening messages in another
368368 * channel start a new line.
369369 * @param $msg String: the message without trailing newline
370 - * @param $channel Channel identifier or null for no
 370+ * @param $channel string Channel identifier or null for no
371371 * channel. Channel comparison uses ===.
372372 */
373373 public function outputChanneled( $msg, $channel = null ) {
@@ -1080,7 +1080,7 @@
10811081
10821082 /**
10831083 * Lock the search index
1084 - * @param &$db Database object
 1084+ * @param &$db DatabaseBase object
10851085 */
10861086 private function lockSearchindex( &$db ) {
10871087 $write = array( 'searchindex' );
@@ -1090,7 +1090,7 @@
10911091
10921092 /**
10931093 * Unlock the tables
1094 - * @param &$db Database object
 1094+ * @param &$db DatabaseBase object
10951095 */
10961096 private function unlockSearchindex( &$db ) {
10971097 $db->unlockTables( __CLASS__ . '::' . __METHOD__ );
@@ -1099,7 +1099,7 @@
11001100 /**
11011101 * Unlock and lock again
11021102 * Since the lock is low-priority, queued reads will be able to complete
1103 - * @param &$db Database object
 1103+ * @param &$db DatabaseBase object
11041104 */
11051105 private function relockSearchindex( &$db ) {
11061106 $this->unlockSearchindex( $db );
@@ -1147,7 +1147,7 @@
11481148
11491149 /**
11501150 * Update the searchindex table for a given pageid
1151 - * @param $dbw Database: a database write handle
 1151+ * @param $dbw DatabaseBase a database write handle
11521152 * @param $pageId Integer: the page ID to update.
11531153 * @return null|string
11541154 */
Index: trunk/phase3/maintenance/reassignEdits.php
@@ -62,8 +62,8 @@
6363 *
6464 * @param $from User to take edits from
6565 * @param $to User to assign edits to
66 - * @param $rc Update the recent changes table
67 - * @param $report Don't change things; just echo numbers
 66+ * @param $rc bool Update the recent changes table
 67+ * @param $report bool Don't change things; just echo numbers
6868 * @return integer Number of entries changed, or that would be changed
6969 */
7070 private function doReassignEdits( &$from, &$to, $rc = false, $report = false ) {
@@ -150,7 +150,7 @@
151151 /**
152152 * Initialise the user object
153153 *
154 - * @param $username Username or IP address
 154+ * @param $username string Username or IP address
155155 * @return User
156156 */
157157 private function initialiseUser( $username ) {
Index: trunk/phase3/maintenance/rebuildLocalisationCache.php
@@ -111,7 +111,7 @@
112112 /**
113113 * Helper function to rebuild list of languages codes. Prints the code
114114 * for each language which is rebuilt.
115 - * @param $codes list List of language codes to rebuild.
 115+ * @param $codes array List of language codes to rebuild.
116116 * @param $lc LocalisationCache Instance of LocalisationCache_BulkLoad (?)
117117 * @param $force bool Rebuild up-to-date languages
118118 * @return int Number of rebuilt languages
Index: trunk/phase3/maintenance/upgrade1_5.php
@@ -116,7 +116,7 @@
117117
118118 /**
119119 * Open a connection to the master server with the admin rights.
120 - * @return Database
 120+ * @return DatabaseBase
121121 * @access private
122122 */
123123 function newConnection() {
@@ -141,7 +141,7 @@
142142 * Open a second connection to the master server, with buffering off.
143143 * This will let us stream large datasets in and write in chunks on the
144144 * other end.
145 - * @return Database
 145+ * @return DatabaseBase
146146 * @access private
147147 */
148148 function streamConnection() {
@@ -342,7 +342,7 @@
343343 * MW_UPGRADE_COPY - straight copy
344344 * MW_UPGRADE_ENCODE - for old Latin1 wikis, conv to UTF-8
345345 * MW_UPGRADE_NULL - just put NULL
346 - * @param callable $callback An optional callback to modify the data
 346+ * @param $callback callback An optional callback to modify the data
347347 * or perform other processing. Func should be
348348 * ( object $row, array $copy ) and return $copy
349349 * @access private
Index: trunk/phase3/maintenance/language/rebuildLanguage.php
@@ -30,12 +30,12 @@
3131 * Rewrite a messages array.
3232 *
3333 * @param $languages
34 - * @param $code The language code.
 34+ * @param $code string The language code.
3535 * @param bool $write Write to the messages file?
3636 * @param bool $listUnknown List the unknown messages?
3737 * @param bool $removeUnknown Remove the unknown messages?
3838 * @param bool $removeDupes Remove the duplicated messages?
39 - * @param $dupeMsgSource The source file intended to remove from the array.
 39+ * @param $dupeMsgSource string The source file intended to remove from the array.
4040 */
4141 function rebuildLanguage( $languages, $code, $write, $listUnknown, $removeUnknown, $removeDupes, $dupeMsgSource ) {
4242 $messages = $languages->getMessages( $code );
@@ -49,8 +49,8 @@
5050 /**
5151 * Remove duplicates from a message array.
5252 *
53 - * @param $oldMsgArray The input message array.
54 - * @param $dupeMsgSource The source file path for duplicates.
 53+ * @param $oldMsgArray array The input message array.
 54+ * @param $dupeMsgSource string The source file path for duplicates.
5555 * @return Array $newMsgArray The output message array, with duplicates removed.
5656 */
5757 function removeDupes( $oldMsgArray, $dupeMsgSource ) {
Index: trunk/phase3/maintenance/language/writeMessagesArray.inc
@@ -156,6 +156,7 @@
157157 * @param $messages Array: key of messages.
158158 * @param $ignored Array: list of ingored message keys.
159159 * @param $optional Array: list of optional message keys.
 160+ * @return array
160161 */
161162 public static function makeComments( $messages, $ignored, $optional ) {
162163 # Comment collector
@@ -181,7 +182,7 @@
182183 * @param $messageComments Array: optional comments for messages in this block.
183184 * @param $prefix String: prefix for every line, for indenting purposes.
184185 *
185 - * @return The block, formatted in PHP.
 186+ * @return string The block, formatted in PHP.
186187 */
187188 public static function writeMessagesBlock( $blockComment, $messages,
188189 $messageComments = array(), $prefix = '' ) {
Index: trunk/phase3/maintenance/language/checkLanguage.inc
@@ -41,7 +41,7 @@
4242
4343 /**
4444 * Constructor.
45 - * @param $options Options for script.
 45+ * @param $options array Options for script.
4646 */
4747 public function __construct( Array $options ) {
4848 if ( isset( $options['help'] ) ) {
@@ -94,7 +94,7 @@
9595
9696 /**
9797 * Get the default checks.
98 - * @return A list of the default checks.
 98+ * @return array A list of the default checks.
9999 */
100100 protected function defaultChecks() {
101101 return array(
@@ -107,7 +107,7 @@
108108
109109 /**
110110 * Get the checks which check other things than messages.
111 - * @return A list of the non-message checks.
 111+ * @return array A list of the non-message checks.
112112 */
113113 protected function nonMessageChecks() {
114114 return array(
@@ -129,7 +129,7 @@
130130
131131 /**
132132 * Get all checks.
133 - * @return An array of all check names mapped to their function names.
 133+ * @return array An array of all check names mapped to their function names.
134134 */
135135 protected function getChecks() {
136136 return array(
@@ -157,7 +157,7 @@
158158
159159 /**
160160 * Get total count for each check non-messages check.
161 - * @return An array of all check names mapped to a two-element array:
 161+ * @return array An array of all check names mapped to a two-element array:
162162 * function name to get the total count and language code or null
163163 * for checked code.
164164 */
@@ -176,7 +176,7 @@
177177
178178 /**
179179 * Get all check descriptions.
180 - * @return An array of all check names mapped to their descriptions.
 180+ * @return array An array of all check names mapped to their descriptions.
181181 */
182182 protected function getDescriptions() {
183183 return array(
@@ -204,7 +204,7 @@
205205
206206 /**
207207 * Get help.
208 - * @return The help string.
 208+ * @return string The help string.
209209 */
210210 protected function help() {
211211 return <<<ENDS
@@ -295,7 +295,7 @@
296296
297297 /**
298298 * Get the check blacklist.
299 - * @return The list of checks which should not be executed.
 299+ * @return array The list of checks which should not be executed.
300300 */
301301 protected function getCheckBlacklist() {
302302 global $checkBlacklist;
@@ -336,9 +336,9 @@
337337
338338 /**
339339 * Format a message key.
340 - * @param $key The message key.
341 - * @param $code The language code.
342 - * @return The formatted message key.
 340+ * @param $key string The message key.
 341+ * @param $code string The language code.
 342+ * @return string The formatted message key.
343343 */
344344 protected function formatKey( $key, $code ) {
345345 if ( $this->doLinks ) {
@@ -355,7 +355,6 @@
356356
357357 /**
358358 * Output the checks results as plain text.
359 - * @return The checks results as plain text.
360359 */
361360 protected function outputText() {
362361 foreach ( $this->results as $code => $results ) {
@@ -401,7 +400,6 @@
402401
403402 /**
404403 * Output the checks results as wiki text.
405 - * @return The checks results as wiki text.
406404 */
407405 function outputWiki() {
408406 global $wgContLang;
@@ -462,7 +460,7 @@
463461
464462 /**
465463 * Check if there are any results for the checks, in any language.
466 - * @return True if there are any results, false if not.
 464+ * @return bool True if there are any results, false if not.
467465 */
468466 protected function isEmpty() {
469467 foreach( $this->results as $results ) {
@@ -484,8 +482,8 @@
485483
486484 /**
487485 * Constructor.
488 - * @param $options Options for script.
489 - * @param $extension The extension name (or names).
 486+ * @param $options array Options for script.
 487+ * @param $extension string The extension name (or names).
490488 */
491489 public function __construct( Array $options, $extension ) {
492490 if ( isset( $options['help'] ) ) {
@@ -569,7 +567,7 @@
570568
571569 /**
572570 * Get the default checks.
573 - * @return A list of the default checks.
 571+ * @return array A list of the default checks.
574572 */
575573 protected function defaultChecks() {
576574 return array(
@@ -580,7 +578,7 @@
581579
582580 /**
583581 * Get the checks which check other things than messages.
584 - * @return A list of the non-message checks.
 582+ * @return array A list of the non-message checks.
585583 */
586584 protected function nonMessageChecks() {
587585 return array();
@@ -588,7 +586,7 @@
589587
590588 /**
591589 * Get the checks that can easily be treated by non-speakers of the language.
592 - * @return A list of the easy checks.
 590+ * @return arrayA list of the easy checks.
593591 */
594592 protected function easyChecks() {
595593 return array(
@@ -598,7 +596,7 @@
599597
600598 /**
601599 * Get help.
602 - * @return The help string.
 600+ * @return string The help string.
603601 */
604602 protected function help() {
605603 return <<<ENDS
Index: trunk/phase3/maintenance/language/languages.inc
@@ -43,7 +43,7 @@
4444 * Load the list of languages: all the Messages*.php
4545 * files in the languages directory.
4646 *
47 - * @param $exif Treat the EXIF messages?
 47+ * @param $exif bool Treat the EXIF messages?
4848 */
4949 function __construct( $exif = true ) {
5050 require( dirname(__FILE__) . '/messageTypes.inc' );
@@ -244,7 +244,7 @@
245245 *
246246 * @param $code string The language code.
247247 *
248 - * @return Namespace names.
 248+ * @return array Namespace names.
249249 */
250250 public function getNamespaceNames( $code ) {
251251 $this->loadFile( $code );
@@ -256,7 +256,7 @@
257257 *
258258 * @param $code string The language code.
259259 *
260 - * @return Namespace aliases.
 260+ * @return array Namespace aliases.
261261 */
262262 public function getNamespaceAliases( $code ) {
263263 $this->loadFile( $code );
@@ -268,7 +268,7 @@
269269 *
270270 * @param $code string The language code.
271271 *
272 - * @return Magic words.
 272+ * @return array Magic words.
273273 */
274274 public function getMagicWords( $code ) {
275275 $this->loadFile( $code );
@@ -280,7 +280,7 @@
281281 *
282282 * @param $code string The language code.
283283 *
284 - * @return Special page aliases.
 284+ * @return array Special page aliases.
285285 */
286286 public function getSpecialPageAliases( $code ) {
287287 $this->loadFile( $code );
@@ -734,7 +734,7 @@
735735
736736 /**
737737 * Load the messages group.
738 - * @param $group The messages group.
 738+ * @param $group MessageGroup The messages group.
739739 */
740740 function __construct( MessageGroup $group ) {
741741 $this->mMessageGroup = $group;
Index: trunk/phase3/maintenance/locking/LockServerDaemon.php
@@ -258,7 +258,7 @@
259259 * store it in the dead session tracking if it still has locks.
260260 *
261261 * @param $socket resource
262 - * @return book
 262+ * @return bool
263263 */
264264 protected function recordDeadSocket( $socket ) {
265265 $session = array_search( $socket, $this->sessions );
@@ -382,7 +382,7 @@
383383
384384 /**
385385 * @param $sock resource
386 - * @return string|false
 386+ * @return string|bool
387387 */
388388 public function readRcvBuffer( $sock ) {
389389 $key = array_search( $sock, $this->clients );
Index: trunk/phase3/maintenance/dumpTextPass.php
@@ -387,6 +387,8 @@
388388 * may not survive a long-term server outage.
389389 *
390390 * FIXME: WTF? Why is it using a loop and then returning unconditionally?
 391+ * @param $id int
 392+ * @return bool|string
391393 */
392394 private function getTextDbSafe( $id ) {
393395 while ( true ) {

Comments

#Comment by Nikerabbit (talk | contribs)   08:59, 10 February 2012

Contains changes not mentioned in commit summary.

Status & tagging log