Merge "Fix --memory-limit option to maintenance scripts"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / utils / SavepointPostgres.php
index ec4d09f..edbcdfe 100644 (file)
  * @file
  * @ingroup Database
  */
+
+namespace Wikimedia\Rdbms;
+
 use Psr\Log\LoggerInterface;
 
 /**
  * Manage savepoints within a transaction
  * @ingroup Database
  * @since 1.19
+ * @deprecated since 1.31, use IDatabase::startAtomic() and such instead.
  */
 class SavepointPostgres {
        /** @var DatabasePostgres Establish a savepoint within a transaction */
@@ -47,7 +51,7 @@ class SavepointPostgres {
                $this->didbegin = false;
                /* If we are not in a transaction, we need to be for savepoint trickery */
                if ( !$dbw->trxLevel() ) {
-                       $dbw->begin( "FOR SAVEPOINT", DatabasePostgres::TRANSACTION_INTERNAL );
+                       $dbw->begin( __CLASS__, DatabasePostgres::TRANSACTION_INTERNAL );
                        $this->didbegin = true;
                }
        }
@@ -61,7 +65,7 @@ class SavepointPostgres {
 
        public function commit() {
                if ( $this->didbegin ) {
-                       $this->dbw->commit();
+                       $this->dbw->commit( __CLASS__, DatabasePostgres::FLUSHING_INTERNAL );
                        $this->didbegin = false;
                }
        }