Hello everyone,
when I run cron.php I get a redirect to a page.
Maybe I've a drupal_goto inside a node, but I don't know which node (I've thousands of them).

How can I find where drupal_goto is?

Many thanks to all!

P

Comments

John_B’s picture

Use phpmyadmin to search - might as well just search the whole db, though if it is there is must be in a field, probably body field. Also check for a drupal_goto() in any custom code, as in certain circumstances (when it is called late in the bootstrap) it can cause problems in the codebase too.

If you want to do the job properly, search for <?php in the database and delete any node where you find it... php module is evil!

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

PieroB83’s picture

no php code found. What else can cause the redirect on the cron?

thanks all!

P

John_B’s picture

Did you read this part of my post:

Also check for a drupal_goto() in any custom code, as in certain circumstances (when it is called late in the bootstrap) it can cause problems in the codebase too.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

dotmundo’s picture

Can this not be detected using something like Firebug?

John_B’s picture

Ouch - no. It is important that we all treat everyone here courteously, and in that context some things should still be said, so with great respect I will say that maybe presenting your core skills as Drupal Developer is not really fair to people who have spent many years learning this stuff (not that I am an expert developer, and I don't claim to be).

FWIW you have my sympathy because I struggled a lot with this issue on a site, and I removed drupal_goto from the database. However, the site (an important and large one) suffered a major problem because I mis-used drupal_goto in code, a mistake someone with deeper knowledge of Drupal dev would not have made.

You need to search the codebase. This is really only possible from command line using grep. However, if you built the site, you will will already know if there is some custom code, and if there is not, that cannot be the problem.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

Jaypan’s picture

I fully agree with your sentiment John - but I think you didn't realize the poster you were replying to wasn't the same poster that started the thread.

John_B’s picture

That is true.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

dotmundo’s picture

I wonder if the Event Log module would log where the redirect came from

Jaypan’s picture

Nope.

Edit: John already gave the correct answer. The redirect will exist in one of three places. The database, the code, or an .htaccess file. It's doubtful that it's in an .htaccess, and the db has already been searched. So the last place is to search the code base for drupal_goto.