Commit f13ddf37 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge "Bug 1834544: Allow sync to be ignored if upstream file hasn't changed"

parents 4a5ce96d 9da2f4ed
......@@ -131,15 +131,32 @@ foreach ($langpacks as $lang) {
array(
CURLOPT_URL => $langurl,
CURLOPT_HEADER => false,
CURLOPT_FILETIME => true,
),
true
);
// Check to see if we can get the upstream's filetime
// and ignore updating language if file hasn't changed
if (isset($checklang->info['filetime']) && $checklang->info['filetime'] > 0) {
$filetime = $checklang->info['filetime'];
if (file_exists($tmpdir . '/' . $filename)) {
$localfiletime = filemtime($tmpdir . '/' . $filename);
if ($localfiletime == $filetime) {
$cli->cli_print(get_string('cli_langpack_ignore', 'admin', $filename));
continue;
}
}
}
else {
$filetime = time();
}
if ($checklang->info['http_code'] != '200') {
$cli->cli_print(get_string('cli_langpack_url_failed', 'admin', $lang, $checklang->info['http_code']));
continue;
}
$file = $checklang->data;
file_put_contents($tmpdir . '/' . $filename, $file);
touch($tmpdir . '/' . $filename, $filetime);
$cli->cli_print(get_string('cli_langpack_upload', 'admin', $filename));
// if we need to make a backup - do it now
if ($dobackup) {
......
......@@ -1348,6 +1348,7 @@ $string['cli_langpack_backup_failed'] = '*** WARNING *** Unable to make backup o
$string['cli_langpack_en'] = 'You do not need to update the English langpack as the strings are defined in Mahara itself. You can set special lang strings in local/lang/.';
$string['cli_langpack_extract_done'] = 'Copied new "%s" langpack into place';
$string['cli_langpack_extract_failed'] = '*** WARNING *** Unable to extract files from "%s". Reason: %s';
$string['cli_langpack_ignore'] = 'Langpack "%s" is already current so will skip updating';
$string['cli_langpack_info'] = 'To update your language packs via the command line.
You can:
1) Install or update langpacks by listing the languages by their code, e.g. de = German, fr = French:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment