file_get_contents(sites/default/files/languages/ru_73d02bf8240728b62c5341973489e015.js): failed to open stream: No such file or directory in file /hsphere/local/home/zetver/iritera.ru/includes/common.inc in line 2255.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oscnet’s picture

Priority: Normal » Critical

I also
warning: file_get_contents(sites/default/files/languages/zh-hans_c0ada3b21ce0b445c75a3537716078ff.js) [function.file-get-contents]: failed to open stream: No such file or directory in E:\site\includes\common.inc on line 2255.

acosta68’s picture

I have the same problem. I think that is a problem with the "primary links". Because the message disapears if you disable the primary links.

andypost’s picture

Status: Active » Closed (duplicate)
andypost’s picture

Murz’s picture

Version: 6.4 » 6.5
Priority: Critical » Normal
Status: Closed (duplicate) » Active

andypost, function drupal_build_js_cache($files, $filename) don't use the file_create_url() function, it uses file_create_path('js'). Therefore marking this as duplicate is wrong.
I have see this errors on my Drupal 6.5 at first load age after setting "Optimize JavaScript files" in Perfomance page. After refresh page with error, this error disappears.
And when I try to check with hands, I didn't see created folder 'languages' in 'files' folder. Permissions of folder is normal, other folders creates successfully.
I think this is a bad url to .js file.

Murz’s picture

Status: Active » Closed (duplicate)

Oh, sorry, I didn't see your last post:
Sorry, this one is right #250451: locale.module adds wrong js path

Murz’s picture

Status: Closed (duplicate) » Active

Oh, sorry again :)
This bug is not depend by bug #250451.
I apply a patch, that attached to this bug, but it isn't help.
The problem is here
function drupal_build_js_cache($files, $filename) gets an array of files from function drupal_get_js() and this function send the wrong list of files:

Array
(
    [misc/jquery.js] => Array
        (
            [cache] => 1
            [defer] => 
            [preprocess] => 1
        )

    [misc/drupal.js] => Array
        (
            [cache] => 1
            [defer] => 
            [preprocess] => 1
        )

    [files/languages/ru_39ef65450ed70e537c44a01e5b060ec0.js] => Array
        (
            [cache] => 1
            [defer] => 
            [preprocess] => 1
        )

    [sites/all/modules/nice_menus/nice_menus.js] => Array
        (
            [cache] => 1
            [defer] => 
            [preprocess] => 1
        )

    [sites/all/modules/thickbox/thickbox.js] => Array
        (
            [cache] => 1
            [defer] => 
            [preprocess] => 1
        )

)

We see here the file files/languages/ru_39ef65450ed70e537c44a01e5b060ec0.js but this file is a cached .js file and don't needed to cache again. Function drupal_get_js() must not send the already cached .js to the function drupal_build_js_cache($files, $filename) in $files variable!

Logrise’s picture

Yes, I think YOu right. Js cashe is enabled on my site and I think the trouble is nearly here.

neochief’s picture

Status: Active » Needs review
FileSize
571 bytes

Here's my resolution of the problem:

1. We should tell locale module not to cache JS files
2. We should check JS files on existance (to not make 404 on those who are not created), because drupal_get_js isn't check this out when building the scripts array.

The problem is gone after this patch for me.

erick.mattos’s picture

Version: 6.5 » 6.8
Component: base system » language system
Assigned: Unassigned » erick.mattos
FileSize
1.37 KB

Hi,

I had the same problem but for a different reason: in my case that happened all the time a did a restore from a backup. My provider just reset all file and directory ownerships to my user. This means Drupal by PHP is not being the owner of the cache data in files folder. I realized that deleting all folders and files made Drupal later rebuild them but the language folder and its files.
In my case the problem was Drupal not creating language javascript.
I found the previous solution incomplete since it is a system feature being neutralized.
Then this is my solution: it is a patch for locale.inc which makes Drupal rebuild the file for not finding it.
Please check if that solves all similar problems of yourselves.

Regards

jannalexx’s picture

same issue/error here
#10 works, the locales js file is in sites/default/files/languages/
now.
thanks

dragossani’s picture

#9 patch successfully remove the problem in my Drupal installation.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

agree with #12

borfast’s picture

#9 also seems to fix the problem on the site I'm experiencing this problem on.

borfast’s picture

Version: 6.8 » 6.x-dev

I'm bumping the version, otherwise this won't get into the next release.

yang_yi_cn’s picture

#10 works for me, drupal 6.9

gionnibgud’s picture

