I get this error on almost every administration page:

Warning: filemtime(): stat failed for drupal-7.0.fr.po in l10n_update_source_check_file() (line 288 of /var/www/devia.org/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for drupal-7.0.nb.po in l10n_update_source_check_file() (line 288 of /var/www/devia.org/sites/all/modules/l10n_update/l10n_update.check.inc).

Comments

Status:Active» Postponed (maintainer needs more info)

What are the permissions on that file? Can the webserver read it? Sounds like it cannot.

/var/www/profiles/standard/translations$ ls -l
-rw-r--r-- 1 root root 699223 2011-01-11 16:03 drupal-7.0.fr.po
-rw-r--r-- 1 root root 492052 2011-01-18 16:04 drupal-7.0.nb.po

Status:Postponed (maintainer needs more info)» Active

Getting the same error on a new multi-site installation now, where the translation files are stored and shared between multiple sites in sites/all/translations.

Warning: filemtime(): stat failed for drupal-7.0.fr.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for drupal-7.0.nb.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for l10n_update-7.x-1.0-alpha2.fr.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for l10n_update-7.x-1.0-alpha2.nb.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for media-7.x-1.0-beta3.fr.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for media-7.x-1.0-beta3.nb.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for navigation404-7.x-1.0.fr.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for navigation404-7.x-1.0.nb.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for styles-7.x-2.0-alpha5.fr.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for styles-7.x-2.0-alpha5.nb.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for wysiwyg-7.x-2.0.fr.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).
Warning: filemtime(): stat failed for wysiwyg-7.x-2.0.nb.po in l10n_update_source_check_file() (line 288 of /home/viva/Public/Sites/devia/sites/all/modules/l10n_update/l10n_update.check.inc).

~/Public/Sites/devia/sites/all/translations$ ls -l
-rw-r--r-- 1 www-data www-data   1033 2011-01-22 17:48 danland-7.x-1.0.fr.po
-rw-r--r-- 1 www-data www-data   1022 2011-01-22 17:48 danland-7.x-1.0.nb.po
-rw-r--r-- 1 www-data www-data 699223 2011-01-22 21:14 drupal-7.0.fr.po
-rw-r--r-- 1 www-data www-data 492052 2011-01-22 21:25 drupal-7.0.nb.po
-rw-r--r-- 1 www-data www-data  14056 2011-01-22 21:22 l10n_update-7.x-1.0-alpha2.fr.po
-rw-r--r-- 1 www-data www-data  11084 2011-01-22 21:33 l10n_update-7.x-1.0-alpha2.nb.po
-rw-r--r-- 1 www-data www-data   2532 2011-01-22 21:22 media-7.x-1.0-beta3.fr.po
-rw-r--r-- 1 www-data www-data   2284 2011-01-22 21:33 media-7.x-1.0-beta3.nb.po
-rw-r--r-- 1 www-data www-data    581 2011-01-22 21:23 navigation404-7.x-1.0.fr.po
-rw-r--r-- 1 www-data www-data    610 2011-01-22 21:33 navigation404-7.x-1.0.nb.po
-rw-r--r-- 1 www-data www-data   2038 2011-01-22 21:23 styles-7.x-2.0-alpha5.fr.po
-rw-r--r-- 1 www-data www-data   1884 2011-01-22 21:34 styles-7.x-2.0-alpha5.nb.po
-rw-r--r-- 1 www-data www-data  15194 2011-01-22 21:23 wysiwyg-7.x-2.0.fr.po
-rw-r--r-- 1 www-data www-data   1898 2011-01-22 21:34 wysiwyg-7.x-2.0.nb.po

Status:Active» Postponed (maintainer needs more info)

Ok, well, it would be great to know a better stack trace of the case when this is happening. It is possible the files are looked for in the wrong directory(?). Can you provide a debug_backtrace() of when this is happening? Thanks!

StatusFileSize
new640 bytes

I would be happy to do that, but I'm not sure how to add the debug_backtrace(). I searched a little on drupal.org, but couldn't figure out how. Could you update the attached patch with the correct way to do it?

Let's try these three lines first at the place here you tried to add that line:

<?php
if (!file_exists($file->filename)) {
 
var_dump(debug_backtrace());
}
?>

StatusFileSize
new101.41 KB

Ok, so I patched the file as described, enabled a module, navigated to another administration page and got the same errors as before, preceded by the debug_backtrace dump. I attached it as a text file, as it is kind of large.

StatusFileSize
new3.54 KB

Subscribing because it also happens to me.

As a starting point, I can tell you that it automatically can update the language of several modules, but it always stops when actualizing Drupal Core translation and appears the supplied error message...

Guys,

I had the same error before. However (at least for me) it looks like permission issue. Here's the way I solve it:

