Title says it all... only user/n where n is an integer, should be deleted. Am using 6.x-1.5 but code looks identical in latest 6.x dev and 7.x branches.

// Problem arises in the case $internal_name and $key = 'user/', in functions pathauto_admin_delete()
// and pathauto_admin_delete_submit().
$count = db_query("SELECT count(1) FROM {url_alias} WHERE source LIKE :src", array(':src' => "$internal_name%"))->fetchField();
condition('source', db_like($key) . '%', 'LIKE')


Issue summary:View changes


Category:support» bug

Have any ideas on how this should be handled properly?

Well the current code is very concise - wld be a shame to over-complicate it.

Is it possible to use REGEXP pattern matching instead of LIKE in the query condition?

Alternatively we could explicitly rule out those 3 specific paths... messy but not too hard. I wonder - are there other aliases where the source/src should be excluded from the bulk delete? e.g. node/add/* ??? Unless we can use REGEXP not quite sure how best to handle all this cleanly.

OK a quick look in the MySQL manual suggest the best bet in these cases might be to strip off the node/ or user/ part using SUBSTR function then check if what we have left is an integer. Not sure how to do the latter within a query...... Also would need smarter code to cope with blog/n/feed syntax etc.

Likely this just needs to turn into a bulk operation which deletes records by grabbing all the possible UID columns from the {users} table. Same for nodes, etc.

Yes much more intelligent than my half-baked suggestions!!

Version:6.x-1.6» 7.x-1.x-dev
Assigned:Unassigned» Dave Reid
Priority:Normal» Major

Issue summary:View changes

7.x also.