X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDBConnRef.php;h=20198bf14cd1c757b91b22489725bb484ababef8;hb=a8a8eb39a863739b835e3da0b0693e1ba4726b9a;hp=9035bbd5c94b530b31356b1f7f39bc60bd9fd031;hpb=0bbba6e0d4a99a63c020acb402b6e57baa4863b0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/database/DBConnRef.php b/includes/libs/rdbms/database/DBConnRef.php index 9035bbd5c9..20198bf14c 100644 --- a/includes/libs/rdbms/database/DBConnRef.php +++ b/includes/libs/rdbms/database/DBConnRef.php @@ -14,22 +14,22 @@ class DBConnRef implements IDatabase { /** @var IDatabase|null Live connection handle */ private $conn; - /** @var array|null */ + /** @var array|null N-tuple of (server index, group, DatabaseDomain|string) */ private $params; const FLD_INDEX = 0; const FLD_GROUP = 1; - const FLD_WIKI = 2; + const FLD_DOMAIN = 2; /** * @param ILoadBalancer $lb - * @param IDatabase|array $conn Connection or (server index, group, wiki ID) + * @param IDatabase|array $conn Connection or (server index, group, DatabaseDomain|string) */ public function __construct( ILoadBalancer $lb, $conn ) { $this->lb = $lb; if ( $conn instanceof IDatabase ) { $this->conn = $conn; // live handle - } elseif ( count( $conn ) >= 3 && $conn[self::FLD_WIKI] !== false ) { + } elseif ( count( $conn ) >= 3 && $conn[self::FLD_DOMAIN] !== false ) { $this->params = $conn; } else { throw new InvalidArgumentException( "Missing lazy connection arguments." ); @@ -145,15 +145,20 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function getWikiID() { + public function getDomainID() { if ( $this->conn === null ) { - // Avoid triggering a connection - return $this->params[self::FLD_WIKI]; + $domain = $this->params[self::FLD_DOMAIN]; + // Avoid triggering a database connection + return $domain instanceof DatabaseDomain ? $domain->getId() : $domain; } return $this->__call( __FUNCTION__, func_get_args() ); } + public function getWikiID() { + return $this->getDomainID(); + } + public function getType() { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -303,7 +308,7 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function makeList( $a, $mode = LIST_COMMA ) { + public function makeList( $a, $mode = self::LIST_COMMA ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -311,6 +316,10 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } + public function aggregateValue( $valuedata, $valuename = 'value' ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + public function bitNot( $field ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -333,6 +342,10 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } + public function buildStringCast( $field ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + public function selectDB( $db ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -432,7 +445,7 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function getSlavePos() { + public function getReplicaPos() { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -444,15 +457,15 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } - public function onTransactionResolution( callable $callback ) { + public function onTransactionResolution( callable $callback, $fname = __METHOD__ ) { return $this->__call( __FUNCTION__, func_get_args() ); } - public function onTransactionIdle( callable $callback ) { + public function onTransactionIdle( callable $callback, $fname = __METHOD__ ) { return $this->__call( __FUNCTION__, func_get_args() ); } - public function onTransactionPreCommitOrIdle( callable $callback ) { + public function onTransactionPreCommitOrIdle( callable $callback, $fname = __METHOD__ ) { return $this->__call( __FUNCTION__, func_get_args() ); } @@ -574,6 +587,10 @@ class DBConnRef implements IDatabase { return $this->__call( __FUNCTION__, func_get_args() ); } + public function setTableAliases( array $aliases ) { + return $this->__call( __FUNCTION__, func_get_args() ); + } + /** * Clean up the connection when out of scope */