Prevent PHP during Cron

sciman - July 22, 2008 - 02:49

Is there a way to prevent PHP code from executing during the Cron Job?

Whenever I create a Page using the PHP Filter, the PHP code that I place on the page gets executed during the Cron Job. Is there an API call or some other code that I can call or wrap around the PHP code to prevent it from executing during the Cron?

Thanks for any insights.

Steve

you could use an if

coreyp_1 - July 22, 2008 - 04:51

you could use an if statement like this:

<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
 
//this is the actual node page, do the php...

}
?>

- Corey

Hi Corey, Not quite sure

sciman - July 22, 2008 - 14:33

Hi Corey,

Not quite sure what it is supposed to do, but I'll give it a try and see how it goes.

Thanks,

Steve

Basically, it makes sure

coreyp_1 - July 22, 2008 - 17:00

Basically, it makes sure that the PHP is only executed when you are looking at a node page (ex. www.example.com/node/7). arg() is a drupal function that lets you know the parts of the url that determine what page to show.

- Corey

 
 

Drupal is a registered trademark of Dries Buytaert.