Previously, my /translations directory and its contents are:
drwxrwx--- 2 root apache 512 Jan 27 02:46 translations
-rw-r--r-- 1 apache apache 1687 Jan 27 02:43 devel-7.x-1.0.id.po

Because the .po files created have write permission given only to apache, I changed the /translations directory ownership:group with:
chown apache:root translations

That's all, and the error gone.

Cheers,
Lismail

Begin solving problem as lismail describe. That's take effect. And I has noticed that the problem appeared when I copied site from one server to another, and nearly all permissions droped or corrupted.

The translations directory was created by the module and has these permissions:
drwxrwxrwx  2 username username 4096 2011-02-02 18:14 translations

The files in the translations directory have been saved there by the module and have these permissions:

-rw-rw-rw- 1 username username   1033 2011-01-22 17:48 danland-7.x-1.0.fr.po
-rw-rw-rw- 1 username username   1022 2011-01-22 17:48 danland-7.x-1.0.nb.po
-rw-rw-rw- 1 username username 699223 2011-01-23 18:22 drupal-7.0.fr.po
-rw-rw-rw- 1 username username 492052 2011-01-22 21:25 drupal-7.0.nb.po
-rw-rw-rw- 1 username username  14056 2011-01-23 18:30 l10n_update-7.x-1.0-alpha2.fr.po
-rw-rw-rw- 1 username username  11084 2011-01-22 21:33 l10n_update-7.x-1.0-alpha2.nb.po
-rw-rw-rw- 1 username username   7736 2011-01-23 12:28 link-7.x-1.0-alpha2.fr.po
-rw-rw-rw- 1 username username   1437 2011-01-23 12:28 link-7.x-1.0-alpha2.nb.po
-rw-rw-rw- 1 username username   2532 2011-01-23 18:31 media-7.x-1.0-beta3.fr.po
-rw-rw-rw- 1 username username   2284 2011-01-22 21:33 media-7.x-1.0-beta3.nb.po
-rw-rw-rw- 1 username username    592 2011-01-23 12:28 media_youtube-7.x-1.0-alpha4.nb.po
-rw-rw-rw- 1 username username    581 2011-01-23 18:31 nausernametion404-7.x-1.0.fr.po
-rw-rw-rw- 1 username username    610 2011-01-22 21:33 nausernametion404-7.x-1.0.nb.po
-rw-rw-rw- 1 username username   2038 2011-01-23 18:31 styles-7.x-2.0-alpha5.fr.po
-rw-rw-rw- 1 username username   1884 2011-01-22 21:34 styles-7.x-2.0-alpha5.nb.po
-rw-rw-rw- 1 username username  15194 2011-01-23 18:31 wysiwyg-7.x-2.0.fr.po
-rw-rw-rw- 1 username username   1898 2011-01-22 21:34 wysiwyg-7.x-2.0.nb.po

I'm really stumped on this.

I did not have time to look into this, but my assumption for now is that the file is not looked for at the right place (the error message does not have a specific path either). I'd suggest people looking into this maybe look at it with this in mind.

Okay, so I have reinstalled my multi-site development environment. This time I created the translations directory before setting 'Store downloaded files' to this directory:

$ mkdir -p sites/all/translations
$ sudo chown www-data:www-data sites/all/translations
$ ls -l sites/all
total 20
drwxr-xr-x  3 username username 4096 2011-02-05 16:48 libraries
drwxr-xr-x 17 username username 4096 2011-02-05 16:54 modules
-rw-r--r--  1 username username  404 2009-03-18 10:53 README.txt
drwxr-xr-x  3 username username 4096 2011-02-05 16:54 themes
drwxr-xr-x  2 www-data www-data 4096 2011-02-05 18:22 translations

After having set 'Store downloaded files' to this directory (sites/all/translations), I went to Regional and language > Languages and added a predefined language (French). Everything went okay, and the files were stored in sites/all/translations:
$ ls -l sites/all/translations
total 848
-rw-r--r-- 1 www-data www-data   2414 2011-02-05 18:08 addressfield-7.x-1.0-alpha1.fr.po
-rw-r--r-- 1 www-data www-data   1844 2011-02-05 18:08 advanced_help-7.x-1.0-beta1.fr.po
-rw-r--r-- 1 www-data www-data   8776 2011-02-05 18:08 commerce-7.x-1.0-alpha5.fr.po
-rw-r--r-- 1 www-data www-data  43231 2011-02-05 18:09 ctools-7.x-1.0-alpha2.fr.po
-rw-r--r-- 1 www-data www-data 699531 2011-02-05 18:10 drupal-7.0.fr.po
-rw-r--r-- 1 www-data www-data   9858 2011-02-05 18:19 entity-7.x-1.0-beta6.fr.po
-rw-r--r-- 1 www-data www-data  14746 2011-02-05 18:20 l10n_update-7.x-1.0-alpha3.fr.po
-rw-r--r-- 1 www-data www-data    585 2011-02-05 18:20 navigation404-7.x-1.0.fr.po
-rw-r--r-- 1 www-data www-data   5969 2011-02-05 18:20 rules-7.x-2.0-alpha4.fr.po
-rw-r--r-- 1 www-data www-data  43078 2011-02-05 18:21 views-7.x-3.0-alpha1.fr.po
-rw-r--r-- 1 www-data www-data  15194 2011-02-05 18:22 wysiwyg-7.x-2.0.fr.po

