rdbms: remove unused SavepointPostgres class
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 7 May 2019 04:11:06 +0000 (21:11 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 8 May 2019 21:33:23 +0000 (21:33 +0000)
Change-Id: I45117c10d7f4ab779e95536807dad055c2970117

RELEASE-NOTES-1.34
autoload.php
includes/libs/rdbms/database/utils/SavepointPostgres.php [deleted file]

index b58c269..0204a8b 100644 (file)
@@ -113,6 +113,7 @@ because of Phabricator reports.
   removed. Use UserGroupMembership::getGroupPage and ::getLink instead.
 * User::makeGroupLinkWiki(), deprecated in 1.29, has been removed. Use
   UserGroupMembership::getLink() instead.
+* SavepointPostgres, deprecated in 1.31, has been removed.
 * …
 
 === Deprecations in 1.34 ===
index 5d3e578..cdfa3e9 100644 (file)
@@ -1683,7 +1683,6 @@ $wgAutoloadLocalClasses = [
        'Wikimedia\\Rdbms\\PostgresField' => __DIR__ . '/includes/libs/rdbms/field/PostgresField.php',
        'Wikimedia\\Rdbms\\ResultWrapper' => __DIR__ . '/includes/libs/rdbms/database/resultwrapper/ResultWrapper.php',
        'Wikimedia\\Rdbms\\SQLiteField' => __DIR__ . '/includes/libs/rdbms/field/SQLiteField.php',
-       'Wikimedia\\Rdbms\\SavepointPostgres' => __DIR__ . '/includes/libs/rdbms/database/utils/SavepointPostgres.php',
        'Wikimedia\\Rdbms\\SessionConsistentConnectionManager' => __DIR__ . '/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php',
        'Wikimedia\\Rdbms\\Subquery' => __DIR__ . '/includes/libs/rdbms/encasing/Subquery.php',
        'Wikimedia\\Rdbms\\TransactionProfiler' => __DIR__ . '/includes/libs/rdbms/TransactionProfiler.php',
diff --git a/includes/libs/rdbms/database/utils/SavepointPostgres.php b/includes/libs/rdbms/database/utils/SavepointPostgres.php
deleted file mode 100644 (file)
index edbcdfe..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @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 */
-       protected $dbw;
-       /** @var LoggerInterface */
-       protected $logger;
-       /** @var int */
-       protected $id;
-       /** @var bool */
-       protected $didbegin;
-
-       /**
-        * @param DatabasePostgres $dbw
-        * @param int $id
-        * @param LoggerInterface $logger
-        */
-       public function __construct( DatabasePostgres $dbw, $id, LoggerInterface $logger ) {
-               $this->dbw = $dbw;
-               $this->logger = $logger;
-               $this->id = $id;
-               $this->didbegin = false;
-               /* If we are not in a transaction, we need to be for savepoint trickery */
-               if ( !$dbw->trxLevel() ) {
-                       $dbw->begin( __CLASS__, DatabasePostgres::TRANSACTION_INTERNAL );
-                       $this->didbegin = true;
-               }
-       }
-
-       public function __destruct() {
-               if ( $this->didbegin ) {
-                       $this->dbw->rollback();
-                       $this->didbegin = false;
-               }
-       }
-
-       public function commit() {
-               if ( $this->didbegin ) {
-                       $this->dbw->commit( __CLASS__, DatabasePostgres::FLUSHING_INTERNAL );
-                       $this->didbegin = false;
-               }
-       }
-
-       protected function query( $keyword, $msg_ok, $msg_failed ) {
-               if ( $this->dbw->doQuery( $keyword . " " . $this->id ) !== false ) {
-                       $this->logger->debug( sprintf( $msg_ok, $this->id ) );
-               } else {
-                       $this->logger->debug( sprintf( $msg_failed, $this->id ) );
-               }
-       }
-
-       public function savepoint() {
-               $this->query( "SAVEPOINT",
-                       "Transaction state: savepoint \"%s\" established.\n",
-                       "Transaction state: establishment of savepoint \"%s\" FAILED.\n"
-               );
-       }
-
-       public function release() {
-               $this->query( "RELEASE",
-                       "Transaction state: savepoint \"%s\" released.\n",
-                       "Transaction state: release of savepoint \"%s\" FAILED.\n"
-               );
-       }
-
-       public function rollback() {
-               $this->query( "ROLLBACK TO",
-                       "Transaction state: savepoint \"%s\" rolled back.\n",
-                       "Transaction state: rollback of savepoint \"%s\" FAILED.\n"
-               );
-       }
-
-       public function __toString() {
-               return (string)$this->id;
-       }
-}