IAlex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/118813
Change subject: Move variable definitions near to where they are used
......................................................................
Move variable definitions near to where they are used
In LoadBalancer::reuseConnection(), if the condition
"$serverIndex === null || $refCount === null" is met,
then those variables will not be used. So only define
them when they will readlly be used.
Change-Id: Ifbd4131f40d3babe733b8723d0d29d39890bb309
---
M includes/db/LoadBalancer.php
1 file changed, 8 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/13/118813/1
diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php
index 5f880d6..de4c2f5 100644
--- a/includes/db/LoadBalancer.php
+++ b/includes/db/LoadBalancer.php
@@ -493,13 +493,6 @@
public function reuseConnection( $conn ) {
$serverIndex = $conn->getLBInfo( 'serverIndex' );
$refCount = $conn->getLBInfo( 'foreignPoolRefCount' );
- $dbName = $conn->getDBname();
- $prefix = $conn->tablePrefix();
- if ( strval( $prefix ) !== '' ) {
- $wiki = "$dbName-$prefix";
- } else {
- $wiki = $dbName;
- }
if ( $serverIndex === null || $refCount === null ) {
wfDebug( __METHOD__ . ": this connection was not opened
as a foreign connection\n" );
@@ -516,6 +509,14 @@
return;
}
+
+ $dbName = $conn->getDBname();
+ $prefix = $conn->tablePrefix();
+ if ( strval( $prefix ) !== '' ) {
+ $wiki = "$dbName-$prefix";
+ } else {
+ $wiki = $dbName;
+ }
if ( $this->mConns['foreignUsed'][$serverIndex][$wiki] !==
$conn ) {
throw new MWException( __METHOD__ . ": connection not
found, has " .
"the connection been freed already?" );
--
To view, visit https://gerrit.wikimedia.org/r/118813
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbd4131f40d3babe733b8723d0d29d39890bb309
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits