Merge "Revert "Made LCStoreDB try to use a separate DB connection""
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 13 Aug 2014 21:01:36 +0000 (21:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 13 Aug 2014 21:01:36 +0000 (21:01 +0000)
1  2 
includes/cache/LocalisationCache.php

@@@ -20,6 -20,8 +20,6 @@@
   * @file
   */
  
 -define( 'MW_LC_VERSION', 2 );
 -
  /**
   * Class for caching the contents of localisation files, Messages*.php
   * and *.i18n.php.
@@@ -33,8 -35,6 +33,8 @@@
   * as grammatical transformation, is done by the caller.
   */
  class LocalisationCache {
 +      const VERSION = 2;
 +
        /** Configuration associative array */
        private $conf;
  
         *
         * Returns true if any data from the extension array was used, false
         * otherwise.
 -       * @param string $codeSequence
 +       * @param array $codeSequence
         * @param string $key
         * @param mixed $value
         * @param mixed $fallbackValue
                # Add cache dependencies for any referenced globals
                $deps['wgExtensionMessagesFiles'] = new GlobalDependency( 'wgExtensionMessagesFiles' );
                $deps['wgMessagesDirs'] = new GlobalDependency( 'wgMessagesDirs' );
 -              $deps['version'] = new ConstantDependency( 'MW_LC_VERSION' );
 +              $deps['version'] = new ConstantDependency( 'LocalisationCache::VERSION' );
  
                # Add dependencies to the cache entry
                $allData['deps'] = $deps;
@@@ -1163,8 -1163,8 +1163,8 @@@ class LCStoreDB implements LCStore 
        private $readOnly = false;
  
        public function get( $code, $key ) {
-               if ( $this->writesDone && $this->dbw ) {
-                       $db = $this->dbw;
+               if ( $this->writesDone ) {
+                       $db = wfGetDB( DB_MASTER );
                } else {
                        $db = wfGetDB( DB_SLAVE );
                }
                        throw new MWException( __METHOD__ . ": Invalid language \"$code\"" );
                }
  
-               // We must keep a separate connection to MySQL in order to avoid breaking
-               // main transactions. However, SQLite deadlocks when using two connections.
-               // @todo get this trick to work on PostgreSQL too
-               if ( wfGetDB( DB_MASTER )->getType() == 'mysql' ) {
-                       $lb = wfGetLBFactory()->newMainLB();
-                       $this->dbw = $lb->getConnection( DB_MASTER );
-                       $this->dbw->clearFlag( DBO_TRX ); // auto-commit mode
-               } else {
-                       $this->dbw = wfGetDB( DB_MASTER );
-               }
+               $this->dbw = wfGetDB( DB_MASTER );
  
                $this->currentLang = $code;
                $this->batch = array();