Download & Extend

When activating cache in "normal" mode, site is unaccessible because of call to undefined function drupal_add_js()

Project:Yahoo YUI
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:bakyildiz
Status:closed (fixed)

Issue Summary

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

Comments

#1

Assigned to:Anonymous» bakyildiz

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

Version:5.x-2.2» 5.x-2.3
Status:active» fixed

#4

Version:5.x-2.3» 6.x-1.1-1

Fixed. Use yui 6.x-1.1-1 and yuimenu 6.x-1.1-1

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#6

Version:6.x-1.1-1» 5.x-2.0-dev
Status:closed (fixed)» needs review

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

<?php
function 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

Version:5.x-2.0-dev» 5.x-1.x-dev
Status:needs review» fixed

Fixed in 5.x-1.x-dev and will ready in next release.

#10

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

nobody click here