I'm using the cache clearing function from the Admin Menu. After clearing the cache, I am redirected to the homepage of the site. It would be a lot more helpful if I was taken back to the same page I was on. Patch coming...

Comments

hargobind created an issue. See original summary.

hargobind’s picture

Category: Bug report » Feature request
Status: Active » Needs review
StatusFileSize
new420 bytes

There might be other parts of this code that would benefit from a redirect, but this patch satisfied my needs.

hargobind’s picture

Title: Redirect to same page after cache clear » Better integration with admin_menu
StatusFileSize
new1.62 KB

Looking 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.

hargobind’s picture

Title: Better integration with admin_menu » Redirect to same page after cache clear
Category: Feature request » Bug report
StatusFileSize
new1017 bytes

I 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.

philsward’s picture

I 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!

philsward’s picture

After 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.