1) In hook_cron delete pids that no longer exist in the url_alias table
2) in hook_uninstall drop the tables
3) modify the "delete pathauto aliases" query so that it only does this for
4) in hook cron divine information about aliases that are not currently in url_alias_extra (e.g. entity_type and entity_id) and assume that they were admin created

Anything else?

Comments

greggles’s picture

Status: Active » Needs review
StatusFileSize
new3.17 KB

Here is a patch that does items 1-3.

Item 4 still needs help but that is lower priority to me.

greggles’s picture

Status: Needs review » Needs work

We actually should do #4 and it should be in an _update or _install function instead of _cron. This way we add entries in url_alias_extra for all node/user/taxonomy aliases and mark them as being from Pathauto. If that's not the case, admins can manually remove them. But at least we have a baseline and then http://drupal.org/node/201659 will work properly.

wim leers’s picture

If I understand #4 correctly, this is what it should do:

  1. get everything from the url_alias table that's not yet in the url_alias_extra table, but only if it's one of the entities pathauto supports by default (node/taxonomy/user)
  2. insert corresponding entries for these into url_alias_extra and mark them as admin created

Please clarify if necessary.

greggles’s picture

Mostly right - the only point where I disagree is debatable. We want the assumption (between "admin" and "pathauto") to be that most common case. I believe that in most cases the majority of aliases on a site are created by Pathauto. So, I think we should mark them all as pathauto created.

I created a discussion point for it http://groups.drupal.org/node/7753 - and got basically no response. NikLP and I discussed it in IRC and he agreed (though his response isn't 100% accurate). I've updated the group with a poll - http://groups.drupal.org/node/8329 - maybe that will get more responses.

Fortunately, that part is easy to change. The hard part (in my opinion) will be queries that work across databases that will parse apart the src to get the object type and object ID. Also, we need to modify the url_alias_extra table to include an extra column for things like "user" "1" "track" or whatever.

wim leers’s picture

I actually agree with you on that :) What I said there, I extracted from your initial post:

and assume that they were admin created

However, your last paragraph got me confused. What do you mean by "across databases"? You mean across tables? And URL aliases for user/uid/track aren't generated automatically. They are for user/uid, which we should be able to use wildcard queries for (node/%) and then only keep the valid ones. This same system can be applied for node/nid and taxonomy/term/tid.

Am I oversimplifying things?

greggles’s picture

"across databases" i.e. on both mysql and pgsql.

And I think we actually do need to care about 'user/%/track' since we have the tracker_pathauto integration.

wim leers’s picture

Oh. Sigh. I'll try to stick with MySQL, then.

And I didn't know about the tracker_pathauto feature. That will indeed require an extra column.

greggles’s picture

Assigned: greggles » Unassigned
greggles’s picture

Status: Needs work » Postponed
Freso’s picture

Since there is no "url_alias_extra" at the moment, shouldn't this one be closed or "by-design"'ed or "won't-fix"'ed or something? If a new "url_alias_extra" sees the light of day, we can either make sure it's maintained properly from the start... or make a new issue.

greggles’s picture

Status: Postponed » Closed (fixed)

Seems reasonable to me.