drupal_is_front_page and drush / cron

During drush and cron drupal_is_front_page always returns TRUE which kind of makes sense.

The biggest problem is that context and panels might interfere, because it will always use the config for the front page, luckily there’s an easy fix.

1
2
3
4
5
6
7
8
9
10
/**
* My update function.
*/
function MY_MODULE_update_7001(&$sandbox = array()) {
// Make sure front page is FALSE.
$drupal_static_fast['is_front_page'] =& drupal_static('drupal_is_front_page');
$drupal_static_fast['is_front_page'] = FALSE;

// Rest of the code.
}