I would like to be able to remove all the /feed aliases. simply revert back to before when I had pathauto installed.

There is no easy way to bulk remove aliases.

CommentFileSizeAuthor
#2 pathauto_remove_all.txt1.57 KBAstralP

Comments

AstralP’s picture

You can just delete all fields from the url_alias table in your database using phpadmin (or whatever yu use to view the db). Not a pathauto solution but thought I would mention it as it is easy to do.

Also bear in mind that path is the module that deals with aliases so such a function would also wipe out all aliases which had been built by other means. If you just want to stop using aliases you could disable path and pathauto.

A very simple function which would delete all aliases would be something like this (untested):

<?php>
function delete_all_alias(){
  $query="DELETE FROM url_alias";
  mysql_query($query);
}
?>

You could also use TRUNCATE instead of delete which would reset the autonumbering. I would find such an addition useful especially considering the problems with v5 and losing categories at the moment.

AstralP’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB

I have created a patch which adds this feature to the general section. It was against v5 but will probably work for 4.7 unless there was some change in the way variables were stored.

If anyone has an opinion on whether to use TRUNCATE instead of DELETE I'd like to hear it, I don't know if losing the autonumbering would have any adverse effects.

greggles’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Needs review » Needs work

Hi - first, features go against 5.x so I changed the version.
Second, this seems like something that should be implemented in the core path module and not as part of pathauto. It's not really related to pathauto specifically and other systems (like urlify) could benefit from having this in core.

Thanks AstralP for providing the code for this feature. If you agree with my ideas, perhaps you'd consider modifying it to work with the core path.module

For a code review:
Your query needs to use {} in order to work on sites that use prefixes.
If we do implement this, think a confirm would be appropriate since this is a serious thing it shouldn't just happen without a confirmation.
The function pathauto_remove_all_aliases should get a comment above it
The t() on the description should use "" instead of using ' and then escaping the ' in don\'t (I've heard this can make extractor.php happier)

greggles’s picture

Status: Needs work » Closed (won't fix)

I'm marking this won't fix.

If someone wants to revive it and move it into core then great, but it's a "won't fix" in pathauto.

greggles’s picture

Status: Closed (won't fix) » Fixed

I changed my mind and implemented this as a menu local task in the url alias screen.

I realized that for automated testing of pathauto this is an important feature. Thanks AstralP for providing the basic code to get this done.

killes@www.drop.org’s picture

Status: Fixed » Closed (fixed)