From 912b95a104fa5c682482b847b3b774a677bce25c Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 26 May 2011 20:26:51 +0000 Subject: [PATCH] More documentation tweaks/additions --- includes/EditPage.php | 5 ++- includes/GenderCache.php | 11 +++-- includes/extauth/MediaWiki.php | 25 +++++++++++- includes/installer/MysqlInstaller.php | 35 ++++++++++++++++ includes/media/DjVu.php | 43 +++++++++++++++++++- includes/media/PNG.php | 6 ++- includes/parser/Preprocessor_DOM.php | 7 ++++ includes/specials/SpecialBrokenRedirects.php | 10 ++++- includes/specials/SpecialDisambiguations.php | 4 +- 9 files changed, 136 insertions(+), 10 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 090029ff6c..f69df43412 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -109,7 +109,7 @@ class EditPage { /** * @todo document - * @param $article + * @param $article Article */ function __construct( $article ) { $this->mArticle =& $article; @@ -128,6 +128,9 @@ class EditPage { $this->mPreloadText = ""; } + /** + * @return Article + */ function getArticle() { return $this->mArticle; } diff --git a/includes/GenderCache.php b/includes/GenderCache.php index a8b32ccb69..60564989b2 100644 --- a/includes/GenderCache.php +++ b/includes/GenderCache.php @@ -10,7 +10,10 @@ class GenderCache { protected $default; protected $misses = 0; protected $missLimit = 1000; - + + /** + * @return GenderCache + */ public static function singleton() { static $that = null; if ( $that === null ) { @@ -34,7 +37,7 @@ class GenderCache { /** * Returns the gender for given username. - * @param $users String: username + * @param $username String: username * @param $caller String: the calling method * @return String */ @@ -70,6 +73,9 @@ class GenderCache { /** * Wrapper for doQuery that processes raw LinkBatch data. + * + * @param $data + * @param $caller */ public function doLinkBatch( $data, $caller = '' ) { $users = array(); @@ -82,7 +88,6 @@ class GenderCache { } $this->doQuery( array_keys( $users ), $caller ); - } /** diff --git a/includes/extauth/MediaWiki.php b/includes/extauth/MediaWiki.php index 20f3645850..84c8705a0a 100644 --- a/includes/extauth/MediaWiki.php +++ b/includes/extauth/MediaWiki.php @@ -50,8 +50,17 @@ * @ingroup ExternalUser */ class ExternalUser_MediaWiki extends ExternalUser { - private $mRow, $mDb; + private $mRow; + /** + * @var DatabaseBase + */ + private $mDb; + + /** + * @param $name string + * @return bool + */ protected function initFromName( $name ) { # We might not need the 'usable' bit, but let's be safe. Theoretically # this might return wrong results for old versions, but it's probably @@ -65,10 +74,18 @@ class ExternalUser_MediaWiki extends ExternalUser { return $this->initFromCond( array( 'user_name' => $name ) ); } + /** + * @param $id int + * @return bool + */ protected function initFromId( $id ) { return $this->initFromCond( array( 'user_id' => $id ) ); } + /** + * @param $cond array + * @return bool + */ private function initFromCond( $cond ) { global $wgExternalAuthConf; @@ -105,6 +122,9 @@ class ExternalUser_MediaWiki extends ExternalUser { return $this->mRow->user_id; } + /** + * @return string + */ public function getName() { return $this->mRow->user_name; } @@ -126,6 +146,9 @@ class ExternalUser_MediaWiki extends ExternalUser { return null; } + /** + * @return array + */ public function getGroups() { # @todo FIXME: Untested. $groups = array(); diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 1555104f94..e049ac245e 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -41,6 +41,9 @@ class MysqlInstaller extends DatabaseInstaller { 'CREATE TEMPORARY TABLES', ); + /** + * @return string + */ public function getName() { return 'mysql'; } @@ -49,14 +52,23 @@ class MysqlInstaller extends DatabaseInstaller { parent::__construct( $parent ); } + /** + * @return Bool + */ public function isCompiled() { return self::checkExtension( 'mysql' ); } + /** + * @return array + */ public function getGlobalDefaults() { return array(); } + /** + * @return string + */ public function getConnectForm() { return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . @@ -111,6 +123,9 @@ class MysqlInstaller extends DatabaseInstaller { return $status; } + /** + * @return Status + */ public function openConnection() { $status = Status::newGood(); try { @@ -187,6 +202,8 @@ class MysqlInstaller extends DatabaseInstaller { /** * Get a list of storage engines that are available and supported + * + * @return array */ public function getEngines() { $engines = array( 'InnoDB', 'MyISAM' ); @@ -215,6 +232,8 @@ class MysqlInstaller extends DatabaseInstaller { /** * Get a list of character sets that are available and supported + * + * @return array */ public function getCharsets() { $status = $this->getConnection(); @@ -231,6 +250,8 @@ class MysqlInstaller extends DatabaseInstaller { /** * Return true if the install user can create accounts + * + * @return bool */ public function canCreateAccounts() { $status = $this->getConnection(); @@ -304,6 +325,9 @@ class MysqlInstaller extends DatabaseInstaller { return true; } + /** + * @return string + */ public function getSettingsForm() { if ( $this->canCreateAccounts() ) { $noCreateMsg = false; @@ -368,6 +392,9 @@ class MysqlInstaller extends DatabaseInstaller { return $s; } + /** + * @return Status + */ public function submitSettingsForm() { $this->setVarsFromRequest( array( '_MysqlEngine', '_MysqlCharset' ) ); $status = $this->submitWebUserBox(); @@ -423,6 +450,9 @@ class MysqlInstaller extends DatabaseInstaller { $this->parent->addInstallStep( $callback, 'tables' ); } + /** + * @return Status + */ public function setupDatabase() { $status = $this->getConnection(); if ( !$status->isOK() ) { @@ -438,6 +468,9 @@ class MysqlInstaller extends DatabaseInstaller { return $status; } + /** + * @return Status + */ public function setupUser() { $dbUser = $this->getVar( 'wgDBuser' ); if( $dbUser == $this->getVar( '_InstallUser' ) ) { @@ -580,6 +613,8 @@ class MysqlInstaller extends DatabaseInstaller { /** * Get variables to substitute into tables.sql and the SQL patch files. + * + * @return array */ public function getSchemaVars() { return array( diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index 3ccc1894ca..f66902931d 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -12,6 +12,10 @@ * @ingroup Media */ class DjVuHandler extends ImageHandler { + + /** + * @return bool + */ function isEnabled() { global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML; if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) { @@ -22,9 +26,25 @@ class DjVuHandler extends ImageHandler { } } - function mustRender( $file ) { return true; } - function isMultiPage( $file ) { return true; } + /** + * @param $file + * @return bool + */ + function mustRender( $file ) { + return true; + } + + /** + * @param $file + * @return bool + */ + function isMultiPage( $file ) { + return true; + } + /** + * @return array + */ function getParamMap() { return array( 'img_width' => 'width', @@ -32,6 +52,11 @@ class DjVuHandler extends ImageHandler { ); } + /** + * @param $name + * @param $value + * @return bool + */ function validateParam( $name, $value ) { if ( in_array( $name, array( 'width', 'height', 'page' ) ) ) { if ( $value <= 0 ) { @@ -44,6 +69,10 @@ class DjVuHandler extends ImageHandler { } } + /** + * @param $params + * @return bool|string + */ function makeParamString( $params ) { $page = isset( $params['page'] ) ? $params['page'] : 1; if ( !isset( $params['width'] ) ) { @@ -52,6 +81,10 @@ class DjVuHandler extends ImageHandler { return "page{$page}-{$params['width']}px"; } + /** + * @param $str + * @return array|bool + */ function parseParamString( $str ) { $m = false; if ( preg_match( '/^page(\d+)-(\d+)px$/', $str, $m ) ) { @@ -61,6 +94,10 @@ class DjVuHandler extends ImageHandler { } } + /** + * @param $params + * @return array + */ function getScriptParams( $params ) { return array( 'width' => $params['width'], @@ -133,6 +170,8 @@ class DjVuHandler extends ImageHandler { /** * Cache an instance of DjVuImage in an Image object, return that instance + * + * @return DjVuImage */ function getDjVuImage( $image, $path ) { if ( !$image ) { diff --git a/includes/media/PNG.php b/includes/media/PNG.php index cd7b5d6cae..8fe9ecb4aa 100644 --- a/includes/media/PNG.php +++ b/includes/media/PNG.php @@ -31,7 +31,11 @@ class PNGHandler extends BitmapHandler { return serialize($metadata); } - + + /** + * @param $image File + * @return array|bool + */ function formatMetadata( $image ) { $meta = $image->getMetadata(); diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 157e97315d..2dd3efd27c 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -27,10 +27,17 @@ class Preprocessor_DOM implements Preprocessor { } } + /** + * @return PPFrame_DOM + */ function newFrame() { return new PPFrame_DOM( $this ); } + /** + * @param $args + * @return PPCustomFrame_DOM + */ function newCustomFrame( $args ) { return new PPCustomFrame_DOM( $this, $args ); } diff --git a/includes/specials/SpecialBrokenRedirects.php b/includes/specials/SpecialBrokenRedirects.php index 879a758e5d..7c87a99665 100644 --- a/includes/specials/SpecialBrokenRedirects.php +++ b/includes/specials/SpecialBrokenRedirects.php @@ -64,10 +64,18 @@ class BrokenRedirectsPage extends PageQueryPage { ); } + /** + * @return array + */ function getOrderFields() { return array ( 'rd_namespace', 'rd_title', 'rd_from' ); } + /** + * @param $skin Skin + * @param $result + * @return String + */ function formatResult( $skin, $result ) { global $wgUser, $wgContLang, $wgLang; @@ -101,7 +109,7 @@ class BrokenRedirectsPage extends PageQueryPage { array(), array( 'action' => 'edit' ) ); - $to = $skin->link( + $to = $skin->link( $toObj, null, array(), diff --git a/includes/specials/SpecialDisambiguations.php b/includes/specials/SpecialDisambiguations.php index e867d14a45..adbae7978d 100644 --- a/includes/specials/SpecialDisambiguations.php +++ b/includes/specials/SpecialDisambiguations.php @@ -102,7 +102,9 @@ class DisambiguationsPage extends PageQueryPage { } /** - * Fetch links and cache their existence + * Fetch links and cache their existence + * + * @param $db DatabaseBase */ function preprocessResults( $db, $res ) { $batch = new LinkBatch; -- 2.20.1