Replace use of &$this
[lhc/web/wiklou.git] / includes / libs / rdbms / database / Database.php
index ee4524f..d15d6f1 100644 (file)
@@ -26,6 +26,7 @@
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
 use Wikimedia\ScopedCallback;
+use Wikimedia\Rdbms\TransactionProfiler;
 
 /**
  * Relational database abstraction object
@@ -898,7 +899,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
 
                if ( false === $ret ) {
                        # Deadlocks cause the entire transaction to abort, not just the statement.
-                       # http://dev.mysql.com/doc/refman/5.7/en/innodb-error-handling.html
+                       # https://dev.mysql.com/doc/refman/5.7/en/innodb-error-handling.html
                        # https://www.postgresql.org/docs/9.1/static/explicit-locking.html
                        if ( $this->wasDeadlock() ) {
                                if ( $this->explicitTrxActive() || $priorWritesPending ) {
@@ -1419,9 +1420,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                }
 
                $table = $this->tableName( $table );
-               $old = $this->ignoreErrors( true );
-               $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname );
-               $this->ignoreErrors( $old );
+               $ignoreErrors = true;
+               $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname, $ignoreErrors );
 
                return (bool)$res;
        }
@@ -2314,7 +2314,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                        $selectOptions );
 
                if ( is_array( $srcTable ) ) {
-                       $srcTable = implode( ',', array_map( [ &$this, 'tableName' ], $srcTable ) );
+                       $srcTable = implode( ',', array_map( [ $this, 'tableName' ], $srcTable ) );
                } else {
                        $srcTable = $this->tableName( $srcTable );
                }
@@ -2862,23 +2862,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                return $this->mTrxLevel && ( $this->mTrxAtomicLevels || !$this->mTrxAutomatic );
        }
 
-       /**
-        * Creates a new table with structure copied from existing table
-        * Note that unlike most database abstraction functions, this function does not
-        * automatically append database prefix, because it works at a lower
-        * abstraction level.
-        * The table names passed to this function shall not be quoted (this
-        * function calls addIdentifierQuotes when needed).
-        *
-        * @param string $oldName Name of table whose structure should be copied
-        * @param string $newName Name of table to be created
-        * @param bool $temporary Whether the new table should be temporary
-        * @param string $fname Calling function name
-        * @throws RuntimeException
-        * @return bool True if operation was successful
-        */
-       public function duplicateTableStructure( $oldName, $newName, $temporary = false,
-               $fname = __METHOD__
+       public function duplicateTableStructure(
+               $oldName, $newName, $temporary = false, $fname = __METHOD__
        ) {
                throw new RuntimeException( __METHOD__ . ' is not implemented in descendant class' );
        }