Revision 620f9137
Added by Assos Assos over 4 years ago
drupal7/sites/all/modules/l10n_update/l10n_update.project.inc | ||
---|---|---|
47 | 47 |
|
48 | 48 |
$default_server = l10n_update_default_server(); |
49 | 49 |
|
50 |
if (module_exists('update')) { |
|
51 |
$projects_info = update_get_available(TRUE); |
|
52 |
} |
|
53 | 50 |
foreach ($projects as $name => $data) { |
54 |
|
|
55 |
// Force update fetch of project data in cases where Drupal's performance |
|
56 |
// optimized approach is missing out on some projects. |
|
57 |
// @see http://drupal.org/node/1671570#comment-6216090 |
|
58 |
if (module_exists('update') && !isset($projects_info[$name])) { |
|
59 |
module_load_include('fetch.inc', 'update'); |
|
60 |
_update_process_fetch_task($data); |
|
61 |
$available = _update_get_cached_available_releases(); |
|
62 |
if (!empty($available[$name])) { |
|
63 |
$projects_info[$name] = $available[$name]; |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
if (isset($projects_info[$name]['releases']) && $projects_info[$name]['project_status'] != 'not-fetched') { |
|
68 |
// Find out if a dev version is installed. |
|
69 |
if (preg_match("/^[0-9]+\.x-([0-9]+)\..*-dev$/", $data['info']['version'], $matches)) { |
|
70 |
// Find a suitable release to use as alternative translation. |
|
71 |
foreach ($projects_info[$name]['releases'] as $project_release) { |
|
72 |
// The first release with the same major release number which is not |
|
73 |
// a dev release is the one. Releases are sorted the most recent first. |
|
74 |
if ($project_release['version_major'] == $matches[1] && |
|
75 |
(!isset($project_release['version_extra']) || $project_release['version_extra'] != 'dev')) { |
|
76 |
$release = $project_release; |
|
77 |
break; |
|
78 |
} |
|
79 |
} |
|
51 |
// For dev releases, remove the '-dev' part and trust the translation server |
|
52 |
// to fall back to the latest stable release for that branch. |
|
53 |
if (isset($data['info']['version']) && strpos($data['info']['version'], '-dev')) { |
|
54 |
if (preg_match("/^(\d+\.x-\d+\.).*$/", $data['info']['version'], $matches)) { |
|
55 |
// Example matches: 7.x-1.x-dev, 7.x-1.0-alpha1+5-dev => 7.x-1.x |
|
56 |
$data['info']['version'] = $matches[1] . 'x'; |
|
80 | 57 |
} |
81 |
if (!empty($release['version'])) { |
|
82 |
$data['info']['version'] = $release['version']; |
|
58 |
elseif (preg_match("/^(\d+\.).*$/", $data['info']['version'], $matches)) { |
|
59 |
// Example match: 7.33-dev => 7.x (Drupal core) |
|
60 |
$data['info']['version'] = $matches[1] . 'x'; |
|
83 | 61 |
} |
84 |
|
|
85 |
unset($release); |
|
86 | 62 |
} |
87 | 63 |
|
88 | 64 |
$data += array( |
... | ... | |
228 | 204 |
'name' => $project_name, |
229 | 205 |
'info' => $file->info, |
230 | 206 |
'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0, |
231 |
'includes' => array($file->name => $file->info['name']),
|
|
207 |
'includes' => array($file->name => isset($file->info['name']) ? $file->info['name'] : $file->name),
|
|
232 | 208 |
'project_type' => $project_name == 'drupal' ? 'core' : $project_type, |
233 | 209 |
); |
234 | 210 |
} |
Also available in: Unified diff
Weekly update of contrib modules