function l10n_update_source_check_file in Localization update 6
Same name and namespace in other branches
- 7.2 l10n_update.translation.inc \l10n_update_source_check_file()
- 7 l10n_update.check.inc \l10n_update_source_check_file()
Check whether we've got the file in the filesystem under 'translations'.
It will search, similar to modules and themes:
- translations
- sites/all/translations
- sites/mysite/translations
Using name as the key will return just the last one found.
Parameters
$source: Translation file object. The object will be updated with data of local file.
- 'type': Fixed value 'localfile'.
- 'filepath': File name and path.
- 'timestamp': Last updated time.
@see l10n_update_source_build()
$directory: Files directory.
Return value
Object File object (filename, basename, name) NULL if failure.
1 call to l10n_update_source_check_file()
- l10n_update_source_check in ./
l10n_update.check.inc - Check local and remote sources for the file.
File
- ./
l10n_update.check.inc, line 268 - Reusable API for l10n remote updates using $source objects
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->filepath = $file->filename;
$source->timestamp = filemtime($file->filename);
return $file;
}
}