Fatal error: Flushing caches causes MD Slider to trigger site install

trinitec's picture
trinitec
Fri, 04/10/2015 - 10:30
#1
Fatal error: Flushing caches causes MD Slider to trigger site install

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.

cindy's picture
cindy
Mon, 04/13/2015 - 22:53

Hi,

Thank you very much for your concern in our MD Slider

We will fix this soon

botris's picture
botris
Tue, 01/24/2017 - 05:40

Many people are experiancing this problem for over 2 years now:

https://www.drupal.org/node/2416907

Please fix the one line of code.

cindy's picture
cindy
Tue, 11/07/2017 - 04:53

Hi,

We will fix this issue in next version 7.x-2.24

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.