Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Translation] remove deprecated features #22879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Translation] remove deprecated features
  • Loading branch information
xabbuh committed May 23, 2017
commit 3a03de0787b07b0af046a65f19eb867ca5c53030
5 changes: 5 additions & 0 deletions 5 src/Symfony/Component/Translation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.0.0
-----

* removed the backup feature of the `FileDumper` class

3.2.0
-----

Expand Down
23 changes: 7 additions & 16 deletions 23 src/Symfony/Component/Translation/Dumper/FileDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

/**
* FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s).
* Performs backup of already existing files.
*
* Options:
* - path (mandatory): the directory where the files should be saved
Expand All @@ -33,13 +32,6 @@ abstract class FileDumper implements DumperInterface
*/
protected $relativePathTemplate = '%domain%.%locale%.%extension%';

/**
* Make file backup before the dump.
*
* @var bool
*/
private $backup = true;

/**
* Sets the template for the relative paths to files.
*
Expand All @@ -57,7 +49,12 @@ public function setRelativePathTemplate($relativePathTemplate)
*/
public function setBackup($backup)
{
$this->backup = $backup;
if (false !== $backup) {
throw new \LogicException('The backup feature is no longer supported.');
}

// the method is only present to not break BC
// to be deprecated in 4.1
}

/**
Expand All @@ -71,14 +68,8 @@ public function dump(MessageCatalogue $messages, $options = array())

// save a file for each domain
foreach ($messages->getDomains() as $domain) {
// backup
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
if (file_exists($fullpath)) {
if ($this->backup) {
@trigger_error('Creating a backup while dumping a message catalogue is deprecated since version 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', E_USER_DEPRECATED);
copy($fullpath, $fullpath.'~');
}
} else {
if (!file_exists($fullpath)) {
$directory = dirname($fullpath);
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
Expand Down
23 changes: 0 additions & 23 deletions 23 src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,6 @@ public function testDump()
$this->assertFileExists($tempDir.'/messages.en.concrete');
}

/**
* @group legacy
*/
public function testDumpBackupsFileIfExisting()
{
$tempDir = sys_get_temp_dir();
$file = $tempDir.'/messages.en.concrete';
$backupFile = $file.'~';

@touch($file);

$catalogue = new MessageCatalogue('en');
$catalogue->add(array('foo' => 'bar'));

$dumper = new ConcreteFileDumper();
$dumper->dump($catalogue, array('path' => $tempDir));

$this->assertFileExists($backupFile);

@unlink($file);
@unlink($backupFile);
}

public function testDumpCreatesNestedDirectoriesAndFile()
{
$tempDir = sys_get_temp_dir();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function addDumper($format, DumperInterface $dumper)
*/
public function disableBackup()
{
// to be deprecated in 4.1
foreach ($this->dumpers as $dumper) {
if (method_exists($dumper, 'setBackup')) {
$dumper->setBackup(false);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.