MediaWiki  1.27.4
CloneDatabase Class Reference
Collaboration diagram for CloneDatabase:

Public Member Functions

 __construct (DatabaseBase $db, array $tablesToClone, $newTablePrefix, $oldTablePrefix= '', $dropCurrentTables=true)
 Constructor. More...
 
 cloneTableStructure ()
 Clone the table structure. More...
 
 destroy ($dropTables=false)
 Change the prefix back to the original. More...
 
 useTemporaryTables ($u=true)
 Set whether to use temporary tables or not. More...
 

Static Public Member Functions

static changeDBPrefix ($db, $prefix)
 
static changeLBPrefix ($lb, $prefix)
 
static changePrefix ($prefix)
 Change the table prefix on all open DB connections/. More...
 

Private Attributes

bool $dropCurrentTables = true
 Should we DROP tables containing the new names? More...
 
string $newTablePrefix = ''
 Table prefix for cloning. More...
 
string $oldTablePrefix = ''
 Current table prefix. More...
 
array $tablesToClone = []
 List of tables to be cloned. More...
 
bool $useTemporaryTables = true
 Whether to use temporary tables or not. More...
 

Detailed Description

Definition at line 27 of file CloneDatabase.php.

Constructor & Destructor Documentation

CloneDatabase::__construct ( DatabaseBase  $db,
array  $tablesToClone,
  $newTablePrefix,
  $oldTablePrefix = '',
  $dropCurrentTables = true 
)

Constructor.

Parameters
DatabaseBase$dbA database subclass
array$tablesToCloneAn array of tables to clone, unprefixed
string$newTablePrefixPrefix to assign to the tables
string$oldTablePrefixPrefix on current tables, if not $wgDBprefix
bool$dropCurrentTables

Definition at line 52 of file CloneDatabase.php.

References $dropCurrentTables, $newTablePrefix, and $tablesToClone.

Member Function Documentation

static CloneDatabase::changeDBPrefix (   $db,
  $prefix 
)
static
Parameters
DatabaseBase$db
string$prefix
Returns
void

Definition at line 150 of file CloneDatabase.php.

static CloneDatabase::changeLBPrefix (   $lb,
  $prefix 
)
static
Parameters
LoadBalancer$lb
string$prefix
Returns
void

Definition at line 141 of file CloneDatabase.php.

static CloneDatabase::changePrefix (   $prefix)
static

Change the table prefix on all open DB connections/.

Parameters
string$prefix
Returns
void

Definition at line 130 of file CloneDatabase.php.

References $wgDBprefix, global, and wfGetLBFactory().

Referenced by MediaWikiTestCase\setupDatabaseWithTestPrefix(), and MediaWikiTestCase\teardownTestDB().

CloneDatabase::cloneTableStructure ( )

Clone the table structure.

Definition at line 73 of file CloneDatabase.php.

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

CloneDatabase::destroy (   $dropTables = false)

Change the prefix back to the original.

Parameters
bool$dropTablesOptionally drop the tables we created

Definition at line 114 of file CloneDatabase.php.

References as.

CloneDatabase::useTemporaryTables (   $u = true)

Set whether to use temporary tables or not.

Parameters
bool$uUse temporary tables when cloning the structure

Definition at line 66 of file CloneDatabase.php.

Referenced by cloneTableStructure().

Member Data Documentation

bool CloneDatabase::$dropCurrentTables = true
private

Should we DROP tables containing the new names?

Definition at line 38 of file CloneDatabase.php.

Referenced by __construct().

string CloneDatabase::$newTablePrefix = ''
private

Table prefix for cloning.

Definition at line 29 of file CloneDatabase.php.

Referenced by __construct().

string CloneDatabase::$oldTablePrefix = ''
private

Current table prefix.

Definition at line 32 of file CloneDatabase.php.

array CloneDatabase::$tablesToClone = []
private

List of tables to be cloned.

Definition at line 35 of file CloneDatabase.php.

Referenced by __construct().

bool CloneDatabase::$useTemporaryTables = true
private

Whether to use temporary tables or not.

Definition at line 41 of file CloneDatabase.php.


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