After installing MD Slider 2.17 when flushing caches results in a critical error:
DatabaseSchemaObjectExistsException: Table variable already exists. in DatabaseSchema->createTable() (line 657 of includes/database/schema.inc).
This blocks not only flushing caches but as well all actions triggering it, e. g.
-
install/enable/disable/uninstall modules or themes
-
updating modules, themes or Drupal Core
-
...
Debugging has shown that it is caused by the red bold line of the following code in md_slider.module:
/**
* implements hook_features_api()
*/
function md_slider_features_api() {
return array(
"md_slider" => array(
"name" => "MD Slider",
"feature_source" => TRUE,
"file" => drupal_get_path("module", "md_slider") . "/includes/md_slider.features.inc",
"default_hook" => "install"
),
);
}
According to http://www.drupalcontrib.org/api/drupal/contributions!features!features.api.php/function/hook_features_api/7 the default hook value defines
defaults hook for your component that is calledwhen the cache of default components is generated. Examples includehook_views_default_views() or hook_context_default_contexts().
Features invokes this hook after caches have been flushed to initialize defaults into cache again, not only on the module declaring the hook as default but on all modules implementing it. hook_install()
performs setup tasks when the module is installed. [...] The hook will only be called the first time a module is enabled or after itis re-enabled after being uninstalled.
(https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_install/7)
Thus declaring install as default hook is very inapprorpiate and causes features to execute not only all module's install hook implementations, but as well in executing system_install() which is the Drupal Core installation routine. This detects that Drupal is already installed and causes the error mentioned at the begin of my post.
Intermediate bugfix
To fix this bug in existing sites until Megadrupal provides an official bugfix release is to uncomment or remove the line
"default_hook" => "install"
from md_slider_features_api() in md_slider.module.
Hi,
Thank you very much for your concern in our MD Slider
We will fix this soon
Many people are experiancing this problem for over 2 years now:
https://www.drupal.org/node/2416907
Please fix the one line of code.
Hi,
We will fix this issue in next version 7.x-2.24