Merge "Make sure hash_hmac() always works even if no secret key"
[lhc/web/wiklou.git] / includes / deferred / SqlDataUpdate.php
index 14bae23..5823b2e 100644 (file)
  *       the beginTransaction() and commitTransaction() methods.
  */
 abstract class SqlDataUpdate extends DataUpdate {
-       /** @var DatabaseBase Database connection reference */
+       /** @var IDatabase Database connection reference */
        protected $mDb;
 
        /** @var array SELECT options to be used (array) */
-       protected $mOptions;
+       protected $mOptions = array();
 
        /** @var bool Whether a transaction is open on this object (internal use only!) */
        private $mHasTransaction;
@@ -46,24 +46,14 @@ abstract class SqlDataUpdate extends DataUpdate {
        /**
         * Constructor
         *
-        * @param bool $withTransaction whether this update should be wrapped in a
+        * @param bool $withTransaction Whether this update should be wrapped in a
         *   transaction (default: true). A transaction is only started if no
         *   transaction is already in progress, see beginTransaction() for details.
         */
        public function __construct( $withTransaction = true ) {
-               global $wgAntiLockFlags;
-
                parent::__construct();
 
-               if ( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) {
-                       $this->mOptions = array();
-               } else {
-                       $this->mOptions = array( 'FOR UPDATE' );
-               }
-
-               // @todo Get connection only when it's needed? Make sure that doesn't
-               // break anything, especially transactions!
-               $this->mDb = wfGetDB( DB_MASTER );
+               $this->mDb = wfGetLB()->getLazyConnectionRef( DB_MASTER );
 
                $this->mWithTransaction = $withTransaction;
                $this->mHasTransaction = false;