MediaWiki
REL1_37
SessionConsistentConnectionManager.php
Go to the documentation of this file.
1
<?php
22
namespace
Wikimedia\Rdbms
;
23
45
class
SessionConsistentConnectionManager
extends
ConnectionManager
{
46
50
private
$forceWriteConnection
=
false
;
51
58
public
function
prepareForUpdates
() {
59
$this->forceWriteConnection =
true
;
60
}
61
71
public
function
getReadConnection
( ?array
$groups
=
null
,
int
$flags = 0 ) {
72
if
( $this->forceWriteConnection ) {
73
return
parent::getWriteConnection( $flags );
74
}
75
76
return
parent::getReadConnection(
$groups
, $flags );
77
}
78
87
public
function
getWriteConnection
(
int
$flags = 0 ) {
88
$this->
prepareForUpdates
();
89
return
parent::getWriteConnection( $flags );
90
}
91
99
public
function
getReadConnectionRef
( array
$groups
=
null
) {
100
if
( $this->forceWriteConnection ) {
101
return
parent::getWriteConnectionRef();
102
}
103
104
return
parent::getReadConnectionRef(
$groups
);
105
}
106
112
public
function
getWriteConnectionRef
() {
113
$this->
prepareForUpdates
();
114
return
parent::getWriteConnectionRef();
115
}
116
117
}
Wikimedia\Rdbms\ConnectionManager
Database connection manager.
Definition
ConnectionManager.php:35
Wikimedia\Rdbms\ConnectionManager\$groups
string[] $groups
Definition
ConnectionManager.php:52
Wikimedia\Rdbms\SessionConsistentConnectionManager
Database connection manager.
Definition
SessionConsistentConnectionManager.php:45
Wikimedia\Rdbms\SessionConsistentConnectionManager\getReadConnectionRef
getReadConnectionRef(array $groups=null)
Definition
SessionConsistentConnectionManager.php:99
Wikimedia\Rdbms\SessionConsistentConnectionManager\getWriteConnectionRef
getWriteConnectionRef()
Definition
SessionConsistentConnectionManager.php:112
Wikimedia\Rdbms\SessionConsistentConnectionManager\$forceWriteConnection
bool $forceWriteConnection
Definition
SessionConsistentConnectionManager.php:50
Wikimedia\Rdbms\SessionConsistentConnectionManager\getReadConnection
getReadConnection(?array $groups=null, int $flags=0)
Definition
SessionConsistentConnectionManager.php:71
Wikimedia\Rdbms\SessionConsistentConnectionManager\prepareForUpdates
prepareForUpdates()
Forces all future calls to getReadConnection() to return a write connection.
Definition
SessionConsistentConnectionManager.php:58
Wikimedia\Rdbms\SessionConsistentConnectionManager\getWriteConnection
getWriteConnection(int $flags=0)
Definition
SessionConsistentConnectionManager.php:87
Wikimedia\Rdbms
Definition
ChronologyProtector.php:24
includes
libs
rdbms
connectionmanager
SessionConsistentConnectionManager.php
Generated on Fri Apr 5 2024 23:40:29 for MediaWiki by
1.9.8