dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for extra database connections in unit tests.
[lhc/web/wiklou.git]
/
includes
/
db
/
CloneDatabase.php
diff --git
a/includes/db/CloneDatabase.php
b/includes/db/CloneDatabase.php
index
16d10d1
..
64c33df
100644
(file)
--- a/
includes/db/CloneDatabase.php
+++ b/
includes/db/CloneDatabase.php
@@
-50,12
+50,12
@@
class CloneDatabase {
* @param bool $dropCurrentTables
*/
public function __construct( IMaintainableDatabase $db, array $tablesToClone,
* @param bool $dropCurrentTables
*/
public function __construct( IMaintainableDatabase $db, array $tablesToClone,
- $newTablePrefix, $oldTablePrefix =
''
, $dropCurrentTables = true
+ $newTablePrefix, $oldTablePrefix =
null
, $dropCurrentTables = true
) {
$this->db = $db;
$this->tablesToClone = $tablesToClone;
$this->newTablePrefix = $newTablePrefix;
) {
$this->db = $db;
$this->tablesToClone = $tablesToClone;
$this->newTablePrefix = $newTablePrefix;
- $this->oldTablePrefix = $oldTablePrefix ? $oldTablePrefix : $this->db->tablePrefix();
+ $this->oldTablePrefix = $oldTablePrefix
!== null
? $oldTablePrefix : $this->db->tablePrefix();
$this->dropCurrentTables = $dropCurrentTables;
}
$this->dropCurrentTables = $dropCurrentTables;
}
@@
-82,10
+82,10
@@
class CloneDatabase {
# works correctly across DB engines, we need to change the pre-
# fix back and forth so tableName() works right.
# works correctly across DB engines, we need to change the pre-
# fix back and forth so tableName() works right.
-
self::chang
ePrefix( $this->oldTablePrefix );
+
$this->db->tabl
ePrefix( $this->oldTablePrefix );
$oldTableName = $this->db->tableName( $tbl, 'raw' );
$oldTableName = $this->db->tableName( $tbl, 'raw' );
-
self::chang
ePrefix( $this->newTablePrefix );
+
$this->db->tabl
ePrefix( $this->newTablePrefix );
$newTableName = $this->db->tableName( $tbl, 'raw' );
// Postgres: Temp tables are automatically deleted upon end of session
$newTableName = $this->db->tableName( $tbl, 'raw' );
// Postgres: Temp tables are automatically deleted upon end of session
@@
-116,12
+116,12
@@
class CloneDatabase {
*/
public function destroy( $dropTables = false ) {
if ( $dropTables ) {
*/
public function destroy( $dropTables = false ) {
if ( $dropTables ) {
-
self::chang
ePrefix( $this->newTablePrefix );
+
$this->db->tabl
ePrefix( $this->newTablePrefix );
foreach ( $this->tablesToClone as $tbl ) {
$this->db->dropTable( $tbl );
}
}
foreach ( $this->tablesToClone as $tbl ) {
$this->db->dropTable( $tbl );
}
}
-
self::chang
ePrefix( $this->oldTablePrefix );
+
$this->db->tabl
ePrefix( $this->oldTablePrefix );
}
/**
}
/**