In 5.x

warning: file_get_contents(modules/curlypage/curlypage/curlypage.js?1266877857) [function.file-get-contents]: failed to open stream: Success in /modules/javascript_aggregator/javascript_aggregator.module on line 65.

greetings

CommentFileSizeAuthor
#6 dummy.zip1.89 KBmanfer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Quinti’s picture

Hi

Solved

adding cache TRUE to drupal_add_js in line 257 of module

drupal_add_js($path .'/curlypage/curlypage.js', 'module', 'header', FALSE, TRUE);

greetings

manfer’s picture

I haven't been able to reproduce it to receive that warning. Anyway, could it be something related to paths?

Look at the warning:

"warning: file_get_contents(modules/curlypage/curlypage/curlypage.js?1266877857) [function.file-get-contents]: failed to open stream: Success in /modules/javascript_aggregator/javascript_aggregator.module on line 65."

the parameter to file_get_contents should look something like: "/sites/all/modules/curlypage/curlypage/curlypage.js", probably "/sites/all/modules/curlypage/curlypage/curlypage.js?1266877857" would no be problematic either.

TRUE or FALSE on the last parameter to drupal_add_js should be a question of preference (caching or not caching). It can be solving the problem but it should not trigger any warning with FALSE value. Anyway setting it to TRUE is fine, maybe I can change it to TRUE and let that file cached.

Anyway I'm going to have a look to javascript_aggregator code and how it is treating not cached javascript or if there is something wrong on any of my paths. But that path (modules/curlypage/curlypage/curlypage.js?1266877857) looks very strange. If it were (sites/all/modules/curlypage/curlypage/curlypage.js?1266877857) I could think of including a trailing base_path() to my paths. But that path that appears on the warning I can't understand were it comes from unless javascript_aggregator is not using correct relative path on its code for not cached js (as when you change that parameter to TRUE it works fine it should be something with no cached js).

manfer’s picture

I was not able to reproduce it because I was not installing javascript aggregator properly. I was installing the module as any other one but this specific module needs manual changes on a theme file.

After confirming the problem and reviewing my paths, I can only think of a problem in javascript aggregator.

FALSE or TRUE on final parameter in drupal_add_js are both correct values. TRUE if you want the file cached, FALSE if you don't.

I suppose your path is modules/curlypage/curlypage/curlypage.js?1266877857 because you are installing contrib modules directly on core modules folder, that confused me a little.

I'm going to have a look at javascript aggregator code.

manfer’s picture

Project: Curlypage » Javascript Aggregator
Version: 5.x-2.3 » 5.x-1.5
Issue tags: +curlypage

OK I think I have found the problem and it seems a javascript aggregator issue.

If you want a javascript file not cached you use FALSE in last parameter in drupal_add_js (this is what I do in curlypage). For those files drupal adds a random get parameter to the end of the file ?123213214 so the browser is forced to get the file from the server.

It seems javascript aggregator is not considering those files. But file_get_contents in line 65 of javascript_aggregator module does not accept a parameter like (sites/all/modules/curlypage/curlypage/curlypage.js?123213214) as correct parameter and is not able to find the file. That's the warning.

It would work if that module removes that end ?123213214 to the path of the file.

Anyway I don't know if that means treating correctly that file explicitly marked as no cache.

I would consider changing that cache FALSE to true in curlypage. Really on a stable releases of curlypage where curlypage.js is not changing, caching that file is a fine solution.

Anyway this seems a bug in javascript aggregator and any other module adding a javascript file with explicit cache FALSE probably triggers same warning and that module stops working if javascript aggregator is used.

I attach a dummy example module that would trigger same problem and change this to javascript aggregator issue.

manfer’s picture

Title: Not run with javascript aggregator » javascript aggregator makes modules with explicit no cache javascript files to stop working
manfer’s picture

FileSize
1.89 KB

Something happened with the attached file. So I attach it again.

And as a resume. Modules that include javascript files with explicit no cache triggers this bug. Example:

drupal_add_js($path .'/curlypage/curlypage.js', 'module', 'header', FALSE, FALSE);
derjochenmeyer’s picture

Status: Active » Closed (won't fix)

Version 5 is no longer supported.