MediaWiki
REL1_19
|
Helper class for making a copy of the database, mostly for unit testing. More...
Public Member Functions | |
__construct (DatabaseBase $db, array $tablesToClone, $newTablePrefix, $oldTablePrefix= '', $dropCurrentTables=true) | |
Constructor. | |
cloneTableStructure () | |
Clone the table structure. | |
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 | changeDBPrefix ($db, $prefix) |
static | changeLBPrefix ($lb, $prefix) |
static | changePrefix ($prefix) |
Change the table prefix on all open DB connections/. | |
Private Attributes | |
$dropCurrentTables = true | |
$newTablePrefix = '' | |
$oldTablePrefix = '' | |
$tablesToClone = array() | |
$useTemporaryTables = true |
Helper class for making a copy of the database, mostly for unit testing.
Copyright © 2010 Chad Horohoe <[email protected]> http://www.mediawiki.org/
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html
Definition at line 26 of file CloneDatabase.php.
CloneDatabase::__construct | ( | DatabaseBase $ | db, |
array $ | tablesToClone, | ||
$ | newTablePrefix, | ||
$ | oldTablePrefix = '' , |
||
$ | dropCurrentTables = true |
||
) |
Constructor.
$db | DatabaseBase A database subclass |
$tablesToClone | Array An array of tables to clone, unprefixed |
$newTablePrefix | String Prefix to assign to the tables |
$oldTablePrefix | String Prefix on current tables, if not $wgDBprefix |
$dropCurrentTables | bool |
Definition at line 67 of file CloneDatabase.php.
References $dropCurrentTables, $newTablePrefix, $oldTablePrefix, and $tablesToClone.
static CloneDatabase::changeDBPrefix | ( | $ | db, |
$ | prefix | ||
) | [static] |
static CloneDatabase::changeLBPrefix | ( | $ | lb, |
$ | prefix | ||
) | [static] |
$lb | LoadBalancer |
$prefix |
Definition at line 146 of file CloneDatabase.php.
References $lb.
static CloneDatabase::changePrefix | ( | $ | prefix | ) | [static] |
Change the table prefix on all open DB connections/.
$prefix |
Definition at line 135 of file CloneDatabase.php.
References $wgDBprefix, and wfGetLBFactory().
Referenced by cloneTableStructure(), destroy(), and MediaWikiTestCase\initDB().
Clone the table structure.
Definition at line 88 of file CloneDatabase.php.
References changePrefix(), useTemporaryTables(), and wfDebug().
CloneDatabase::destroy | ( | $ | dropTables = false | ) |
Change the prefix back to the original.
$dropTables | bool Optionally drop the tables we created |
Definition at line 119 of file CloneDatabase.php.
References changePrefix().
CloneDatabase::useTemporaryTables | ( | $ | u = true | ) |
Set whether to use temporary tables or not.
$u | Bool Use temporary tables when cloning the structure |
Definition at line 81 of file CloneDatabase.php.
Referenced by cloneTableStructure().
CloneDatabase::$dropCurrentTables = true [private] |
Definition at line 50 of file CloneDatabase.php.
Referenced by __construct().
CloneDatabase::$newTablePrefix = '' [private] |
Definition at line 32 of file CloneDatabase.php.
Referenced by __construct().
CloneDatabase::$oldTablePrefix = '' [private] |
Definition at line 38 of file CloneDatabase.php.
Referenced by __construct().
CloneDatabase::$tablesToClone = array() [private] |
Definition at line 44 of file CloneDatabase.php.
Referenced by __construct().
CloneDatabase::$useTemporaryTables = true [private] |
Definition at line 56 of file CloneDatabase.php.