r88926 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88925‎ | r88926 | r88927 >
Date:20:26, 26 May 2011
Author:reedy
Status:ok
Tags:
Comment:
More documentation tweaks/additions
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/GenderCache.php (modified) (history)
  • /trunk/phase3/includes/extauth/MediaWiki.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlInstaller.php (modified) (history)
  • /trunk/phase3/includes/media/DjVu.php (modified) (history)
  • /trunk/phase3/includes/media/PNG.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_DOM.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBrokenRedirects.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDisambiguations.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GenderCache.php
@@ -10,7 +10,10 @@
1111 protected $default;
1212 protected $misses = 0;
1313 protected $missLimit = 1000;
14 -
 14+
 15+ /**
 16+ * @return GenderCache
 17+ */
1518 public static function singleton() {
1619 static $that = null;
1720 if ( $that === null ) {
@@ -34,7 +37,7 @@
3538
3639 /**
3740 * Returns the gender for given username.
38 - * @param $users String: username
 41+ * @param $username String: username
3942 * @param $caller String: the calling method
4043 * @return String
4144 */
@@ -70,6 +73,9 @@
7174
7275 /**
7376 * Wrapper for doQuery that processes raw LinkBatch data.
 77+ *
 78+ * @param $data
 79+ * @param $caller
7480 */
7581 public function doLinkBatch( $data, $caller = '' ) {
7682 $users = array();
@@ -82,7 +88,6 @@
8389 }
8490
8591 $this->doQuery( array_keys( $users ), $caller );
86 -
8792 }
8893
8994 /**
Index: trunk/phase3/includes/extauth/MediaWiki.php
@@ -50,8 +50,17 @@
5151 * @ingroup ExternalUser
5252 */
5353 class ExternalUser_MediaWiki extends ExternalUser {
54 - private $mRow, $mDb;
 54+ private $mRow;
5555
 56+ /**
 57+ * @var DatabaseBase
 58+ */
 59+ private $mDb;
 60+
 61+ /**
 62+ * @param $name string
 63+ * @return bool
 64+ */
5665 protected function initFromName( $name ) {
5766 # We might not need the 'usable' bit, but let's be safe. Theoretically
5867 # this might return wrong results for old versions, but it's probably
@@ -65,10 +74,18 @@
6675 return $this->initFromCond( array( 'user_name' => $name ) );
6776 }
6877
 78+ /**
 79+ * @param $id int
 80+ * @return bool
 81+ */
6982 protected function initFromId( $id ) {
7083 return $this->initFromCond( array( 'user_id' => $id ) );
7184 }
7285
 86+ /**
 87+ * @param $cond array
 88+ * @return bool
 89+ */
7390 private function initFromCond( $cond ) {
7491 global $wgExternalAuthConf;
7592
@@ -105,6 +122,9 @@
106123 return $this->mRow->user_id;
107124 }
108125
 126+ /**
 127+ * @return string
 128+ */
109129 public function getName() {
110130 return $this->mRow->user_name;
111131 }
@@ -126,6 +146,9 @@
127147 return null;
128148 }
129149
 150+ /**
 151+ * @return array
 152+ */
130153 public function getGroups() {
131154 # @todo FIXME: Untested.
132155 $groups = array();
Index: trunk/phase3/includes/installer/MysqlInstaller.php
@@ -41,6 +41,9 @@
4242 'CREATE TEMPORARY TABLES',
4343 );
4444
 45+ /**
 46+ * @return string
 47+ */
4548 public function getName() {
4649 return 'mysql';
4750 }
@@ -49,14 +52,23 @@
5053 parent::__construct( $parent );
5154 }
5255
 56+ /**
 57+ * @return Bool
 58+ */
5359 public function isCompiled() {
5460 return self::checkExtension( 'mysql' );
5561 }
5662
 63+ /**
 64+ * @return array
 65+ */
5766 public function getGlobalDefaults() {
5867 return array();
5968 }
6069
 70+ /**
 71+ * @return string
 72+ */
6173 public function getConnectForm() {
6274 return
6375 $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
@@ -111,6 +123,9 @@
112124 return $status;
113125 }
114126
 127+ /**
 128+ * @return Status
 129+ */
