I wrote some lines for drush support in path_redirect. Enjoy.

drush pathredirect-add src dst

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

okokokok’s picture

FileSize
270 bytes
David Hernández’s picture

Assigned: okokokok » Unassigned
FileSize
1.78 KB

Hi!

I've updated the code provided by Kasper Souren to follow the Drupal Coding Standards and added command aliases. Also, I've added two new commands:

  • Path redirect import: used to import redirects from a file (actually supporting CSVs but should be easy to write support for new files).
  • Path redirect remove: used to remove redirects from the database. At the moment doesn't remove just one, you can specify to remove all the redirects or just the one for one type. In the future will be a good idea to remove from the redirect ID or redirects from before/after a date.

I've tested the part of Kasper Souren and was working fine. My part works to but I will leave it for review.

Regards,
David.

David Hernández’s picture

Version: 6.x-1.0-rc2 » 6.x-1.x-dev

Changed to version 6.x-1.x-dev

tomotomo’s picture

What's the right way to get a .drush.inc file included?

Also, how about a "path-redirect-list" command? :)

David Hernández’s picture

Hello,

#4, Drush loads the [module name].drush.inc file included in the folder of the module or inside a drush folder, so you don't have to worry about including or loading the new drush commands.

A path redirect list command will be easy to implement, but I'm not sure if it's a good idea as you may have a lot of redirects. Maybe adding some filters to the command will help, for example adding a limit to the query, filtering by redirect type... The module provides a function to load a list of redirects using different parameters (path_redirect_list_redirects), but maybe will need a bit of refactoring to work with drush.

I will try to have a better look in other moment.

Regards,
David.

tomotomo’s picture

I think that hundreds of entries is not a problem, but thousands of entries would generally need to be redirected to a file. If not listing output to stdout, then maybe "path-redirect-export" should be an option.