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
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

drupalhizmetleri - March 13, 2008 - 20:17
Assigned to:Anonymous» drupalhizmetleri

Thanks for reference. Please try the yui version 2.3. Please feed back.

#2

klb - March 17, 2008 - 09:59

I've just updated yui and yui_menu, enabled normal caching and everything seems to be fine :]

#3

drupalhizmetleri - March 17, 2008 - 18:19
Version:5.x-2.2» 5.x-2.3
Status:active» fixed

#4

drupalhizmetleri - March 20, 2008 - 18:42
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

Anonymous (not verified) - April 3, 2008 - 18:54
Status:fixed» closed

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

#6

mustafau - June 5, 2008 - 09:05
Version:6.x-1.1-1» 5.x-2.0-dev
Status:closed» 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

drupalhizmetleri - June 7, 2008 - 17:19

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

mustafau - June 7, 2008 - 18:00

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

drupalhizmetleri - June 8, 2008 - 07:36
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

Anonymous (not verified) - June 22, 2008 - 07:42
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.