r79337 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79336‎ | r79337 | r79338 >
Date:14:08, 31 December 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Follow up r79314.
The table to drop is the NEW one, the one that is going to be recreated.
Sure, the prefix was changed, which means that we need just the table base.

The r79314 behavior was to perform the following:
DROP /* CloneDatabase::cloneTableStructure */ TABLE IF EXISTS `archive`
CREATE /* DatabaseMysql::duplicateTableStructure */ TEMPORARY TABLE `unittest_archive` (LIKE `archive`)

Luckily, it failed there as it didn't find the table it had just dropped.
Modified paths:
  • /trunk/phase3/includes/db/CloneDatabase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/CloneDatabase.php
@@ -96,9 +96,9 @@
9797
9898 $this->changePrefix( $this->newTablePrefix );
9999 $newTableName = $this->db->tableName( $tbl );
100 -
101 - if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres') ) ) {
102 - $this->db->dropTable( $oldTableName, __METHOD__ );
 100+
 101+ if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres' ) ) ) {
 102+ $this->db->dropTable( $tbl, __METHOD__ );
103103 //Dropping the oldTable because the prefix was changed
104104 }
105105

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79314Use $oldTableName in CloneDatabase. The dropTable() appends the prefix, so $o...soxred9302:18, 31 December 2010

Comments

#Comment by Freakolowsky (talk | contribs)   15:44, 10 January 2011

this CAN'T be right ... if you do not have a default prefix set you are dropping the table that's about to be cloned?!?

#Comment by Platonides (talk | contribs)   16:52, 10 January 2011

We are doing $this->db->dropTable( $tbl ) after $this->changePrefix( $this->newTablePrefix ), so we are dropping the new table.

Unlike r79314, this works correctly in the Real World™ when no prefix is set.

Status & tagging log