Fix bug where the Installer would not warn about required schema upgrade (#7042)

This commit is contained in:
Aleksander Machniak
2019-11-16 09:23:32 +01:00
parent 47f72303ac
commit ea3ad31ce0
3 changed files with 43 additions and 9 deletions

View File

@@ -112,13 +112,7 @@ class rcmail_utils
// Read DB schema version from database (if 'system' table exists)
if (in_array($db->table_name('system'), (array)$db->list_tables())) {
$db->query("SELECT `value`"
. " FROM " . $db->table_name('system', true)
. " WHERE `name` = ?",
$package . '-version');
$row = $db->fetch_array();
$version = preg_replace('/[^0-9]/', '', $row[0]);
$version = self::db_version($package);
}
// DB version not found, but release version is specified
@@ -253,6 +247,28 @@ class rcmail_utils
return $db->is_error();
}
/**
* Get version string for the specified package
*
* @param string $package Package name
*
* @return string Version string
*/
public static function db_version($package = 'roundcube')
{
$db = self::db();
$db->query("SELECT `value`"
. " FROM " . $db->table_name('system', true)
. " WHERE `name` = ?",
$package . '-version');
$row = $db->fetch_array();
$version = preg_replace('/[^0-9]/', '', $row[0]);
return $version;
}
/**
* Removes all deleted records older than X days
*