115130 public function openConnection() {
116131 $status = Status::newGood();
117132 try {
@@ -187,6 +202,8 @@
188203
189204 /**
190205 * Get a list of storage engines that are available and supported
 206+ *
 207+ * @return array
191208 */
192209 public function getEngines() {
193210 $engines = array( 'InnoDB', 'MyISAM' );
@@ -215,6 +232,8 @@
216233
217234 /**
218235 * Get a list of character sets that are available and supported
 236+ *
 237+ * @return array
219238 */
220239 public function getCharsets() {
221240 $status = $this->getConnection();
@@ -231,6 +250,8 @@
232251
233252 /**
234253 * Return true if the install user can create accounts
 254+ *
 255+ * @return bool
235256 */
236257 public function canCreateAccounts() {
237258 $status = $this->getConnection();
@@ -304,6 +325,9 @@
305326 return true;
306327 }
307328
 329+ /**
 330+ * @return string
 331+ */
308332 public function getSettingsForm() {
309333 if ( $this->canCreateAccounts() ) {
310334 $noCreateMsg = false;
@@ -368,6 +392,9 @@
369393 return $s;
370394 }
371395
 396+ /**
 397+ * @return Status
 398+ */
372399 public function submitSettingsForm() {
373400 $this->setVarsFromRequest( array( '_MysqlEngine', '_MysqlCharset' ) );
374401 $status = $this->submitWebUserBox();
@@ -423,6 +450,9 @@
424451 $this->parent->addInstallStep( $callback, 'tables' );
425452 }
426453
 454+ /**
 455+ * @return Status
 456+ */
427457 public function setupDatabase() {
428458 $status = $this->getConnection();
429459 if ( !$status->isOK() ) {
@@ -438,6 +468,9 @@
439469 return $status;
440470 }
441471
 472+ /**
 473+ * @return Status
 474+ */
442475 public function setupUser() {
443476 $dbUser = $this->getVar( 'wgDBuser' );
444477 if( $dbUser == $this->getVar( '_InstallUser' ) ) {
@@ -580,6 +613,8 @@
581614
582615 /**
583616 * Get variables to substitute into tables.sql and the SQL patch files.
 617+ *
 618+ * @return array
584619 */
585620 public function getSchemaVars() {
586621 return array(
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php
@@ -27,10 +27,17 @@
2828 }
2929 }
3030
 31+ /**
 32+ * @return PPFrame_DOM
 33+ */
3134 function newFrame() {
3235 return new PPFrame_DOM( $this );
3336 }
3437
 38+ /**
 39+ * @param $args
 40+ * @return PPCustomFrame_DOM
 41+ */
3542 function newCustomFrame( $args ) {
3643 return new PPCustomFrame_DOM( $this, $args );
3744 }
Index: trunk/phase3/includes/specials/SpecialDisambiguations.php
@@ -102,7 +102,9 @@
103103 }
104104
105105 /**
106 - * Fetch links and cache their existence
 106+ * Fetch links and cache their existence
 107+ *
 108+ * @param $db DatabaseBase
107109 */
108110 function preprocessResults( $db, $res ) {
109111 $batch = new LinkBatch;
Index: trunk/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -64,10 +64,18 @@
6565 );
6666 }
6767
 68+ /**
 69+ * @return array
 70+ */
6871 function getOrderFields() {
6972 return array ( 'rd_namespace', 'rd_title', 'rd_from' );
7073 }
7174
 75+ /**
 76+ * @param $skin Skin
 77+ * @param $result
 78+ * @return String
 79+ */
7280 function formatResult( $skin, $result ) {
7381 global $wgUser, $wgContLang, $wgLang;
7482
@@ -101,7 +109,7 @@
102110 array(),
103111 array( 'action' => 'edit' )
104112 );
105 - $to = $skin->link(
 113+ $to = $skin->link(
106114 $toObj,
107115 null,
108116 array(),
Index: trunk/phase3/includes/EditPage.php
@@ -109,7 +109,7 @@
110110
111111 /**
112112 * @todo document
113 - * @param $article
 113+ * @param $article Article
114114 */
115115 function __construct( $article ) {
116116 $this->mArticle =& $article;
@@ -128,6 +128,9 @@
129129 $this->mPreloadText = "";
130130 }
131131
 132+ /**
 133+ * @return Article
 134+ */
132135 function getArticle() {
133136 return $this->mArticle;
134137 }
Index: trunk/phase3/includes/media/DjVu.php
@@ -12,6 +12,10 @@
1313 * @ingroup Media
1414 */
1515 class DjVuHandler extends ImageHandler {
 16+
 17+ /**
 18+ * @return bool
 19+ */
1620 function isEnabled() {
1721 global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
1822 if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
@@ -22,9 +26,25 @@
2327 }
2428 }
2529
26 - function mustRender( $file ) { return true; }
27 - function isMultiPage( $file ) { return true; }
 30+ /**
 31+ * @param $file
 32+ * @return bool
 33+ */
 34+ function mustRender( $file ) {
 35+ return true;
 36+ }
2837
 38+ /**
 39+ * @param $file
 40+ * @return bool
 41+ */
 42+ function isMultiPage( $file ) {
 43+ return true;
 44+ }
 45+
 46+ /**
 47+ * @return array
 48+ */
2949 function getParamMap() {
3050 return array(
3151 'img_width' => 'width',
@@ -32,6 +52,11 @@
3353 );
3454 }
3555
 56+ /**
 57+ * @param $name
 58+ * @param $value
 59+ * @return bool
 60+ */
3661 function validateParam( $name, $value ) {
3762 if ( in_array( $name, array( 'width', 'height', 'page' ) ) ) {
3863 if ( $value <= 0 ) {
@@ -44,6 +69,10 @@
4570 }
4671 }
4772
 73+ /**
 74+ * @param $params
 75+ * @return bool|string
 76+ */
4877 function makeParamString( $params ) {
4978 $page = isset( $params['page'] ) ? $params['page'] : 1;
5079 if ( !isset( $params['width'] ) ) {
@@ -52,6 +81,10 @@
5382 return "page{$page}-{$params['width']}px";
5483 }
5584
 85+ /**
 86+ * @param $str
 87+ * @return array|bool
 88+ */
5689 function parseParamString( $str ) {
5790 $m = false;
5891 if ( preg_match( '/^page(\d+)-(\d+)px$/', $str, $m ) ) {
@@ -61,6 +94,10 @@
6295 }
6396 }
6497
 98+ /**
 99+ * @param $params
 100+ * @return array
 101+ */
65102 function getScriptParams( $params ) {
66103 return array(
67104 'width' => $params['width'],
@@ -133,6 +170,8 @@
134171
135172 /**
136173 * Cache an instance of DjVuImage in an Image object, return that instance
 174+ *
 175+ * @return DjVuImage
137176 */
138177 function getDjVuImage( $image, $path ) {
139178 if ( !$image ) {
Index: trunk/phase3/includes/media/PNG.php
@@ -31,7 +31,11 @@
3232
3333 return serialize($metadata);
3434 }
35 -
 35+
 36+ /**
 37+ * @param $image File
 38+ * @return array|bool
 39+ */
3640 function formatMetadata( $image ) {
3741 $meta = $image->getMetadata();
3842

Status & tagging log