Add @deprecated tags to DatabaseBase
[lhc/web/wiklou.git] / includes / libs / rdbms / database / Database.php
index f44b7cb..d1230e0 100644 (file)
@@ -677,6 +677,10 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                );
        }
 
+       public function preCommitCallbacksPending() {
+               return $this->trxLevel && $this->trxPreCommitCallbacks;
+       }
+
        /**
         * @return string|null
         */
@@ -722,12 +726,14 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        }
 
        /**
-        * Get the list of method names that have pending write queries or that
-        * have transaction callbacks that have yet to run
+        * List the methods that have write queries or callbacks for the current transaction
         *
-        * @return array
+        * This method should not be used outside of Database/LoadBalancer
+        *
+        * @return string[]
+        * @since 1.32
         */
-       protected function pendingWriteAndCallbackCallers() {
+       public function pendingWriteAndCallbackCallers() {
                $fnames = $this->pendingWriteCallers();
                foreach ( [
                        $this->trxIdleCallbacks,
@@ -3286,7 +3292,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                $this->trxEndCallbacks[] = [ $callback, $fname, $this->currentAtomicSectionId() ];
        }
 
-       final public function onTransactionIdle( callable $callback, $fname = __METHOD__ ) {
+       final public function onTransactionCommitOrIdle( callable $callback, $fname = __METHOD__ ) {
                if ( !$this->trxLevel && $this->getTransactionRoundId() ) {
                        // Start an implicit transaction similar to how query() does
                        $this->begin( __METHOD__, self::TRANSACTION_INTERNAL );
@@ -3299,6 +3305,10 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
                }
        }
 
+       final public function onTransactionIdle( callable $callback, $fname = __METHOD__ ) {
+               $this->onTransactionCommitOrIdle( $callback, $fname );
+       }
+
        final public function onTransactionPreCommitOrIdle( callable $callback, $fname = __METHOD__ ) {
                if ( !$this->trxLevel && $this->getTransactionRoundId() ) {
                        // Start an implicit transaction similar to how query() does
@@ -4628,5 +4638,12 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        }
 }
 
-class_alias( Database::class, 'DatabaseBase' ); // b/c for old name
-class_alias( Database::class, 'Database' ); // b/c global alias
+/**
+ * @deprecated since 1.28
+ */
+class_alias( Database::class, 'DatabaseBase' );
+
+/**
+ * @deprecated since 1.29
+ */
+class_alias( Database::class, 'Database' );