merged branch clemens-tolboom/filedumper-backup (PR #4302)

Commits
-------

189874d FileDumper does no backup.

Discussion
----------

FileDumper does no backup.

Backup check path missed a '/'. So no backup was made.

Removed the repeating path construction by replacing it by new variable.

---------------------------------------------------------------------------

by travisbot at 2012-05-16T14:14:58Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1345963) (merged 189874d0 into 5314836d).
This commit is contained in:
Fabien Potencier 2012-05-17 20:41:02 +02:00
commit e351c9f0a8

View File

@ -37,11 +37,12 @@ abstract class FileDumper implements DumperInterface
foreach ($messages->getDomains() as $domain) {
$file = $domain.'.'.$messages->getLocale().'.'.$this->getExtension();
// backup
if (file_exists($options['path'].$file)) {
copy($options['path'].$file, $options['path'].'/'.$file.'~');
$fullpath = $options['path'].'/'.$file;
if (file_exists($fullpath)) {
copy($fullpath, $fullpath.'~');
}
// save file
file_put_contents($options['path'].'/'.$file, $this->format($messages, $domain));
file_put_contents($fullpath, $this->format($messages, $domain));
}
}