Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Installation fails on Drupal 8.0.0-beta6, using the latest xmlsitemap code from the 8.x-1.x branch. To reproduce the issue using drush, start with a newly-downloaded drupal-8.0.0-beta6.
drush si standard
drush en xmlsitemap
After attempting to enable xmlsitemap, I saw the following output.
Error: Class Drupal\xmlsitemap\Form\XmlSitemapSettingsForm contains 1 abstract method and must therefore be declared abstract or
implement the remaining methods (Drupal\Core\Form\ConfigFormBase::getEditableConfigNames) in
/home/vagrant/docroot/modules/contrib/xmlsitemap/src/Form/XmlSitemapSettingsForm.php, line 262
With config_translation enabled, attempting to enable xmlsitemap, I saw the following output.
$ drush en xmlsitemap
The following extensions will be enabled: xmlsitemap
Do you really want to continue? (y/n): y
exception 'InvalidArgumentException' with message 'Link templates accepts paths, which have to start with a leading slash.' in[error]
/home/vagrant/docroot/core/lib/Drupal/Core/Entity/EntityType.php:551
Stack trace:
#0 /home/vagrant/docroot/core/modules/config_translation/config_translation.module(95):
Drupal\Core\Entity\EntityType->setLinkTemplate('config-translat...', 'xmlsitemap.admi...')
#1 /home/vagrant/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(494): config_translation_entity_type_alter(Array,
NULL, NULL)
#2 /home/vagrant/docroot/core/lib/Drupal/Core/Entity/EntityManager.php(240):
Drupal\Core\Extension\ModuleHandler->alter('entity_type', Array)
#3 /home/vagrant/docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(151):
Drupal\Core\Entity\EntityManager->findDefinitions()
#4 /home/vagrant/docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php(240):
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#5 /usr/share/php/drush/commands/core/drupal/environment.inc(130): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#6 /usr/share/php/drush/commands/core/drupal/environment.inc(197): drush_module_install(Array)
#7 /usr/share/php/drush/commands/pm/pm.drush.inc(1120): drush_module_enable(Array)
#8 [internal function]: drush_pm_enable('xmlsitemap')
#9 /usr/share/php/drush/includes/command.inc(359): call_user_func_array('drush_pm_enable', Array)
#10 /usr/share/php/drush/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#11 [internal function]: drush_command('xmlsitemap')
#12 /usr/share/php/drush/includes/command.inc(178): call_user_func_array('drush_command', Array)
#13 /usr/share/php/drush/lib/Drush/Boot/DrupalBoot.php(46): drush_dispatch(Array)
#14 /usr/share/php/drush/drush.php(76): Drush\Boot\DrupalBoot->bootstrap_and_dispatch()
#15 /usr/share/php/drush/drush.php(16): drush_main()
#16 {main}
Comment | File | Size | Author |
---|---|---|---|
#21 | xmlsitemap-fix-install-uninstall-2427509-21.patch | 11.8 KB | Michelle |
#15 | interdiff12-15.txt | 729 bytes | andrei.dincu |
#15 | xmlsitemap-fix-install-uninstall-2427509-15.patch | 11.74 KB | andrei.dincu |
#12 | xmlsitemap-fix-install-uninstall-2427509-12.patch | 11.07 KB | Michelle |
#11 | xmlsitemap-fix-uninstall-2427509-11.patch | 1.08 KB | Michelle |
Comments
Comment #1
paulmckibbenI found part of the problem. This change record requires link annotations to be updated:
https://www.drupal.org/node/2382937
However, after updating the link annotations in src/Entity/XmlSitemap.php as follows, I get a new error upon installation.
Updated code:
New error when attempting to install:
Error: Call to a member function getPath() on a non-object in
/home/vagrant/docroot/core/modules/config_translation/src/ConfigNamesMapper.php, line 238
Comment #2
paulmckibbenOn further debugging, I see that ConfigNamesMapper->getBaseRoute() returns null (ConfigNamesMapper.php line 196). It is trying to get a route for "entity.xmlsitemap.edit_form". There is no such route in xmlsitemap.routing.yml.
Comment #3
paulmckibbenIt looks like this change record also applies: https://www.drupal.org/node/2306387 - "Entity HTML route patterns standardized"
I think this means the entity-specific route names in xmlsitemap.routing.yml need to be updated to correspond to the standard.
Comment #4
paulmckibbenOriginal issue was an installation failure when config_translation is enabled. However, this module fails to install at all, even without config_translation.
Comment #5
paulmckibbenPlease review the attached patch.
A total of 3 change records affected xmlsitemap, and this patch addresses all 3.
https://www.drupal.org/node/2382937 - the patch updates link annotations accordingly.
https://www.drupal.org/node/2306387 - the patch updates entity route names accordingly.
https://www.drupal.org/node/2407153 - the patch updates implementations of ConfigFormBase to implement the new method, Drupal\Core\Form\ConfigFormBaseTrait::getEditableConfigNames().
Comment #6
paulmckibbenNew patch attached. Some of the routes needed to be updated elsewhere in order for the admin screens to work.
Comment #7
penyaskitoConfig forms need to get editable configs from the factory, see change record at https://www.drupal.org/node/2407153.
Thanks for working on this, Paul!
Comment #8
paulmckibbenpenyaskito, thanks for the review!
Here's a new patch and new interdiff. I believe I have found and updated all places that need to use the factory to get editable configs. If there are any I missed, please let me know the file and line number.
I also fixed a bug that was attempting to compare a URL object to a string. XmlSitemapGenerator.php, line 244, now uses the toString() method on the URL object so a valid comparison is possible on line 249.
Comment #9
lauriiiThe latest patch didnt fix installing
Comment #10
MichelleThe patch in #8 applies cleanly against the git checkout of the 8.x-1.x branch. I was able to enable the module with no errors on Drupal 8 Beta 7. /admin/config/search/xmlsitemap comes up with no errors as do all the tabs on it.
Comment #11
MichelleI ran into errors with uninstalling the module and found the lines that needed fixing and created a patch. However, when I tried to test it without your patch already being there, I ran into more errors on uninstall that you had already fixed. I'm thinking that my patch should be added to your patch to fix both install and uninstall. I wanted to put it up separately, first, though, so you can look at my changes. If you agree, I can merge these into one patch.
This is the relevant change record I went by, which I see you mentioned in #5. Wish I'd read all the comments on this issue. Would have saved me time. LOL! https://www.drupal.org/node/2407153
Comment #12
MichelleI just realized I might as well combine them and send them for testing right away so it's ready to go if you have no objections. :) Here is our combined patch.
Comment #14
MichelleI'm looking at the test results and the error is reporting is on this line in XmlSiteMapTestBase.php:
$this->error($this->l($message, $message_url)), 'User notice');
So is it our patch is failing the tests or the tests are failing our patch? :)
Comment #15
andrei.dincu CreditAttribution: andrei.dincu commentedNew patch.
Interdiff between patch from comment 12 and this one.
Comment #16
andrei.dincu CreditAttribution: andrei.dincu commentedComment #17
MichelleI tested #15 and it applies cleanly and works for install and uninstall. Don't know what's up with the testbot but I think this is ready to go so marking as such.
Comment #18
neclimdulWhy don't we request the config once outside the loop. Or at least the factory once.
Comment #19
MichelleI don't know... I was just changing the existing code to get past the bug. I don't see any reason why not. I'll roll a new patch with that change later today if no one beats me to it.
Comment #20
neclimdulSorry, I wasn't questioning your choice it was more rhetorical. I should have said "lets only request..." Thanks!
Comment #21
MichelleIt installs... It uninstalls... It leaps tall buildings in a single bound...
Ok, maybe not that last part. But it does the first 2 with no errors. :)
And it addresses the rhetorical question. ;)
Michelle
Comment #22
neclimdulI was waiting for testbot to come back but realized that isn't going to happen. Looks good to me.
Comment #23
paulmckibbenThe patch at #21 works for me as well. Thanks @Michelle for picking this up. And thanks @neclimdul for your review as well.
Comment #24
andrei.dincu CreditAttribution: andrei.dincu commentedComment #25
DamienMcKenna@andrei.dincu: Please don't mark issues "fixed" until the patch is actually committed.
Comment #27
paulmckibbenThanks everybody! This patch has been committed to the 8.x-1.x branch.