MediaWiki REL1_40
CloneDatabase Class Reference

Public Member Functions

 __construct (IMaintainableDatabase $db, array $tablesToClone, string $newTablePrefix, string $oldTablePrefix=null, bool $dropCurrentTables=true)
 
 cloneTableStructure ()
 
 destroy ( $dropTables=false)
 Change the prefix back to the original.
 
 useTemporaryTables ( $u=true)
 Set whether to use temporary tables or not.
 

Static Public Member Functions

static changePrefix ( $prefix)
 Change the table prefix on all open DB connections.
 

Detailed Description

Definition at line 26 of file CloneDatabase.php.

Constructor & Destructor Documentation

◆ __construct()

CloneDatabase::__construct ( IMaintainableDatabase $db,
array $tablesToClone,
string $newTablePrefix,
string $oldTablePrefix = null,
bool $dropCurrentTables = true )
Parameters
IMaintainableDatabase$dbA database subclass
array$tablesToCloneAn array of tables to clone, unprefixed
string$newTablePrefixPrefix to assign to the tables
string | null$oldTablePrefixPrefix on current tables, if not $wgDBprefix
bool$dropCurrentTables

Definition at line 52 of file CloneDatabase.php.

References Wikimedia\Rdbms\IReadableDatabase\tablePrefix().

Member Function Documentation

◆ changePrefix()

static CloneDatabase::changePrefix ( $prefix)
static

Change the table prefix on all open DB connections.

Parameters
string$prefix
Returns
void

Definition at line 135 of file CloneDatabase.php.

References $wgDBname, and $wgDBprefix.

◆ cloneTableStructure()

CloneDatabase::cloneTableStructure ( )

Definition at line 77 of file CloneDatabase.php.

References $wgSharedDB, $wgSharedTables, useTemporaryTables(), and wfDebug().

◆ destroy()

CloneDatabase::destroy ( $dropTables = false)

Change the prefix back to the original.

Parameters
bool$dropTablesOptionally drop the tables we created

Definition at line 119 of file CloneDatabase.php.

◆ useTemporaryTables()

CloneDatabase::useTemporaryTables ( $u = true)

Set whether to use temporary tables or not.

Parameters
bool$uUse temporary tables when cloning the structure

Definition at line 73 of file CloneDatabase.php.

References useTemporaryTables().

Referenced by cloneTableStructure(), and useTemporaryTables().


The documentation for this class was generated from the following file: