Permalink
Browse files

Add md5 of repositories to TMX filename (fixes #841) (#846)

  • Loading branch information...
flodolo committed Feb 1, 2017
1 parent 1de6a80 commit 816fd1c2e653710eb9ed2a8582d9fdf2ae5b76f0
Showing with 9 additions and 10 deletions.
  1. +8 −9 app/models/tmx_downloading.php
  2. +1 −1 app/views/tmx_downloading.php
@@ -5,8 +5,10 @@
$missing_repos_count = $repos_count = 0;
$strings = ['en-US' => [], $locale => []];
$requested_repositories = '';
foreach ($repos as $repo) {
if (isset($_GET[$repo])) {
$requested_repositories .= $repo;
$cache_file_english = Utils::getRepoStrings(Project::getReferenceLocale($repo), $repo);
if ($cache_file_english) {
@@ -47,16 +49,13 @@ function ($e) {
$empty_TMX = $repos_count == 0;
// Generate the TMX file
$content = $check['tmx_format'] == 'normal'
? TMX::create($strings, $locale, 'en-US')
: TMX::createOmegat($strings, $locale, 'en-US');
if ($check['tmx_format'] == 'normal') {
$content = TMX::create($strings, $locale, 'en-US');
$target_file = 'mozilla_en-US_' . $locale . '.tmx';
} else {
$content = TMX::createOmegat($strings, $locale, 'en-US');
$target_file = 'mozilla_en-US_' . $locale . '_forOmegaT.tmx';
}
$target_file_path = WEB_ROOT . 'download/' . $target_file;
$tmx_id = md5($requested_repositories);
$target_file_name = "mozilla_en-US_{$locale}_{$tmx_id}_{$check['tmx_format']}.tmx";
$target_file_path = WEB_ROOT . "download/{$target_file_name}";
unset($strings);
@@ -25,7 +25,7 @@
<span id="download">
<?php
if (!$empty_TMX) {
echo '<a class="button" href="/download/' . $target_file . '">Download</a> or ';
echo '<a class="button" href="/download/' . $target_file_name . '">Download</a> or ';
}
?>
<a href="/downloads">Go back to TMX creation page</a>

0 comments on commit 816fd1c

Please sign in to comment.