PHP Fatal error: Class 'rcube_mdb2' not found in /usr/share/roundcubemail/plugins/pfadmin_autoresponder/pfadmin_autoresponder.php
which meant that the vacation plugin for RoundCube was not working. Rather quick I found that roundcube webmail was updated recently to 0.9.4 which caused the plugin to stop working, because in 0.9 there's a new interface for plugins. Found on google that some other people had the same issue and the recommendation was to use some other vacation plugin. The problem with this one was that the SQL schema it uses is different than the one I already have. Digging a bit into the code, found that this plugin hit the same issue with Class rcube_mdb2 and fixed it by checking if a certain class is present and using either rcube_mdb2 or rcube_db::factory which meant for me that I can change all occurrences in my plugin from new rcube_mdb2 to rcube_db::factory and make the old plugin work. Quickly did that and now the old plugin works. Below you can find the changes:
--- pfadmin_autoresponder.php.orig 2013-10-07 12:07:18.037672190 +0300
+++ pfadmin_autoresponder.php 2013-10-07 12:06:55.001055439 +0300
@@ -110,7 +110,7 @@
if (!$rcmail->config->get('db_persistent')) {
if ($dsn = $rcmail->config->get('db_dsnw')) {
- $rcmail->db = new rcube_mdb2($dsn, '', FALSE);
+ $rcmail->db = rcube_db::factory($dsn, '', FALSE);
}
}
@@ -221,7 +221,7 @@
$sql = $this->sql_select;
if ($dsn = $rcmail->config->get('db_pfadmin_autoresponder_dsn')) {
- $db = new rcube_mdb2($dsn, '', FALSE);
+ $db = rcube_db::factory($dsn, '', FALSE);
$db->set_debug((bool)$rcmail->config->get('sql_debug'));
$db->db_connect('r');
} else {
@@ -239,7 +239,7 @@
$ret = $db->fetch_assoc($res);
if (!$rcmail->config->get('db_persistent')) {
if ($dsn = $rcmail->config->get('db_dsnw')) {
- $rcmail->db = new rcube_mdb2($dsn, '', FALSE);
+ $rcmail->db = rcube_db::factory($dsn, '', FALSE);
}
}
return $ret;
@@ -250,7 +250,7 @@
$cfg = rcmail::get_instance()->config;
if ($dsn = $cfg->get('db_pfadmin_autoresponder_dsn')) {
- $db = new rcube_mdb2($dsn, '', FALSE);
+ $db = rcube_db::factory($dsn, '', FALSE);
$db->set_debug((bool)$cfg->get('sql_debug'));
$db->db_connect('w');
} else {