MediaWiki master
CloneDatabase Class Reference

Public Member Functions

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

Static Public Member Functions

static changePrefix (string $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 51 of file CloneDatabase.php.

References Wikimedia\Rdbms\IReadableDatabase\tablePrefix().

Member Function Documentation

◆ changePrefix()

static CloneDatabase::changePrefix ( string $prefix)
static

Change the table prefix on all open DB connections.

Parameters
string$prefix
Returns
void

Definition at line 132 of file CloneDatabase.php.

◆ cloneTableStructure()

CloneDatabase::cloneTableStructure ( )

Definition at line 76 of file CloneDatabase.php.

References $wgSharedDB, and $wgSharedTables.

◆ destroy()

CloneDatabase::destroy ( bool $dropTables = false)

Change the prefix back to the original.

Parameters
bool$dropTablesOptionally drop the tables we created

Definition at line 116 of file CloneDatabase.php.

◆ useTemporaryTables()

CloneDatabase::useTemporaryTables ( bool $u = true)

Set whether to use temporary tables or not.

Parameters
bool$uUse temporary tables when cloning the structure

Definition at line 72 of file CloneDatabase.php.


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