r78184 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78183‎ | r78184 | r78185 >
Date:14:04, 10 December 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
One more $wgDBtype. I think this is the last offender in core; all the remaining usages are justified
Modified paths:
  • /trunk/phase3/includes/BagOStuff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/BagOStuff.php
@@ -240,14 +240,12 @@
241241 var $lastExpireAll = 0;
242242
243243 protected function getDB() {
244 - global $wgDBtype;
245 -
246244 if ( !isset( $this->db ) ) {
247245 /* We must keep a separate connection to MySQL in order to avoid deadlocks
248246 * However, SQLite has an opposite behaviour.
249247 * @todo Investigate behaviour for other databases
250248 */
251 - if ( $wgDBtype == 'sqlite' ) {
 249+ if ( wfGetDB( DB_MASTER )->getType() == 'sqlite' ) {
252250 $this->db = wfGetDB( DB_MASTER );
253251 } else {
254252 $this->lb = wfGetLBFactory()->newMainLB();

Comments

#Comment by MaxSem (talk | contribs)   22:38, 10 December 2010

Probably worth caching the wfGetDB result.

#Comment by Catrope (talk | contribs)   22:39, 10 December 2010

wfGetDB does caching of its own, AFAIK.

Status & tagging log