From 39356de1a4740b5ba4c2fea3464d58673b1373c3 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 29 Nov 2011 21:04:20 +0000 Subject: [PATCH] Moar documentations --- includes/GlobalFunctions.php | 2 + includes/OutputPage.php | 7 ++- includes/Skin.php | 105 +++++++++++++++++++++++++++++--- includes/db/Database.php | 13 +++- includes/db/DatabaseError.php | 16 +++++ includes/db/DatabaseMysql.php | 99 ++++++++++++++++++++++++++++++ includes/db/DatabaseUtility.php | 3 + includes/db/LBFactory.php | 10 +++ includes/db/LBFactory_Multi.php | 6 ++ includes/db/LoadBalancer.php | 32 +++++++++- includes/db/LoadMonitor.php | 6 +- 11 files changed, 284 insertions(+), 15 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 52577ccf21..26157d69a1 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1832,6 +1832,8 @@ function wfSetVar( &$dest, $source, $force = false ) { * @param $dest Int * @param $bit Int * @param $state Bool + * + * @return bool */ function wfSetBit( &$dest, $bit, $state = true ) { $temp = (bool)( $dest & $bit ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e6b18a981f..41bec576ec 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2030,9 +2030,9 @@ class OutputPage extends ContextSource { ) { $displayReturnto = null; - # Due to bug 32276, if a user does not have read permissions, - # $this->getTitle() will just give Special:Badtitle, which is - # not especially useful as a returnto parameter. Use the title + # Due to bug 32276, if a user does not have read permissions, + # $this->getTitle() will just give Special:Badtitle, which is + # not especially useful as a returnto parameter. Use the title # from the request instead, if there was one. $request = $this->getRequest(); $returnto = Title::newFromURL( $request->getVal( 'title', '' ) ); @@ -2721,6 +2721,7 @@ $templates * - in other words, page-independent/site-wide variables (without state). * You will only be adding bloat to the html page and causing page caches to * have to be purged on configuration changes. + * @return array */ protected function getJSVars() { global $wgUseAjax, $wgEnableMWSuggest; diff --git a/includes/Skin.php b/includes/Skin.php index cae787871e..d69408f7cf 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -165,6 +165,9 @@ abstract class Skin extends ContextSource { return $this->skinname; } + /** + * @param $out OutputPage + */ function initPage( OutputPage $out ) { wfProfileIn( __METHOD__ ); @@ -284,6 +287,10 @@ abstract class Skin extends ContextSource { */ abstract function outputPage( OutputPage $out = null ); + /** + * @param $data + * @return string + */ static function makeVariablesScript( $data ) { if ( $data ) { return Html::inlineScript( @@ -369,6 +376,9 @@ abstract class Skin extends ContextSource { return $wgLogo; } + /** + * @return string + */ function getCategoryLinks() { global $wgUseCategoryBrowser; @@ -456,6 +466,9 @@ abstract class Skin extends ContextSource { return $return; } + /** + * @return string + */ function getCategories() { $out = $this->getOutput(); @@ -527,6 +540,10 @@ abstract class Skin extends ContextSource { return ''; } + /** + * @param $debugText + * @return string + */ private function formatDebugHTML( $debugText ) { global $wgDebugTimestamps; @@ -609,6 +626,9 @@ abstract class Skin extends ContextSource { return $this->msg( 'retrievedfrom', '' . $url . '' )->text(); } + /** + * @return String + */ function getUndeleteLink() { $action = $this->getRequest()->getVal( 'action', 'view' ); @@ -635,6 +655,9 @@ abstract class Skin extends ContextSource { return ''; } + /** + * @return string + */ function subPageSubtitle() { $out = $this->getOutput(); $subpages = ''; @@ -693,15 +716,25 @@ abstract class Skin extends ContextSource { return $wgShowIPinHeader && session_id() != ''; } + /** + * @return String + */ function getSearchLink() { $searchPage = SpecialPage::getTitleFor( 'Search' ); return $searchPage->getLocalURL(); } + /** + * @return string + */ function escapeSearchLink() { return htmlspecialchars( $this->getSearchLink() ); } + /** + * @param string $type + * @return string + */ function getCopyright( $type = 'detect' ) { global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgContLang; @@ -748,6 +781,9 @@ abstract class Skin extends ContextSource { } } + /** + * @return null|string + */ function getCopyrightIcon() { global $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgCopyrightIcon; @@ -815,6 +851,10 @@ abstract class Skin extends ContextSource { return $s; } + /** + * @param $align string + * @return string + */ function logoText( $align = '' ) { if ( $align != '' ) { $a = " align='{$align}'"; @@ -869,6 +909,11 @@ abstract class Skin extends ContextSource { return $s; } + /** + * @param $desc + * @param $page + * @return string + */ public function footerLink( $desc, $page ) { // if the link description has been set to "-" in the default language, if ( $this->msg( $desc )->inContentLanguage()->isDisabled() ) { @@ -928,6 +973,10 @@ abstract class Skin extends ContextSource { return $options; } + /** + * @param $id + * @return bool + */ function showEmailUser( $id ) { if ( $id instanceof User ) { $targetUser = $id; @@ -963,6 +1012,11 @@ abstract class Skin extends ContextSource { } /* these are used extensively in SkinTemplate, but also some other places */ + + /** + * @param $urlaction string + * @return String + */ static function makeMainPageUrl( $urlaction = '' ) { $title = Title::newMainPage(); self::checkTitle( $title, '' ); @@ -970,22 +1024,43 @@ abstract class Skin extends ContextSource { return $title->getLocalURL( $urlaction ); } + /** + * @param $name + * @param $urlaction string + * @return String + */ static function makeSpecialUrl( $name, $urlaction = '' ) { $title = SpecialPage::getSafeTitleFor( $name ); return $title->getLocalURL( $urlaction ); } + /** + * @param $name + * @param $subpage + * @param $urlaction string + * @return String + */ static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) { $title = SpecialPage::getSafeTitleFor( $name, $subpage ); return $title->getLocalURL( $urlaction ); } + /** + * @param $name + * @param $urlaction string + * @return String + */ static function makeI18nUrl( $name, $urlaction = '' ) { $title = Title::newFromText( wfMsgForContent( $name ) ); self::checkTitle( $title, $name ); return $title->getLocalURL( $urlaction ); } + /** + * @param $name + * @param $urlaction string + * @return String + */ static function makeUrl( $name, $urlaction = '' ) { $title = Title::newFromText( $name ); self::checkTitle( $title, $name ); @@ -1007,7 +1082,13 @@ abstract class Skin extends ContextSource { } } - # this can be passed the NS number as defined in Language.php + /** + * this can be passed the NS number as defined in Language.php + * @param $name + * @param $urlaction string + * @param $namespace int + * @return String + */ static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN ) { $title = Title::makeTitleSafe( $namespace, $name ); self::checkTitle( $title, $name ); @@ -1015,7 +1096,12 @@ abstract class Skin extends ContextSource { return $title->getLocalURL( $urlaction ); } - /* these return an array with the 'href' and boolean 'exists' */ + /** + * these return an array with the 'href' and boolean 'exists' + * @param $name + * @param $urlaction string + * @return array + */ static function makeUrlDetails( $name, $urlaction = '' ) { $title = Title::newFromText( $name ); self::checkTitle( $title, $name ); @@ -1042,7 +1128,12 @@ abstract class Skin extends ContextSource { ); } - # make sure we have some title to operate on + /** + * make sure we have some title to operate on + * + * @param $title Title + * @param $name + */ static function checkTitle( &$title, $name ) { if ( !is_object( $title ) ) { $title = Title::newFromText( $name ); @@ -1088,7 +1179,7 @@ abstract class Skin extends ContextSource { * * This is just a wrapper around addToSidebarPlain() for backwards compatibility * - * @param &$bar array + * @param $bar array * @param $message String */ function addToSidebar( &$bar, $message ) { @@ -1098,7 +1189,7 @@ abstract class Skin extends ContextSource { /** * Add content from plain text * @since 1.17 - * @param &$bar array + * @param $bar array * @param $text string * @return Array */ @@ -1145,13 +1236,13 @@ abstract class Skin extends ContextSource { if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) { $href = $link; - + // Parser::getExternalLinkAttribs won't work here because of the Namespace things global $wgNoFollowLinks, $wgNoFollowDomainExceptions; if ( $wgNoFollowLinks && !wfMatchesDomainList( $href, $wgNoFollowDomainExceptions ) ) { $extraAttribs['rel'] = 'nofollow'; } - + global $wgExternalLinkTarget; if ( $wgExternalLinkTarget) { $extraAttribs['target'] = $wgExternalLinkTarget; diff --git a/includes/db/Database.php b/includes/db/Database.php index a3fdfa670c..93dd63239a 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -296,7 +296,7 @@ abstract class DatabaseBase implements DatabaseType { * * @param $ignoreErrors bool|null * - * @return The previous value of the flag. + * @return bool The previous value of the flag. */ function ignoreErrors( $ignoreErrors = null ) { return wfSetBit( $this->mFlags, DBO_IGNORE, $ignoreErrors ); @@ -930,6 +930,7 @@ abstract class DatabaseBase implements DatabaseType { /** * Free a prepared query, generated by prepare(). + * @param $prepared */ function freePrepared( $prepared ) { /* No-op by default */ @@ -2279,6 +2280,8 @@ abstract class DatabaseBase implements DatabaseType { * Any implementation of this function should *not* involve reusing * sequence numbers created for rolled-back transactions. * See http://bugs.mysql.com/bug.php?id=30767 for details. + * @param $seqName + * @return null */ function nextSequenceValue( $seqName ) { return null; @@ -2950,7 +2953,7 @@ abstract class DatabaseBase implements DatabaseType { * * @param $result bool|ResultWrapper * - * @param bool|ResultWrapper + * @return bool|ResultWrapper */ function resultObject( $result ) { if ( empty( $result ) ) { @@ -3014,6 +3017,8 @@ abstract class DatabaseBase implements DatabaseType { * don't allow simple quoted strings to be inserted. To insert into such * a field, pass the data through this function before passing it to * DatabaseBase::insert(). + * @param $b + * @return */ function encodeBlob( $b ) { return $b; @@ -3023,6 +3028,8 @@ abstract class DatabaseBase implements DatabaseType { * Some DBMSs return a special placeholder object representing blob fields * in result objects. Pass the object through this function to return the * original string. + * @param $b + * @return */ function decodeBlob( $b ) { return $b; @@ -3062,6 +3069,7 @@ abstract class DatabaseBase implements DatabaseType { * @param $resultCallback Callback: Optional function called for each MySQL result * @param $fname String: Calling function name or false if name should be * generated dynamically using $filename + * @return bool|string */ function sourceFile( $filename, $lineCallback = false, $resultCallback = false, $fname = false ) { wfSuppressWarnings(); @@ -3129,6 +3137,7 @@ abstract class DatabaseBase implements DatabaseType { * @param $lineCallback Callback: Optional function called before reading each line * @param $resultCallback Callback: Optional function called for each MySQL result * @param $fname String: Calling function name + * @return bool|string */ function sourceStream( $fp, $lineCallback = false, $resultCallback = false, $fname = 'DatabaseBase::sourceStream' ) diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php index 8f6aa79c76..fef47849fc 100644 --- a/includes/db/DatabaseError.php +++ b/includes/db/DatabaseError.php @@ -82,6 +82,9 @@ class DBConnectionError extends DBError { parent::__construct( $db, $msg ); } + /** + * @return bool + */ function useOutputPage() { // Not likely to work return false; @@ -105,6 +108,9 @@ class DBConnectionError extends DBError { return wfMsgReplaceArgs( $message, $args ); } + /** + * @return bool + */ function getLogMessage() { # Don't send to the exception log return false; @@ -254,6 +260,13 @@ EOT; class DBQueryError extends DBError { public $error, $errno, $sql, $fname; + /** + * @param $db DatabaseBase + * @param $error + * @param $errno + * @param $sql + * @param $fname + */ function __construct( DatabaseBase &$db, $error, $errno, $sql, $fname ) { $message = "A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" . "Query: $sql\n" . @@ -307,6 +320,9 @@ class DBQueryError extends DBError { } } + /** + * @return bool + */ function getLogMessage() { # Don't send to the exception log return false; diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 54504db2b4..c62c429ede 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -22,6 +22,10 @@ class DatabaseMysql extends DatabaseBase { return 'mysql'; } + /** + * @param $sql + * @return resource + */ protected function doQuery( $sql ) { if( $this->bufferResults() ) { $ret = mysql_query( $sql, $this->mConn ); @@ -31,6 +35,14 @@ class DatabaseMysql extends DatabaseBase { return $ret; } + /** + * @param $server + * @param $user + * @param $password + * @param $dbName + * @return bool + * @throws DBConnectionError + */ function open( $server, $user, $password, $dbName ) { global $wgAllDBsAreLocalhost; wfProfileIn( __METHOD__ ); @@ -154,6 +166,10 @@ class DatabaseMysql extends DatabaseBase { } } + /** + * @param $res + * @throws DBUnexpectedError + */ function freeResult( $res ) { if ( $res instanceof ResultWrapper ) { $res = $res->result; @@ -166,6 +182,11 @@ class DatabaseMysql extends DatabaseBase { } } + /** + * @param $res + * @return object|stdClass + * @throws DBUnexpectedError + */ function fetchObject( $res ) { if ( $res instanceof ResultWrapper ) { $res = $res->result; @@ -179,6 +200,11 @@ class DatabaseMysql extends DatabaseBase { return $row; } + /** + * @param $res + * @return array + * @throws DBUnexpectedError + */ function fetchRow( $res ) { if ( $res instanceof ResultWrapper ) { $res = $res->result; @@ -240,6 +266,11 @@ class DatabaseMysql extends DatabaseBase { return mysql_insert_id( $this->mConn ); } + /** + * @param $res + * @param $row + * @return bool + */ function dataSeek( $res, $row ) { if ( $res instanceof ResultWrapper ) { $res = $res->result; @@ -247,6 +278,9 @@ class DatabaseMysql extends DatabaseBase { return mysql_data_seek( $res, $row ); } + /** + * @return int + */ function lastErrno() { if ( $this->mConn ) { return mysql_errno( $this->mConn ); @@ -255,6 +289,9 @@ class DatabaseMysql extends DatabaseBase { } } + /** + * @return string + */ function lastError() { if ( $this->mConn ) { # Even if it's non-zero, it can still be invalid @@ -280,6 +317,13 @@ class DatabaseMysql extends DatabaseBase { return mysql_affected_rows( $this->mConn ); } + /** + * @param $table + * @param $uniqueIndexes + * @param $rows + * @param $fname string + * @return ResultWrapper + */ function replace( $table, $uniqueIndexes, $rows, $fname = 'DatabaseMysql::replace' ) { return $this->nativeReplace( $table, $rows, $fname ); } @@ -289,6 +333,11 @@ class DatabaseMysql extends DatabaseBase { * Returns estimated count, based on EXPLAIN output * Takes same arguments as Database::select() * + * @param $table string|array + * @param $vars string|array + * @param $conds string|array + * @param $fname string + * @param $options string|array * @return int */ public function estimateRowCount( $table, $vars='*', $conds='', $fname = 'DatabaseMysql::estimateRowCount', $options = array() ) { @@ -333,6 +382,9 @@ class DatabaseMysql extends DatabaseBase { * Get information about an index into an object * Returns false if the index does not exist * + * @param $table + * @param $index + * @param $fname string * @return false|array */ function indexInfo( $table, $index, $fname = 'DatabaseMysql::indexInfo' ) { @@ -497,6 +549,7 @@ class DatabaseMysql extends DatabaseBase { * * @param $pos DBMasterPos object * @param $timeout Integer: the maximum number of seconds to wait for synchronisation + * @return bool|string */ function masterPosWait( DBMasterPos $pos, $timeout ) { $fname = 'DatabaseBase::masterPosWait'; @@ -598,10 +651,16 @@ class DatabaseMysql extends DatabaseBase { return '[http://www.mysql.com/ MySQL]'; } + /** + * @return bool + */ function standardSelectDistinct() { return false; } + /** + * @param $options array + */ public function setSessionOptions( array $options ) { if ( isset( $options['connTimeout'] ) ) { $timeout = (int)$options['connTimeout']; @@ -610,6 +669,12 @@ class DatabaseMysql extends DatabaseBase { } } + /** + * @param $lockName + * @param $method + * @param $timeout int + * @return bool + */ public function lock( $lockName, $method, $timeout = 5 ) { $lockName = $this->addQuotes( $lockName ); $result = $this->query( "SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method ); @@ -625,6 +690,9 @@ class DatabaseMysql extends DatabaseBase { /** * FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock + * @param $lockName + * @param $method string + * @return */ public function unlock( $lockName, $method ) { $lockName = $this->addQuotes( $lockName ); @@ -633,6 +701,12 @@ class DatabaseMysql extends DatabaseBase { return $row->lockstatus; } + /** + * @param $read + * @param $write + * @param $method + * @param $lowPriority bool + */ public function lockTables( $read, $write, $method, $lowPriority = true ) { $items = array(); @@ -649,6 +723,9 @@ class DatabaseMysql extends DatabaseBase { $this->query( $sql, $method ); } + /** + * @param $method string + */ public function unlockTables( $method ) { $this->query( "UNLOCK TABLES", $method ); } @@ -663,6 +740,10 @@ class DatabaseMysql extends DatabaseBase { return 'SearchMySQL'; } + /** + * @param bool $value + * @return mixed + */ public function setBigSelects( $value = true ) { if ( $value === 'default' ) { if ( $this->mDefaultBigSelects === null ) { @@ -680,6 +761,13 @@ class DatabaseMysql extends DatabaseBase { /** * DELETE where the condition is a join. MySql uses multi-table deletes. + * @param $delTable + * @param $joinTable + * @param $delVar + * @param $joinVar + * @param $conds array|string + * @param $fname bool + * @return bool|\ResultWrapper */ function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'DatabaseBase::deleteJoin' ) { if ( !$conds ) { @@ -745,6 +833,12 @@ class DatabaseMysql extends DatabaseBase { ( $this->lastErrno() == 1290 && strpos( $this->lastError(), '--read-only' ) !== false ); } + /** + * @param $oldName + * @param $newName + * @param $temporary bool + * @param $fname string + */ function duplicateTableStructure( $oldName, $newName, $temporary = false, $fname = 'DatabaseMysql::duplicateTableStructure' ) { $tmp = $temporary ? 'TEMPORARY ' : ''; $newName = $this->addIdentifierQuotes( $newName ); @@ -758,6 +852,7 @@ class DatabaseMysql extends DatabaseBase { * * @param $prefix Only show tables with this prefix, e.g. mw_ * @param $fname String: calling function name + * @return array */ function listTables( $prefix = null, $fname = 'DatabaseMysql::listTables' ) { $result = $this->query( "SHOW TABLES", $fname); @@ -801,6 +896,7 @@ class DatabaseMysql extends DatabaseBase { /** * Get status information from SHOW STATUS in an associative array * + * @param $which string * @return array */ function getMysqlStatus( $which = "%" ) { @@ -858,6 +954,9 @@ class MySQLField implements Field { return $this->tableName; } + /** + * @return string + */ function type() { return $this->type; } diff --git a/includes/db/DatabaseUtility.php b/includes/db/DatabaseUtility.php index 15ec920fa7..0ea713c815 100644 --- a/includes/db/DatabaseUtility.php +++ b/includes/db/DatabaseUtility.php @@ -10,6 +10,9 @@ class DBObject { $this->mData = $data; } + /** + * @return bool + */ function isLOB() { return false; } diff --git a/includes/db/LBFactory.php b/includes/db/LBFactory.php index 22a849609c..0ed9224fcf 100644 --- a/includes/db/LBFactory.php +++ b/includes/db/LBFactory.php @@ -64,6 +64,7 @@ abstract class LBFactory { /** * Construct a factory based on a configuration array (typically from $wgLBFactoryConf) + * @param $conf */ abstract function __construct( $conf ); @@ -110,6 +111,8 @@ abstract class LBFactory { * Execute a function for each tracked load balancer * The callback is called with the load balancer as the first parameter, * and $params passed as the subsequent parameters. + * @param $callback + * @param array $params */ abstract function forEachLB( $callback, $params = array() ); @@ -121,6 +124,8 @@ abstract class LBFactory { /** * Call a method of each tracked load balancer + * @param $methodName + * @param $args array */ function forEachLBCallMethod( $methodName, $args = array() ) { $this->forEachLB( array( $this, 'callMethod' ), array( $methodName, $args ) ); @@ -128,6 +133,9 @@ abstract class LBFactory { /** * Private helper for forEachLBCallMethod + * @param $loadBalancer + * @param $methodName + * @param $args */ function callMethod( $loadBalancer, $methodName, $args ) { call_user_func_array( array( $loadBalancer, $methodName ), $args ); @@ -232,6 +240,8 @@ class LBFactory_Simple extends LBFactory { * Execute a function for each tracked load balancer * The callback is called with the load balancer as the first parameter, * and $params passed as the subsequent parameters. + * @param $callback + * @param $params array */ function forEachLB( $callback, $params = array() ) { if ( isset( $this->mainLB ) ) { diff --git a/includes/db/LBFactory_Multi.php b/includes/db/LBFactory_Multi.php index ec2d513da5..5f7cf0d05c 100644 --- a/includes/db/LBFactory_Multi.php +++ b/includes/db/LBFactory_Multi.php @@ -53,6 +53,9 @@ class LBFactory_Multi extends LBFactory { var $conf, $mainLBs = array(), $extLBs = array(); var $lastWiki, $lastSection; + /** + * @param $conf + */ function __construct( $conf ) { $this->chronProt = new ChronologyProtector; $this->conf = $conf; @@ -169,6 +172,9 @@ class LBFactory_Multi extends LBFactory { /** * Make a new load balancer object based on template and load array * + * @param $template + * @param $loads + * @param $groupLoads * @return LoadBalancer */ function newLoadBalancer( $template, $loads, $groupLoads ) { diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index ef4408ace1..e21f1eece2 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -90,6 +90,8 @@ class LoadBalancer { /** * Get or set arbitrary data used by the parent object, usually an LBFactory + * @param $x + * @return \Mixed */ function parentInfo( $x = null ) { return wfSetVar( $this->mParentInfo, $x ); @@ -334,6 +336,8 @@ class LoadBalancer { /** * Wait for a specified number of microseconds, and return the period waited + * @param $t + * @return */ function sleep( $t ) { wfProfileIn( __METHOD__ ); @@ -347,6 +351,7 @@ class LoadBalancer { * Set the master wait position * If a DB_SLAVE connection has been opened already, waits * Otherwise sets a variable telling it to wait if such a connection is opened + * @param $pos */ public function waitFor( $pos ) { wfProfileIn( __METHOD__ ); @@ -364,6 +369,7 @@ class LoadBalancer { /** * Set the master wait position and wait for ALL slaves to catch up to it + * @param $pos */ public function waitForAll( $pos ) { wfProfileIn( __METHOD__ ); @@ -378,7 +384,8 @@ class LoadBalancer { * Get any open connection to a given server index, local or foreign * Returns false if there is no connection open * - * @return DatabaseBase + * @param $i + * @return DatabaseBase|false */ function getAnyOpenConnection( $i ) { foreach ( $this->mConns as $conns ) { @@ -666,6 +673,8 @@ class LoadBalancer { * Returns a Database object whether or not the connection was successful. * @access private * + * @param $server + * @param $dbNameOverride bool * @return DatabaseBase */ function reallyOpenConnection( $server, $dbNameOverride = false ) { @@ -706,6 +715,10 @@ class LoadBalancer { return $db; } + /** + * @param $conn + * @throws DBConnectionError + */ function reportConnectionError( &$conn ) { wfProfileIn( __METHOD__ ); @@ -733,6 +746,7 @@ class LoadBalancer { /** * Returns true if the specified index is a valid server index * + * @param $i * @return bool */ function haveIndex( $i ) { @@ -742,6 +756,7 @@ class LoadBalancer { /** * Returns true if the specified index is valid and has non-zero load * + * @param $i * @return bool */ function isNonZeroLoad( $i ) { @@ -760,6 +775,8 @@ class LoadBalancer { /** * Get the host name or IP address of the server with the specified index * Prefer a readable name if available. + * @param $i + * @return string */ function getServerName( $i ) { if ( isset( $this->mServers[$i]['hostName'] ) ) { @@ -773,6 +790,8 @@ class LoadBalancer { /** * Return the server info structure for a given index, or false if the index is invalid. + * @param $i + * @return bool */ function getServerInfo( $i ) { if ( isset( $this->mServers[$i] ) ) { @@ -784,6 +803,8 @@ class LoadBalancer { /** * Sets the server info structure for the given index. Entry at index $i is created if it doesn't exist + * @param $i + * @param $serverInfo */ function setServerInfo( $i, $serverInfo ) { $this->mServers[$i] = $serverInfo; @@ -834,6 +855,7 @@ class LoadBalancer { * Deprecated function, typo in function name * * @deprecated in 1.18 + * @param $conn */ function closeConnecton( $conn ) { $this->closeConnection( $conn ); @@ -910,7 +932,11 @@ class LoadBalancer { return $this->mLaggedSlaveMode; } - /* Disables/enables lag checks */ + /** + * Disables/enables lag checks + * @param $mode null + * @return bool + */ function allowLagged( $mode = null ) { if ( $mode === null) { return $this->mAllowLagged; @@ -937,6 +963,8 @@ class LoadBalancer { /** * Call a function with each open connection object + * @param $callback + * @param array $params */ function forEachOpenConnection( $callback, $params = array() ) { foreach ( $this->mConns as $conns2 ) { diff --git a/includes/db/LoadMonitor.php b/includes/db/LoadMonitor.php index a6370c9e03..16a0343fb3 100644 --- a/includes/db/LoadMonitor.php +++ b/includes/db/LoadMonitor.php @@ -66,12 +66,16 @@ class LoadMonitor_Null implements LoadMonitor { function postConnectionBackoff( $conn, $threshold ) { } + /** + * @param $serverIndexes + * @param $wiki + * @return array + */ function getLagTimes( $serverIndexes, $wiki ) { return array_fill_keys( $serverIndexes, 0 ); } } - /** * Basic MySQL load monitor with no external dependencies * Uses memcached to cache the replication lag for a short time -- 2.20.1