When activating cache in "normal" mode, site is unaccessible because of call to undefined function drupal_add_js()
tdebruyn - February 29, 2008 - 11:09
| Project: | Yahoo YUI |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | drupalhizmetleri |
| Status: | closed |
Jump to:
Description
When activating cache in "normal" mode (most probably in "aggressive" mode too), the site becomes unaccessible for unregistered users with the following message:
"Fatal error: Call to undefined function: drupal_add_js() in /home/user/www/modules/yui/yui.module on line 33".
There was a similar problem in the gallery module which was fixed in 5.x-2.2: http://drupal.org/node/224598

#1
Thanks for reference. Please try the yui version 2.3. Please feed back.
#2
I've just updated yui and yui_menu, enabled normal caching and everything seems to be fine :]
#3
#4
Fixed. Use yui 6.x-1.1-1 and yuimenu 6.x-1.1-1
#5
Automatically closed -- issue fixed for two weeks with no activity.
#6
I think this issue was fixed in a wrong way. You should not include common.inc inside a module file. That will lead to performance issues. Instead you should read suggested fix at http://api.drupal.org/api/function/hook_init/5.
#7
One point is not clear in my mind. Should i remove the yui_init() function and move the 2 lines to yui_menu() like as follows ? Should it before the if($may_cache) line or after ? By the way many thanks for your advanced support.
<?php
function yui_menu($may_cache) {
$skin = variable_get('yui_skin', 'yui-skin-sam');
drupal_add_js("if (Drupal.jsEnabled) { $(document).ready(function() { $('body').addClass('$skin'); } ); };", "inline");
$items = array();
if ($may_cache) {
$items[] = array(
...
...
?>
#8
<?phpfunction yui_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
...
}
else {
$skin = variable_get('yui_skin', 'yui-skin-sam');
drupal_add_js("if (Drupal.jsEnabled) { $(document).ready(function() { $('body').addClass('$skin'); } ); };", "inline");
}
...
?>
#9
Fixed in 5.x-1.x-dev and will ready in next release.
#10
Automatically closed -- issue fixed for two weeks with no activity.