dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "(bug 40610) Prevent editing textarea from overflowing out of bodyContent"
[lhc/web/wiklou.git]
/
maintenance
/
getSlaveServer.php
diff --git
a/maintenance/getSlaveServer.php
b/maintenance/getSlaveServer.php
index
a9d93f1
..
ec9ed20
100644
(file)
--- a/
maintenance/getSlaveServer.php
+++ b/
maintenance/getSlaveServer.php
@@
-1,6
+1,6
@@
<?php
/**
<?php
/**
- *
This script r
eports the hostname of a slave server.
+ *
R
eports the hostname of a slave server.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-17,11
+17,17
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
* @ingroup Maintenance
*/
* @ingroup Maintenance
*/
-require_once(
dirname( __FILE__ )
. '/Maintenance.php' );
+require_once(
__DIR__
. '/Maintenance.php' );
+/**
+ * Maintenance script that reports the hostname of a slave server.
+ *
+ * @ingroup Maintenance
+ */
class GetSlaveServer extends Maintenance {
public function __construct() {
parent::__construct();
class GetSlaveServer extends Maintenance {
public function __construct() {
parent::__construct();
@@
-32,15
+38,13
@@
class GetSlaveServer extends Maintenance {
global $wgAllDBsAreLocalhost;
if ( $wgAllDBsAreLocalhost ) {
$host = 'localhost';
global $wgAllDBsAreLocalhost;
if ( $wgAllDBsAreLocalhost ) {
$host = 'localhost';
+ } elseif ( $this->hasOption( 'group' ) ) {
+ $db = wfGetDB( DB_SLAVE, $this->getOption( 'group' ) );
+ $host = $db->getServer();
} else {
} 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" );
}
}
$this->output( "$host\n" );
}