As described in #594326: Breaks Drush for the module Global Redirect a redirection breaks the execution of the drush shell command. The fix it to return from path_redirect_init() without calling _path_redirect_check() when executing path_redirect_init() through drush.

CommentFileSizeAuthor
#1 path_redirect-616772.patch531 bytesfuerst

Comments

fuerst’s picture

StatusFileSize
new531 bytes

The attached patch simply is adapting the patch from #594326: Breaks Drush to this module.

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

Why would a redirect be executed by Path redirect? I can understand Global redirect since it 'works' for basically all requests, but path redirect should only happen on specific paths. Did you actually test that this doesn't work with Drush? Can you give insight into the conditions leading to failure?

fuerst’s picture

When executing drush update at the command line the $r object inside _path_redirect_check() will be populated by this values:

stdClass Object
(
    [rid] => 24
    [path] => home/home
    [redirect] => node/5
    [query] => 
    [fragment] => 
    [language] => 
    [type] => 301
    [last_used] => 1256747530
)

The $_GET variable has this content:

Array
(
    [q] => home/home
)

At my site there exists a path redirect for home/home which is configured as front page in /admin/settings/site-information. If I delete that redirection or set the front page configuration to another non-redirected URL like node/5 the error does not occur.

Looks like drush always calls the front page of Drupal. If the front page is set to a path redirect a redirection will be triggered which in turn breaks Drush.

So the solution to not redirect when called by Drush looks good to me. What do you think?

dave reid’s picture

In this case, you should be using global redirect and not using path_redirect.

fuerst’s picture

Path Redirect will be used by the Pathauto module. So the redirect in question is not configured by me but setup automatically by Pathauto. Looks like a unfortunate condition which is surely not the fault of Path Redirect. May be it can be fixed in Drush itself. Will get back to the issue queue there.

dave reid’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed

Marking this issue as fixed due to lack of response.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.