I am creating files to be run in different situation using scheduled cron jobs. These are mainly for either cleaning nodes, updating or doing other calculations automatically. The drupal site is running in devdesktop.

I have a few of them and so far I have no problem making them do what they should. They all have the same structure and format, using the same basic db functions or node_delete_multiple.

This new file I created, is having me want to split my head open on a concrete wall. I basically doing the exact same thing as my other scripts, but when executing this one I get an error. I found where it was coming from (node_delete_multiple()) and reduced the code to this.

define('DRUPAL_ROOT', str_replace('cron_scripts', '', getcwd()));
require_once DRUPAL_ROOT . './includes/bootstrap.inc';
$regtodel = array(5366,5373,5375,5444);

The DRUPAL_ROOT value is the same used from the other, working, scripts I have in that directory.

This should delete the nodes in the array. It doesn't and it gives this error.

Fatal error: require_once(): Failed opening required 'sites/all/modules/htmlpurifier/library/HTMLPurifier.auto.php' (include_path='.;C:\Program Files (x86)\DevDesktop\common\pear') in D:\AQUIADEV\site\devdesktop\OCRNATIONv2\sites\all\modules\htmlpurifier\htmlpurifier.module on line 320

Now, when looking at htmlpurifier in the website, it's normally loading its library using the library API, but from the external script, it's not using the API and try to load from the module folder. Plus it's probably loaded by the bootstrap, but I don't need it in those script. It should be related at all, but for some unknown reason, it prevents me from going any further.

What can be the reason behind that? Like I said, other scripts are working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.