X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2FCloneDatabase.php;h=3d22c037ae1c6d32ea9a0abdbbc96e159a097e3a;hb=91a920fd85c34e64f47140ed82f2ac0913ed8033;hp=2b394b6d7bf076e39b368ef9e55c5382d9b46d01;hpb=6186cfef91f5f33f56beb886a542f06ea2350850;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php index 2b394b6d7b..3d22c037ae 100644 --- a/includes/db/CloneDatabase.php +++ b/includes/db/CloneDatabase.php @@ -24,6 +24,7 @@ * @ingroup Database */ use MediaWiki\MediaWikiServices; +use Wikimedia\Rdbms\IMaintainableDatabase; class CloneDatabase { /** @var string Table prefix for cloning */ @@ -45,8 +46,6 @@ class CloneDatabase { private $db; /** - * Constructor - * * @param IMaintainableDatabase $db A database subclass * @param array $tablesToClone An array of tables to clone, unprefixed * @param string $newTablePrefix Prefix to assign to the tables @@ -79,7 +78,7 @@ class CloneDatabase { foreach ( $this->tablesToClone as $tbl ) { if ( $wgSharedDB && in_array( $tbl, $wgSharedTables, true ) ) { // Shared tables don't work properly when cloning due to - // how prefixes are handled (bug 65654) + // how prefixes are handled (T67654) throw new RuntimeException( "Cannot clone shared table $tbl." ); } # Clean up from previous aborted run. So that table escaping @@ -92,8 +91,10 @@ class CloneDatabase { self::changePrefix( $this->newTablePrefix ); $newTableName = $this->db->tableName( $tbl, 'raw' ); + // Postgres: Temp tables are automatically deleted upon end of session + // Same Temp table name hides existing table for current session if ( $this->dropCurrentTables - && !in_array( $this->db->getType(), [ 'postgres', 'oracle' ] ) + && !in_array( $this->db->getType(), [ 'oracle' ] ) ) { if ( $oldTableName === $newTableName ) { // Last ditch check to avoid data loss