Fix bug where listing tables in PostgreSQL database with db_prefix didn't work (#7093)

bnet/additions
Aleksander Machniak 5 years ago
parent bd7c38be0b
commit 906b223d30

@ -25,6 +25,7 @@ CHANGELOG Roundcube Webmail
- Fix so displayed maximum attachment size depends also on 'max_message_size' (#7105)
- Fix bug where 'skins_allowed' option didn't enforce user skin preference (#7080)
- Fix so contact's organization field accepts up to 128 characters (it was 50)
- Fix bug where listing tables in PostgreSQL database with db_prefix didn't work (#7093)
RELEASE 1.4.1
-------------

@ -191,9 +191,8 @@ class rcube_db_pgsql extends rcube_db
{
// get tables if not cached
if ($this->tables === null) {
if ($schema = $this->options['table_prefix']) {
$schema = str_replace('.', '', $schema);
$add = " AND TABLE_SCHEMA = " . $this->quote($schema);
if (($schema = $this->options['table_prefix']) && $schema[strlen($schema)-1] === '.') {
$add = " AND TABLE_SCHEMA = " . $this->quote(substr($schema, 0, -1));
}
else {
$add = " AND TABLE_SCHEMA NOT IN ('pg_catalog', 'information_schema')";
@ -220,9 +219,9 @@ class rcube_db_pgsql extends rcube_db
{
$args = array($table);
if ($schema = $this->options['table_prefix']) {
if (($schema = $this->options['table_prefix']) && $schema[strlen($schema)-1] === '.') {
$add = " AND TABLE_SCHEMA = ?";
$args[] = str_replace('.', '', $schema);
$args[] = substr($schema, 0, -1);
}
else {
$add = " AND TABLE_SCHEMA NOT IN ('pg_catalog', 'information_schema')";

Loading…
Cancel
Save