MediaWiki master
SessionConsistentConnectionManager.php
Go to the documentation of this file.
1<?php
6namespace Wikimedia\Rdbms;
7
30
34 private $forceWriteConnection = false;
35
42 public function prepareForUpdates() {
43 $this->forceWriteConnection = true;
44 }
45
55 public function getReadConnection( ?array $groups = null, int $flags = 0 ) {
56 if ( $this->forceWriteConnection ) {
57 return parent::getWriteConnection( $flags );
58 }
59
60 return parent::getReadConnection( $groups, $flags );
61 }
62
71 public function getWriteConnection( int $flags = 0 ) {
72 $this->prepareForUpdates();
73 return parent::getWriteConnection( $flags );
74 }
75
76}
Database connection manager.
prepareForUpdates()
Forces all future calls to getReadConnection() to return a write connection.