#10 works for me too. Instead of the error the correct file is been created.

neochief’s picture

Actually, I can say that #10 works for me too, and my previous patch (#9) isn't required for it to work.

neochief’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.54 KB

Bumping it to 7.x-dev

neochief’s picture

Version: 6.x-dev » 7.x-dev
borfast’s picture

Shouldn't this be kept on 6.x so the problem can be corrected there? Or will the core maintainers backport the fix after it is applied to 7.x?

neochief’s picture

Status: Needs review » Reviewed & tested by the community

It will be certainly be backborted. I just know that working 7.x patch can speed-up commit in both versions :)

As this patch passed tests, and it works for several people, marking this issue as "tested by community".

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Could someone provide testing instructions that explain how to reproduce this error? And ideally, these steps would be represented in an automated test so that we ensure that we don't break this again later.

Also, the testing reports from people are confusing. Half of them say #9 worked for them, half of them say #10 worked for them. Which one is the one that's RTBC?

Here's a review of #19:

+    $dest = $dir .'/'. $language->language .'_'. $data_hash .'.js';

1. This needs to use the D7 style of concatenation, which is a space on either side of the . ($dir . '/' . $language...)
2. We don't abbreviate variables. That should be $destination.

+      // Ensure that the directory exists and is writable, if possible.
+      file_check_directory($dir, TRUE);

a) You're not actually checking this... if this fails it will return FALSE which is never captured/compared; you simply proceed to saving the file.
b) TRUE should be something like FILE_CREATE_DIRECTORY or FILE_MODIFY_PERMISSIONS.

neochief’s picture

@webchick, the test case may be simple — during this stage, the localized js shouldn't exist (in real life it can not exists, or be not writable or something else).

In current drupal versions, if this file is not exists, an error message appears. In (#9) I have just rid of this error, but (#10) solves the root of problem by creating another instance of js file.

andypost’s picture

I've tested #9 and #10 on 2 sites one lives in / and other in subfolder (example.com/heb/)

site in subfolder stops throwing 404 in log only after aplying both #9 and #10 but I still can't understand how to check because languages folder still empty and no js files included except standart

neochief’s picture

Status: Needs work » Closed (duplicate)
Ingumsky’s picture

Hmmm... Still the same issue for me (drupal-6.10). Original patch #10 wasn't created correctly so I was forced to make some changes manually to apply it. I tried to patch my includes/locale.inc with #10 but it doesn't seem to work. Number #9 was also applied later but I'm still at the same point with "The selected file /var/www/virtual/example.net/phptmp/fileqkJTSD could not be uploaded, because the destination sites/default/files/languages/ru_e055380dca6b6ffdf70315567d3ccfc5.js is not properly configured" errors appearing on every single page. Cache was cleared (/admin/settings/performance...), language was switched back to "English" (no errors) and later brought back to "Russian" (with bloody errors appeared again)... *confused*

UPD And latest patch for 6.x from #338630 didn't make the difference. -\

ionmedia’s picture

Version: 7.x-dev » 6.9

maybe just not cache js ?

sinasalek’s picture

Version: 6.9 » 6.13

Same problem here with Drupal 6.13

sinasalek’s picture

same here

Medom’s picture

6.15 still same issue. Any solution?

Aniara.io’s picture

Same error on 6.15:

file_get_contents(sites/default/files/languages/ar_0e641e619d9a650426f69bf1dfce2f4e.js) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/***/***/drupal/includes/common.inc on line 2440.

I have Normal caching and CSS/JS optimization on.

andypost’s picture

Version: 6.13 » 7.x-dev
Feron’s picture

Status: Closed (duplicate) » Needs review

#19: locale_D7.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, locale_D7.patch, failed testing.

plach’s picture

Status: Needs work » Closed (duplicate)

This has already been fixed in D7 and D6.

ionmedia’s picture

change permissions to 777 (instead 776) for dir sites/default/files/languages

ritsd’s picture

Status: Closed (duplicate) » Needs review

#9: locale.module.patch queued for re-testing.

malim’s picture

Warning: file_get_contents(/home/content/d/i/o/xxxx/html//includes/common/error_handler.html) [function.file-get-contents]: failed to open stream: No such file or directory in /home/content/04/3744204/html/includes/config.inc.php on line 207

Any good solution to resolve this problem? Godaddy hosting my website & i am using Esyndicate Directory software.

mgifford’s picture

Assigned: erick.mattos » Unassigned
Issue summary: View changes
Status: Needs review » Closed (duplicate)

No word on why @plach status was changed, so changing it back.