#608870 by c960657: Fixed notice in simpletest_clean_database().

merge-requests/26/head
Angie Byron 2009-10-24 23:12:11 +00:00
parent 09f2d3266b
commit 47328efca6
1 changed files with 4 additions and 2 deletions

View File

@ -418,16 +418,18 @@ function simpletest_clean_environment() {
function simpletest_clean_database() {
$tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%');
$schema = drupal_get_schema_unprocessed('simpletest');
$count = 0;
foreach (array_diff_key($tables, $schema) as $table) {
// Strip the prefix and skip tables without digits following "simpletest",
// e.g. {simpletest_test_id}.
if (preg_match('/simpletest\d+.*/', $table, $matches)) {
db_drop_table($matches[0]);
$count++;
}
}
if (count($ret) > 0) {
drupal_set_message(format_plural(count($ret), 'Removed 1 leftover table.', 'Removed @count leftover tables.'));
if ($count > 0) {
drupal_set_message(format_plural($count, 'Removed 1 leftover table.', 'Removed @count leftover tables.'));
}
else {
drupal_set_message(t('No leftover tables to remove.'));