Drupal CRON – access denied when Apache Solr module is installed

headIn one of our Drupal projects, when the CRON URL was accessed it was showing the Access Denied page. After doing some R&D we found that the issue was due to the Apache Solr module. The Apache Solr module’s CRON function was failing to index nodes. Finally we found the reason why this was failing and redirecting to Access Denied page. The reason was we had implemented the hook_node_view() to check permission when content of a particular type was accessed. So, when Apache Solr tried to index content of this type, it was failing to do so due to the permission required to view the content. It then redirected the call to access denied page. After bypassing the code in hook_node_view() with the following condition it started working.

'search_index' != $view_mode

FYI, $view_mode is the second parameter of hook_node_view().

The following link gave us an idea about the issue.

http://www.blinkreaction.com/blog/be-aware-nodes-with-php-code-and-drupal-search-index

Share

Leave a Reply

Your email address will not be published. Required fields are marked *