MediaWiki master
SessionConsistentConnectionManager.php
Go to the documentation of this file.
1<?php
20namespace Wikimedia\Rdbms;
21
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
90}
Database connection manager.
prepareForUpdates()
Forces all future calls to getReadConnection() to return a write connection.