I would like to be able to clean up orphaned paths that don't lead to any node/user/view/etc..

Comments

mightyiam’s picture

I've been told that http://drupal.org/node/128366 is a similar issue.

greggles’s picture

Status: Active » Closed (duplicate)

Yes, the eventual goal of that one is the same.

greggles’s picture

Status: Closed (duplicate) » Active

So, in that other issue I was planning on doing it in a way that turned out to be overly difficult. But, there is a php way that I can do this. (so I don´t forget later, here are the notes...)

The basic system is to check a certain group (limited by range, or some other way) and do a drupal_get_path_alias on them and if they come back negative then delete the alias...I will need to figure out how to break it apart, of course, and also how many I can do at a time.

greggles’s picture

Assigned: Unassigned » greggles

I think this would be a nice thing to do so I'm assigning it to myself for 5.x-2.1.

If someone needs it sooner than I get to it, feel free to provide your own patch.

mightyiam’s picture

greggles++

greggles’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
Priority: Minor » Normal

Turns out that this might not work for 5.x. Currently pathauto determines if something is an existing path using this little test:

  static $menu = NULL;
  if (is_null($menu)) {
    $menu = menu_get_menu();
  }
  
  // Determine the menu item containing the callback.
  return isset($menu["callbacks"][$path]);

That's not really all that reliable, but it covers the major things. Because it's not reliable, it obviously is not suitable for this purpose.

In Drupal6 we menu_valid_path to check this for us. So, I'm afraid this might have to be a 6.x only feature unless there is some other way to figure this out...

Also, I realized that this should probably either be easy to undo OR should not do anything on its own. e.g. it should present a list of items ready for deletion and require manual intervention to actually delete them OR it should copy them to a backup table and only then delete them OR a combination of the two. But deleting things on cron without admin intervention feels mighty dangerous.

dave reid’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: greggles » Unassigned
Status: Active » Postponed

I don't think this feature would be appropriate for Pathauto. It's a lot harder challenge to figure out if/how paths are no longer valid. Marking as postponed unless the other maintainers agree this should be a won't fix. Hopefully greggles isn't insulted if I unassign him from this issue.

greggles’s picture

It takes more than that to insult me ;) I totally agree with you on this.

dave reid’s picture

Status: Postponed » Closed (won't fix)