So I have some custom menu links that start with administration/xxxx. The term administration is relevant for my domain and my menu paths. However in admin_enable() and in one of the update hooks, the code does the following

$result = db_query("SELECT * FROM {menu_links} WHERE link_path LIKE 'admin%'");
while ($item = db_fetch_array($result)) {
    _menu_delete_item($item, TRUE);
}

So the few times i have disabled/enabled this module it killed all of my menus start with administration. I think what you mean to do is:

$result = db_query("SELECT * FROM {menu_links} WHERE link_path = 'admin' OR link_path LIKE 'admin/%'");

Can you tell me if this is what you really intended? I can submit a patch if so.

Comments

febbraro’s picture

Status: Active » Needs review
StatusFileSize
new880 bytes

Patch attached

febbraro’s picture

Bump. This is a real easy one, can someone please take a look and get this into the 6-1 branch?

irakli’s picture

+1 bump :)

raines37’s picture

Version: 6.x-1.0-beta3 » 6.x-2.0
StatusFileSize
new889 bytes

Still not updated in 2.0 release. Here's an updated patch....

_vid’s picture

It turns out this also menu items pointing to admin pages created with the Bookmarks module. Which is pretty upsetting...

I'll take a look at the patch. Perhaps it could be updated to only delete rows that meet the link_path = 'admin' OR link_path LIKE 'admin/%' but also check to see if the menu_name = 'navigation'.

Otherwise it would need to specifically accommodate modules like bookmarks by including code to check that the menu_name is not like 'bookmarks-%'.

Not having delved into this much, I'm assuming the goal is to eliminate the extra 'navigation' menu items.

trunks’s picture

Why removing all menu entries which start with 'admin/'? It's actually an ilogical behaviour. If I define some administration views in this path, enabling this module will remove all the menu entries without any advice to the user. In fact, what's the reason because this module removes all the menu entries below /admin/ ?

_vid’s picture

Goal: improve admin link target deletes, specifically in navigation menu items

I had a chance to look at the patch today and I did want to add one more qualifier: AND menu_name = 'navigation'. As far as I can tell the intent of this module is only to affect the navigation menu.
To do that I also added (paren's) around the 'admin', 'admin/%' code used in the earlier patch.

So the new line reads:
$result = db_query("SELECT * FROM {menu_links} WHERE (link_path = 'admin' OR link_path LIKE 'admin/%') AND menu_name = 'navigation'");

I'm going to deploy a fresh site and then install the patched 6.x-2.0 version and then again with a patched 6.x-2.x-dev version.

@skwashd,
@yhahn,
@jmiccolis,
@technicolorenvy,
@mfer, would one of you review this patch as well and with your nod of approval include it in the next release?

_vid’s picture

Status: Needs review » Reviewed & tested by the community

The patched module worked great on a clean install with several bookmarks that pointed to admin/ pages.

Here were my reproducible steps:

  1. Create a fresh Drupal 6.22 site.
  2. Install and activate the bookmarks module.
  3. Add 3 bookmarks to admin pages:
    • Blocks: admin/build/block
    • Modules: admin/build/modules
    • Run Cron: admin/reports/status/run-cron
  4. Install and activate the admin module
  5. Check that bookmarks were not deleted
  6. Run cron
  7. Check that bookmarks were not deleted
  8. Clear cache
  9. Check that bookmarks were not deleted

Success.
I even repeated this twice to be sure.
If there are any other test scenarios that someone would like me to run I can try and get to that this week.

I'm going to repeat these steps with the patched dev version next.

sickness29’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (outdated)

Development or support is not planned for D6. All D6-related issues are marked as outdated in a bunch.

Everyone can apply the patch above (not tested by the maintainers, tested by the community) to their D6 projects.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.