After the messages telling me that everything went successful with the downloading and importing of the new language, I navigated to Administration > Configuration and got the same filemtime() errors again, as in the original post.

Where is the file path (uri variable in the $source array) specified?
I see this code:

<?php
$source
->uri = $file->filename;
?>
, but this does not include the file path, if I understand correctly?
The function in question is:
<?php
function l10n_update_source_check_file($source, $directory = 'translations') {
 
$filename = '/'. preg_quote($source->filename) . '$/';
 
// Using the 'name' key will return
 
if ($files = drupal_system_listing($filename, $directory, 'name', 0)) {
   
$file = current($files);
   
$source->type = 'localfile';
   
$source->uri = $file->filename;
   
$source->timestamp = filemtime($file->filename);
    return
$file;
  }
}
?>

I'm really not qualified to find a solution for this, or even look at this code, but I will try to understand where the file path gets set.

Same problem here....

Assumption in #13 is correct. filename is only the filename without any path part. The change below worked for me to prevent the warning. BUT: The line above ($source->uri = $file->filename;) looks suspicious tome as well: assigning a filename (without path part) to a uri property while the $file object has a uri field itself...

Values during execution (only checking local):

$source Object of: stdClass
name (string:6) drupal
project_type (string:4) core
core (string:3) 7.x
version (string:3) 7.0
l10n_server (string:0)
l10n_path (string:75) http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.0.%language.po
status (string:1) 1
project (string:6) drupal
language (string:2) nl
filename (string:16) drupal-7.0.nl.po
$file Object of: stdClass
uri (string:29) translations/drupal-7.0.nl.po
filename (string:16) drupal-7.0.nl.po
name (string:13) drupal-7.0.nl

old code:

function l10n_update_source_check_file($source, $directory = 'translations') {
  $filename = '/'. preg_quote($source->filename) . '$/';
  // Using the 'name' key will return
  if ($files = drupal_system_listing($filename, $directory, 'name', 0)) {
    $file = current($files);
    $source->type = 'localfile';
    $source->uri = $file->filename;
    $source->timestamp = filemtime($file->filename);
    return $file;
  }
}

new code (prevents warning):

function l10n_update_source_check_file($source, $directory = 'translations') {
  $filename = '/'. preg_quote($source->filename) . '$/';
  // Using the 'name' key will return
  if ($files = drupal_system_listing($filename, $directory, 'name', 0)) {
    $file = current($files);
    $source->type = 'localfile';
    $source->uri = $file->filename;
    $source->timestamp = filemtime($file->uri);
    return $file;
  }
}

new code (should it be like this???):

function l10n_update_source_check_file($source, $directory = 'translations') {
  $filename = '/'. preg_quote($source->filename) . '$/';
  // Using the 'name' key will return
  if ($files = drupal_system_listing($filename, $directory, 'name', 0)) {
    $file = current($files);
    $source->type = 'localfile';
    $source->uri = $file->uri;
    $source->timestamp = filemtime($file->uri);
    return $file;
  }
}

Subscribing

Subscribing

Status:Postponed (maintainer needs more info)» Needs work

same problem here...

Verification of code correction proposed by post #17:

Change in file, 'l10n_update.check.inc' line 287,
from, "$source->uri = $file->filename;"
to, "$source->uri = $file->uri;"

No error reported at save. Translation of website successful.

Thank you fietserwin, module devs and Drupal community! YAY!

Status:Needs work» Needs review

Status:Needs review» Fixed
StatusFileSize
new582 bytes

Ok, looks like there is agreement that this change looks good. I'm committing this and will hopefully release yet another alpha with other fixes included soon (in a couple days).

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

When will a new alpha be released?

Status:Active» Closed (fixed)

I'd like to at least get the drush fixes in from #1057150: Rework drush l10n-update commands. Will try to set aside some time for this. Please leave this issue as fixed.

For people waiting to roll this fix out, the 7.x-1.0-beta1 version I just released includes it: http://drupal.org/node/1158904