MediaWiki
REL1_39
SessionConsistentConnectionManager.php
Go to the documentation of this file.
1
<?php
20
namespace
Wikimedia\Rdbms
;
21
43
class
SessionConsistentConnectionManager
extends
ConnectionManager
{
44
48
private
$forceWriteConnection =
false
;
49
56
public
function
prepareForUpdates
() {
57
$this->forceWriteConnection =
true
;
58
}
59
69
public
function
getReadConnection
( ?array $groups =
null
,
int
$flags = 0 ) {
70
if
( $this->forceWriteConnection ) {
71
return
parent::getWriteConnection( $flags );
72
}
73
74
return
parent::getReadConnection( $groups, $flags );
75
}
76
85
public
function
getWriteConnection
(
int
$flags = 0 ) {
86
$this->
prepareForUpdates
();
87
return
parent::getWriteConnection( $flags );
88
}
89
97
public
function
getReadConnectionRef
( array $groups =
null
) {
98
if
( $this->forceWriteConnection ) {
99
return
parent::getWriteConnectionRef();
100
}
101
102
return
parent::getReadConnectionRef( $groups );
103
}
104
110
public
function
getWriteConnectionRef
() {
111
$this->
prepareForUpdates
();
112
return
parent::getWriteConnectionRef();
113
}
114
115
}
Wikimedia\Rdbms\ConnectionManager
Database connection manager.
Definition
ConnectionManager.php:33
Wikimedia\Rdbms\SessionConsistentConnectionManager
Database connection manager.
Definition
SessionConsistentConnectionManager.php:43
Wikimedia\Rdbms\SessionConsistentConnectionManager\getReadConnectionRef
getReadConnectionRef(array $groups=null)
Definition
SessionConsistentConnectionManager.php:97
Wikimedia\Rdbms\SessionConsistentConnectionManager\getWriteConnectionRef
getWriteConnectionRef()
Definition
SessionConsistentConnectionManager.php:110
Wikimedia\Rdbms\SessionConsistentConnectionManager\getReadConnection
getReadConnection(?array $groups=null, int $flags=0)
Definition
SessionConsistentConnectionManager.php:69
Wikimedia\Rdbms\SessionConsistentConnectionManager\prepareForUpdates
prepareForUpdates()
Forces all future calls to getReadConnection() to return a write connection.
Definition
SessionConsistentConnectionManager.php:56
Wikimedia\Rdbms\SessionConsistentConnectionManager\getWriteConnection
getWriteConnection(int $flags=0)
Definition
SessionConsistentConnectionManager.php:85
Wikimedia\Rdbms
Definition
ChronologyProtector.php:20
includes
libs
rdbms
connectionmanager
SessionConsistentConnectionManager.php
Generated on Mon Oct 14 2024 07:23:30 for MediaWiki by
1.10.0