MediaWiki REL1_31
SessionConsistentConnectionManager.php
Go to the documentation of this file.
1<?php
22namespace Wikimedia\Rdbms;
23
46
50 private $forceWriteConnection = false;
51
58 public function prepareForUpdates() {
59 $this->forceWriteConnection = true;
60 }
61
69 public function getReadConnection( array $groups = null ) {
70 if ( $this->forceWriteConnection ) {
71 return parent::getWriteConnection();
72 }
73
74 return parent::getReadConnection( $groups );
75 }
76
82 public function getWriteConnection() {
83 $this->prepareForUpdates();
84 return parent::getWriteConnection();
85 }
86
94 public function getReadConnectionRef( array $groups = null ) {
95 if ( $this->forceWriteConnection ) {
96 return parent::getWriteConnectionRef();
97 }
98
99 return parent::getReadConnectionRef( $groups );
100 }
101
107 public function getWriteConnectionRef() {
108 $this->prepareForUpdates();
109 return parent::getWriteConnectionRef();
110 }
111
112}
Database connection manager.
prepareForUpdates()
Forces all future calls to getReadConnection() to return a write connection.