Remove superfluous re- from confirmemail_body_set
[mediawiki.git] / includes / dao / DBAccessBase.php
blob6c009dee13a5f39afb7df7c2297e0ba40b43f0b3
1 <?php
3 /**
4 * Base class for objects that allow access to other wiki's databases using
5 * the foreign database access mechanism implemented by LBFactory_multi.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
22 * @since 1.21
24 * @file
25 * @ingroup Database
27 * @licence GNU GPL v2+
28 * @author Daniel Kinzler
30 abstract class DBAccessBase implements IDBAccessObject {
32 /**
33 * @var String|bool $wiki The target wiki's name. This must be an ID
34 * that LBFactory can understand.
36 protected $wiki = false;
38 /**
39 * @param string|bool $wiki The target wiki's name. This must be an ID
40 * that LBFactory can understand.
42 public function __construct( $wiki = false ) {
43 $this->wiki = $wiki;
46 /**
47 * Returns a database connection.
49 * @see wfGetDB()
50 * @see LoadBalancer::getConnection()
52 * @since 1.21
54 * @param int $id Which connection to use
55 * @param array $groups Query groups
57 * @return DatabaseBase
59 protected function getConnection( $id, $groups = array() ) {
60 $loadBalancer = wfGetLB( $this->wiki );
61 return $loadBalancer->getConnection( $id, $groups, $this->wiki );
64 /**
65 * Releases a database connection and makes it available for recycling.
67 * @see LoadBalancer::reuseConnection()
69 * @since 1.21
71 * @param DatabaseBase $db the database connection to release.
73 protected function releaseConnection( DatabaseBase $db ) {
74 if ( $this->wiki !== false ) {
75 $loadBalancer = $this->getLoadBalancer();
76 $loadBalancer->reuseConnection( $db );
80 /**
81 * Get the database type used for read operations.
83 * @see wfGetLB
85 * @since 1.21
87 * @return LoadBalancer The database load balancer object
89 public function getLoadBalancer() {
90 return wfGetLB( $this->wiki );