Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
shortcut.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 May 2014 at 11:29 UTC
Updated:
22 Sep 2014 at 08:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
kpv commentedComment #2
kpv commentedComment #3
mr.baileysI set out to automatically remove shortcut links to routes belonging to modules that are being uninstalled, but I don't know how to get a list of routes registered by any given module.
To advance this issue, here's a test that shows this bug. (setting to NR to run this test through the testbot, expecting a fail.)
Setting to major since uninstalling a module can break your entire site, and requires manually removing the shortcut link from the database to recover.
Comment #5
kpv commented#3 mr.baileys
I see two ways to solve the issue:
Imo, 2nd option is a better one.
Comment #6
kpv commentedComment #7
mr.baileys@kpv: thanks for the pointers!
Attached is a patch that should fix the original scope of this issue (uninstalling a module with routes for which one or more shortcut links exist no longer cause the site to break). However, this does not solve the full issue: routes can be added dynamically (for example through Views), and shortcut links pointing to those might still trigger an exception when the routes disappear (which is also why the router/shortcut-table solution outlined in #5.2 might not be the best approach).
For dynamic routes, I think we have no other option than to add a check to shorcut to ensure all links to be rendered point to a route that exists.
Setting to CNR to show that the patch fixes the "shortcut-breaks-on-module-uninstall"-issue, but this issue remains NW for the dynamic routes.
Comment #8
dawehnerMh, this really just works for static routes, not defined dynamically. An alternative implementation could be to fetch all the route names which are available and check with those
Comment #9
dawehnerSo .
Comment #10
tim.plunkettThis is absolutely a duplicate of an old issue, but I can't find it :(
Comment #11
dawehnerYeah I also remember that other one, but I thought it was already marked as fixed ...
Comment #12
kpv commented@tim.plunkett, @dawehner
#2277753: Shortcuts should handle missing routes elegantly seems to be the duplicate and #2200185: Router table is not cleared when modules are uninstalled deals with a similar issue.
Comment #13
gendoas commentedIn function shortcut_renderable_links() you may ensure that only available routes are listed. This does not remove items from disabled modules in database, but prevents errors.
Comment #16
dawehner#2277753: Shortcuts should handle missing routes elegantly seems to have more momentum.