From 7b23ec9c87297209c5f6e5ba91f875f9d7426df1 Mon Sep 17 00:00:00 2001 From: Jure Kajzer Date: Fri, 3 Jun 2011 11:43:54 +0000 Subject: [PATCH] * 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 --- includes/db/Database.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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]; } /** -- 2.20.1