From: Jure Kajzer Date: Fri, 3 Jun 2011 11:43:54 +0000 (+0000) Subject: * suggestion for using tables.sql parsing instead of database query for tables list... X-Git-Tag: 1.31.0-rc.0~29738 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=7b23ec9c87297209c5f6e5ba91f875f9d7426df1;p=lhc%2Fweb%2Fwiklou.git * suggestion for using tables.sql parsing instead of database query for tables list needed for phpunit * would be better option IMO since the database is not necesserally dedicated to MW install --- diff --git a/includes/db/Database.php b/includes/db/Database.php index b26970eb0d..85e3b13d50 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2445,7 +2445,12 @@ abstract class DatabaseBase implements DatabaseType { * @param $fname String: calling function name */ function listTables( $prefix = null, $fname = 'DatabaseBase::listTables' ) { - throw new MWException( 'DatabaseBase::listTables is not implemented in descendant class' ); + global $IP; + //throw new MWException( 'DatabaseBase::listTables is not implemented in descendant class' ); + $tables = file_get_contents( "$IP/maintenance/tables.sql" ); + preg_match_all('/create table \/\*_\*\/([a-z0-9_]*)/i', $tables, $matches, PREG_PATTERN_ORDER); + + return $matches[1]; } /**