I am using Rules 6.x-1.2 version, and I have a very strange issue when using rules redirect from a node to another.

This is the rule set:

array (
  'rules' => 
  array (
    'rules_1' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_view',
      '#label' => 'Profile Redirect when trying to view profile or pp node',
      '#active' => 0,
      '#weight' => '0',
      '#categories' => 
      array (
        0 => 'Redirects',
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Viewed content is Profile or Profile Pictures',
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#name' => 'rules_condition_content_is_type',
          '#settings' => 
          array (
            'type' => 
            array (
              'profile' => 'profile',
              'pp' => 'pp',
            ),
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#type' => 'condition',
        ),
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#type' => 'action',
          '#settings' => 
          array (
            'path' => 'user/[node:author-uid]',
            'query' => '',
            'fragment' => '',
            'force' => 0,
            'immediate' => 1,
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'path' => 
                array (
                  0 => 'node',
                ),
              ),
            ),
          ),
          '#name' => 'rules_action_drupal_goto',
          '#info' => 
          array (
            'label' => 'Page redirect',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'path',
              1 => 'query',
              2 => 'fragment',
            ),
          ),
          '#weight' => 0,
        ),
      ),
      '#version' => 6003,
    ),
  ),
)

I was getting "Cron run exceeded the time limit and was aborted." error. As soon as i diabled the redirect the cron ran and working fine. It was also culprit for stuck cron.

I

Comments

ayalon’s picture

Component: Rules Core » Rules Engine

I had exactly the same issue...

mkinnan’s picture

I have the same issue ... this is how I solved it for now. I had to include the admin in the exclusion because running cron manually as user 1 causes cron to crash and I had to reset the cron variables in the system table in the database.

Now that I got this to work, I am having trouble with searching because it does unwanted redirects when you search for a term.

Create a new rule and for the 'Do' execute a custom PHP script:

<?php
if ($user->uid > 1) {
  // do a query to get the link

  // then do a redirect
  drupal_goto($link_redirect);
}
?>

There might be a way to do this without doing a php script, but I could not figure out how to get specific user ID exclusion in the 'If' part.

mkinnan’s picture

To fix the issue I was having with searches:

http://drupal.org/node/679648#comment-2580456

fago’s picture

Version: 6.x-1.2 » 6.x-1.x-dev

Indeed, the redirect action should probably do nothing in case cron is active.

fago’s picture

Status: Active » Closed (cannot reproduce)

As this bug-report is rather old, please verify it's still valid in the latest dev version and re-open if so. For now, I'm marking it as closed.