GettextTranslationHelper: Don't create backup files and cleanup temporary files

fixes #2683

(cherry picked from commit 2f8d4739b88a743da45ed95ce05669f5028e42b4)
Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
This commit is contained in:
Johannes Meyer 2017-01-24 16:04:17 +01:00 committed by Eric Lippmann
parent b06262e824
commit 59741ef993

View File

@ -121,6 +121,20 @@ class GettextTranslationHelper
$this->locale = $locale;
}
/**
* Cleanup temporary files
*/
public function __destruct()
{
if ($this->catalogPath !== null && file_exists($this->catalogPath)) {
unlink($this->catalogPath);
}
if ($this->templatePath !== null && file_exists($this->templatePath)) {
unlink($this->templatePath);
}
}
/**
* Get the config
*
@ -251,7 +265,7 @@ class GettextTranslationHelper
{
if (is_file($this->tablePath)) {
shell_exec(sprintf(
'%s --update %s %s 2>&1',
'%s --update --backup=none %s %s 2>&1',
$this->getConfig()->get('translation', 'msgmerge', '/usr/bin/env msgmerge'),
$this->tablePath,
$this->templatePath