MediaWiki REL1_32
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.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))