/**
* Load the interwiki, trying first memcached then the DB
*
- * @param $prefix The interwiki prefix
+ * @param $prefix string The interwiki prefix
* @return Boolean: the prefix is valid
*/
protected static function load( $prefix ) {
/**
* Fill in member variables from an array (e.g. memcached result, Database::fetchRow, etc)
*
- * @param $mc Associative array: row from the interwiki table
- * @return Boolean: whether everything was there
+ * @param $mc array Associative array: row from the interwiki table
+ * @return Boolean|Interwiki whether everything was there
*/
protected static function loadFromArray( $mc ) {
if( isset( $mc['iw_url'] ) ) {
/**
* Fetch all interwiki prefixes from interwiki cache
*
- * @param $local If not null, limits output to local/non-local interwikis
+ * @param $local null|string If not null, limits output to local/non-local interwikis
* @return Array List of prefixes
* @since 1.19
*/
/**
* Fetch all interwiki prefixes from DB
*
- * @param $local If not null, limits output to local/non-local interwikis
+ * @param $local string|null If not null, limits output to local/non-local interwikis
* @return Array List of prefixes
* @since 1.19
*/
/**
* Returns all interwiki prefixes
*
- * @param $local If set, limits output to local/non-local interwikis
+ * @param $local string|null If set, limits output to local/non-local interwikis
* @return Array List of prefixes
* @since 1.19
*/
global $wgAllDBsAreLocalhost;
if ( $wgAllDBsAreLocalhost ) {
$host = 'localhost';
+ } elseif ( $this->hasOption( 'group' ) ) {
+ $db = wfGetDB( DB_SLAVE, $this->getOption( 'group' ) );
+ $host = $db->getServer();
} else {
- if ( $this->hasOption( 'group' ) ) {
- $db = wfGetDB( DB_SLAVE, $this->getOption( 'group' ) );
- $host = $db->getServer();
- } else {
- $lb = wfGetLB();
- $i = $lb->getReaderIndex();
- $host = $lb->getServerName( $i );
- }
+ $lb = wfGetLB();
+ $i = $lb->getReaderIndex();
+ $host = $lb->getServerName( $i );
}
$this->output( "$host\n" );
}