Skip to content

Instantly share code, notes, and snippets.

@tamasd
Created March 2, 2012 09:21
Show Gist options
  • Save tamasd/1957130 to your computer and use it in GitHub Desktop.
Save tamasd/1957130 to your computer and use it in GitHub Desktop.
Fixes a Pressflow bug. Fatal error happens if drupal_add_js() is called during install.
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2221,7 +2221,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
// We never cache authenticated user pages, so if they are logged in we
// allow setting of the has_js cookie so batch API functions use the JS
// version.
- if (!user_is_anonymous()) {
+ if (function_exists('user_is_anonymous') && !user_is_anonymous()) {
$javascript['footer']['inline'][] = array('code' => "document.cookie = 'has_js=1; path=/';", 'defer' => TRUE);
}
}
@@ -2733,7 +2733,7 @@ function page_set_cache() {
'created' => $_SERVER['REQUEST_TIME'],
'headers' => array(),
);
-
+
// Restore preferred header names based on the lower-case names returned
// by drupal_get_header().
$header_names = _drupal_set_preferred_header_name();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment