Merge "Remove unused 'XMPGetInfo' and 'XMPGetResults' hooks"
[lhc/web/wiklou.git] / includes / db / Database.php
index 605dc7c..97073dd 100644 (file)
@@ -818,14 +818,14 @@ abstract class DatabaseBase implements IDatabase {
                $this->mSessionVars = $params['variables'];
 
                /** Get the default table prefix*/
-               if ( $tablePrefix == 'get from global' ) {
+               if ( $tablePrefix === 'get from global' ) {
                        $this->mTablePrefix = $wgDBprefix;
                } else {
                        $this->mTablePrefix = $tablePrefix;
                }
 
                /** Get the database schema*/
-               if ( $schema == 'get from global' ) {
+               if ( $schema === 'get from global' ) {
                        $this->mSchema = $wgDBmwschema;
                } else {
                        $this->mSchema = $schema;
@@ -2485,7 +2485,7 @@ abstract class DatabaseBase implements IDatabase {
                }
 
                # Quote $schema and merge it with the table name if needed
-               if ( $schema !== null ) {
+               if ( strlen( $schema ) ) {
                        if ( $format == 'quoted' && !$this->isQuotedIdentifier( $schema ) ) {
                                $schema = $this->addIdentifierQuotes( $schema );
                        }
@@ -3639,11 +3639,12 @@ abstract class DatabaseBase implements IDatabase {
                        }
 
                        $this->runOnTransactionPreCommitCallbacks();
+                       $writeTime = $this->pendingWriteQueryDuration();
                        $this->doCommit( $fname );
                        if ( $this->mTrxDoneWrites ) {
                                $this->mDoneWrites = microtime( true );
                                $this->getTransactionProfiler()->transactionWritingOut(
-                                       $this->mServer, $this->mDBname, $this->mTrxShortId );
+                                       $this->mServer, $this->mDBname, $this->mTrxShortId, $writeTime );
                        }
                        $this->runOnTransactionIdleCallbacks();
                }
@@ -3721,11 +3722,12 @@ abstract class DatabaseBase implements IDatabase {
                }
 
                $this->runOnTransactionPreCommitCallbacks();
+               $writeTime = $this->pendingWriteQueryDuration();
                $this->doCommit( $fname );
                if ( $this->mTrxDoneWrites ) {
                        $this->mDoneWrites = microtime( true );
                        $this->getTransactionProfiler()->transactionWritingOut(
-                               $this->mServer, $this->mDBname, $this->mTrxShortId );
+                               $this->mServer, $this->mDBname, $this->mTrxShortId, $writeTime );
                }
                $this->runOnTransactionIdleCallbacks();
        }
@@ -4240,7 +4242,7 @@ abstract class DatabaseBase implements IDatabase {
        }
 
        /**
-        * Check to see if a named lock is available. This is non-blocking.
+        * Check to see if a named lock is available (non-blocking)
         *
         * @param string $lockName Name of lock to poll
         * @param string $method Name of method calling us
@@ -4254,8 +4256,7 @@ abstract class DatabaseBase implements IDatabase {
        /**
         * Acquire a named lock
         *
-        * Abstracted from Filestore::lock() so child classes can implement for
-        * their own needs.
+        * Named locks are not related to transactions
         *
         * @param string $lockName Name of lock to aquire
         * @param string $method Name of method calling us
@@ -4267,7 +4268,9 @@ abstract class DatabaseBase implements IDatabase {
        }
 
        /**
-        * Release a lock.
+        * Release a lock
+        *
+        * Named locks are not related to transactions
         *
         * @param string $lockName Name of lock to release
         * @param string $method Name of method calling us
@@ -4280,6 +4283,16 @@ abstract class DatabaseBase implements IDatabase {
                return true;
        }
 
+       /**
+        * Check to see if a named lock used by lock() use blocking queues
+        *
+        * @return bool
+        * @since 1.26
+        */
+       public function namedLocksEnqueue() {
+               return false;
+       }
+
        /**
         * Lock specific tables
         *