Our BlogToday's internet offers unprecedented power. Blink keeps you updated.Be aware: nodes with PHP code and Drupal search indexWe finally decided to go to Apache Solr as our search solution. Basic installation and configuration went well out of the box (both solr engine and the Drupal module). The only thing left was waiting on the index to fill. Indexing is done on a cron run. Solr relies on Drupal's code Search engine, for hook_update_index invocation. So cron was set to be launched every 5 minutes instead of 1h to speed things up (650k+ nodes to index...). However something broke... Drupal logs started showing "Cron run exceeded the time limit and was aborted." Launching cron.php from a web browser was giving 403 Access Denied Drupal message. However running cron manually (admin/reports/status/run-cron) worked correctly.
... if ($hook == 'cron') watchdog('cron', "hit $module cron"); // add this line At next run "hit search cron" in the log targeted the culprit. Search module invokes hook_update_index during a cron run. Further investigation showed that failure was happening during node_update_index invocation. <?php if (!user_access('create article content')) { ?> During nodes indexing PHP code inside nodes is evaluated! This is reasonable, since you want to get a clean output and not to index the code :D. Be careful with what you store in your nodes. PHP code does not belong to DB and should be used in node either for simple things (like ('Login', 'user/login');) or rarely and with care. Let's be directCustomers go to the web for information - they want it fast, simply stated and easy to understand. Conveniently, this is our specialty. Click here to Contact Us.Not a Tech Guru?No problem - most of our clients aren't either. All we need to understand are your company's internet marketing goals. We'll take it from there. Click here to learn more about our Blink team |
||

Comments
Post new comment