Closed (outdated)
Project:
Pathauto
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
2 Dec 2011 at 14:02 UTC
Updated:
7 Feb 2026 at 10:08 UTC
Jump to comment: Most recent
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();
...
db_delete('url_alias')
->condition('source', db_like($key) . '%', 'LIKE')
->execute();
Comments
Comment #0.0
gpk commentedamplify.
Comment #1
dave reidHave any ideas on how this should be handled properly?
Comment #2
gpk commentedWell 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.
Comment #3
dave reidLikely 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.
Comment #4
gpk commentedYes much more intelligent than my half-baked suggestions!!
Comment #5
dave reidComment #5.0
dave reid7.x also.
Comment #6
mably commented