We switched from 7.x-2.3 to 7.x-2.x to take advantage of some patches. Everything worked fine on my local install but when we deployed it to our dev server running Aegir, the install fails with the error below.
Seems like some change in xmlsitemap.drush.inc triggered it. Possibly one of these commits:
- http://cgit.drupalcode.org/xmlsitemap/commit/?id=171018fbb2e4befcb54ac5b...
- http://cgit.drupalcode.org/xmlsitemap/commit/?id=3c50867682598e850109dad...
ERROR
exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wd152devtestingw.semaphore' doesn't exist' in /var/aegir/platforms/NAMEREMOVED/includes/database/database.inc:2227
Stack trace: #0 /var/aegir/platforms/NAMEREMOVED/includes/database/database.inc(2227): PDOStatement->execute(Array)
#1 /var/aegir/platforms/NAMEREMOVED/includes/database/database.inc(697): DatabaseStatementBase->execute(Array, Array)
#2 /var/aegir/platforms/NAMEREMOVED/includes/database/database.inc(2406): DatabaseConnection->query('SELECT expire, ...', Array, Array)
#3 /var/aegir/platforms/NAMEREMOVED/includes/lock.inc(167): db_query('SELECT expire, ...', Array)
#4 /var/aegir/platforms/NAMEREMOVED/includes/lock.inc(146): lock_may_be_available('variable_init')
#5 /var/aegir/platforms/NAMEREMOVED/includes/bootstrap.inc(1181): lock_acquire('variable_init', 1)
#6 /var/aegir/platforms/NAMEREMOVED/includes/bootstrap.inc(2759): variable_initialize(Array)
#7 /var/aegir/platforms/NAMEREMOVED/includes/bootstrap.inc(2520): _drupal_bootstrap_variables()
#8 /var/aegir/platforms/NAMEREMOVED/includes/bootstrap.inc(2654): drupal_bootstrap(3, false)
#9 /var/aegir/platforms/NAMEREMOVED/includes/bootstrap.inc(2512): _drupal_bootstrap_page_cache()
#10 /var/aegir/platforms/NAMEREMOVED/sites/all/modules/contrib/xmlsitemap/xmlsitemap.drush.inc(14): drupal_bootstrap(3)
#11 phar:///usr/local/bin/drush-8.1.15.phar/includes/command.inc(1094): xmlsitemap_drush_command()
#12 phar:///usr/local/bin/drush-8.1.15.phar/commands/core/topic.drush.inc(38): drush_get_commands()
#13 [internal function]: topic_drush_help_alter(Array)
#14 phar:///usr/local/bin/drush-8.1.15.phar/includes/command.inc(1500): call_user_func_array('topic_drush_hel...', Array)
#15 phar:///usr/local/bin/drush-8.1.15.phar/includes/drush.inc(336): drush_command_invoke_all_ref('drush_help_alte...', Array)
#16 phar:///usr/local/bin/drush-8.1.15.phar/includes/backend.inc(866): drush_get_global_options(false)
#17 phar:///usr/local/bin/drush-8.1.15.phar/includes/backend.inc(746): _drush_backend_get_global_contexts(Array)
#18 phar:///usr/local/bin/drush-8.1.15.phar/includes/command.inc(135): drush_backend_invoke_concurrent(Array, Array, Array)
#19 /var/aegir/.drush/provision/provision.inc(431): drush_invoke_process('@wd152.dev-test...', 'provision-insta...', Array, Array, Array)
#20 /var/aegir/.drush/provision/platform/install.provision.inc(99): provision_backend_invoke('@wd152.dev-test...', 'provision-insta...', Array, Array)
#21 [internal function]: drush_provision_drupal_provision_install()
#22 phar:///usr/local/bin/drush-8.1.15.phar/includes/command.inc(422): call_user_func_array('drush_provision...', Array)
#23 phar:///usr/local/bin/drush-8.1.15.phar/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#24 [internal function]: drush_command()
#25 phar:///usr/local/bin/drush-8.1.15.phar/includes/command.inc(199): call_user_func_array('drush_command', Array)
#26 phar:///usr/local/bin/drush-8.1.15.phar/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#27 phar:///usr/local/bin/drush-8.1.15.phar/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#28 phar:///usr/local/bin/drush-8.1.15.phar/includes/startup.inc(458): drush_main()
#29 phar:///usr/local/bin/drush-8.1.15.phar/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
#30 phar:///usr/local/bin/drush-8.1.15.phar/drush(114): drush_startup(Array)
#31 /usr/local/bin/drush-8.1.15.phar(10): require('phar:///usr/loc...') #32 {main}
Comment | File | Size | Author |
---|---|---|---|
#6 | updated_xmlsitemap-2939318-6.patch | 2.16 KB | pifagor |
|
Comments
Comment #2
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedCorrect. This was caused by the patch in #2329991: XML sitemap needs to bootstrap to DRUPAL_BOOTSTRAP_CONFIGURATION before using variable_get in hook_drush_command(). XML Sitemap's Drush hook is being executed apparently before Drupal is installed enough to have a
DRUPAL_BOOTSTRAP_VARIABLES
bootstrap level.Is there a way to check if the hook is being called without a full installation?
Comment #3
dagomar CreditAttribution: dagomar commentedI can confirm this issue. For us the issue even arises if we have the xmlsitemap module anywhere in our platform; installing the minimal or standard profiles in aegir still will fail because of this. I believe this might be because when drush runs it runs all hook_drush_command implementations from all modules present in the code base, not just those in the chosen installation profile.
I came up with a solution that works for us. I looked around to see if there are other modules which try to get a variable through variable_get in hook_drush_command, and found that the features module has something in place for this. I adapted their solution to xmlsitemap. Basically in the features module a check is done to see if a constant is defined in its .module file, and if so, it uses variable get, otherwise it hard codes the variable.
Note that I had to add the constant to the module file as none existed previously.
I believe this works because when drupal is bootstrapped, any constants coming from .module files will be available. In any case, this works for us, and I checked, the variable is indeed displaying the set batch limit in case you change it.
I have attached a patch.
Comment #4
dagomar CreditAttribution: dagomar commentedComment #5
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedThat looks good to me, but I haven't tested it yet.
Comment #6
pifagorThis is not a fully implemented patch. Here is an extended patch
Comment #7
jacob.embree CreditAttribution: jacob.embree at St. Louis Integration commentedComment #8
pifagorComment #10
pifagorComment #12
Fabianx CreditAttribution: Fabianx at Tag1 Consulting commented@pifagor:
You unfortunately missed this part in your re-worked patch.
As it is now this patch again breaks custom variable.inc implementations:
The variable_get() must only be called from hook_drush_command() when the constant is defined.
See #3
Comment #13
pifagorHello @Fabianx
I see See #3, and I see point
The constant should be available globally, so the code:
should not be