MediaWiki
REL1_40
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
98
public
function
getReadConnectionRef
( array $groups =
null
) {
99
if
( $this->forceWriteConnection ) {
100
return
parent::getWriteConnectionRef();
101
}
102
103
return
parent::getReadConnectionRef( $groups );
104
}
105
112
public
function
getWriteConnectionRef
() {
113
$this->
prepareForUpdates
();
114
return
parent::getWriteConnectionRef();
115
}
116
117
}
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:98
Wikimedia\Rdbms\SessionConsistentConnectionManager\getWriteConnectionRef
getWriteConnectionRef()
Definition
SessionConsistentConnectionManager.php:112
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 Thu Jun 27 2024 14:03:13 for MediaWiki by
1.10.0