Needs review
Project:
UI Cache Clear
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2015 at 05:46 UTC
Updated:
26 Aug 2022 at 09:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hargobindThere might be other parts of this code that would benefit from a redirect, but this patch satisfied my needs.
Comment #3
hargobindLooking into this further, I found that the module doesn't integrate with the proper admin_menu module hooks. I have provided a new patch which uses the correct hooks from admin_menu.
Comment #4
hargobindI had a look at this code again, and I realized that the module is providing a "Clear this page cache" for users who don't have access to the "Flush all caches" permission provided by the admin_menu module. My previous patch in #3 removes that menu item which is a regression.
This attached patch leaves the code close to how it originally was, but it adds the URL query parameters for "destination=[current_page]" to provide the redirect, and "token=[drupal_get_token]" to prevent caches from being cleared more than once from the same URL. There's also a check to see if the Boost module exists before adding "Boost" to the menu title.
Comment #5
philsward commentedI haven't tried this with boost yet, but the initial patch works great on a non-boost environment. This has driven me nuts for years. Thx for providing a fix for it.
Update: Tested on a site with boost and things look great. The menu shows "Current Page" if Boost isn't enabled/installed and if it is, then the menu changes to "Current page & Boost".
Clicking the link in either situation does as expected and keeps you on the current page.
Looks great!! Love it!
Comment #6
philsward commentedAfter some additional testing, I seem to have run into a weird one where the URL to /admin/reports/status/run-cron produces an "access denied" error. I'm not sure it's related to this patch as I haven't had a chance to dig into it further, but I oddly, do have the same problem on multiple sites where this patch has been applied. Sites that do not have the patch, do not have this problem.
It appears to be an issue with the URL specifically but I originally noticed it from the Admin Menu "run cron" menu link.
I'll try to remember to report back if I find anything definitive, but in the meantime some extra eyes to confirm or refute what I'm seeing would be great.