Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Filesystem] Made sure Filesystem::dumpFile() overwrites an existing file#7820

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromjakzal:filesystem-dump-file
Apr 24, 2013

Conversation

jakzal
Copy link
Contributor

#7753 introduced a change in behaviour. Before, ConfigCache simply used therename() function to save a file. It was replaced byFilesystem::dumpFile() which internally usesFilesystem::rename(). The later checks if file already exists and throws an exception if it exists.

This PR makes sure thatFilesystem::dumpFile() removes the file before creating a new one.

Alternatively, we could introduce a third parameter to theFilesystem::rename() which would allow to overwrite the target file.

Before#7752:

After#7752:

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#7816
LicenseMIT
Doc PR~

@mpdude
Copy link
Contributor

I'd be for the third param ($overwrite = false) for rename if@fabpot accepts that. So we still get the check for success and it might be useful for others too.

Thanks!

@jakzal
Copy link
ContributorAuthor

@fabpot are you fine with adding an optional parameter toFilesystem::rename()? If set to true it would prevent "file already exists" exception.

@fabpot
Copy link
Member

@jakzal adding an opt arg looks good to me.

@jakzal
Copy link
ContributorAuthor

Ok. PR updated.

fabpot added a commit that referenced this pull requestApr 24, 2013
This PR was merged into the master branch.Discussion----------[Filesystem] Made sure Filesystem::dumpFile() overwrites an existing file#7753 introduced a change in behaviour. Before, ConfigCache simply used the ``rename()`` function to save a file. It was replaced by ``Filesystem::dumpFile()`` which internally uses ``Filesystem::rename()``. The later checks if file already exists and throws an exception if it exists.This PR makes sure that ``Filesystem::dumpFile()`` removes the file before creating a new one.Alternatively, we could introduce a third parameter to the ``Filesystem::rename()`` which would allow to overwrite the target file.Before#7752:* [CompilerDebugDumpPass](https://github.com/symfony/symfony/blob/d100ffaf761b46acdb2440c04602378b87b0d610/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php#L23) uses ConfigCache* [ConfigCache](https://github.com/symfony/symfony/blob/d100ffaf761b46acdb2440c04602378b87b0d610/src/Symfony/Component/Config/ConfigCache.php#L103) uses the [rename()](http://uk1.php.net/rename) function (which overwrites a file if it exists)After#7752:* [CompilerDebugDumpPass](https://github.com/symfony/symfony/blob/ad47bc47380188041b7889f40e380ad3766a0110/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php#L23) uses the ``Filesystem::dumpFile()``* [Filesystem::dumpFile()](https://github.com/webfactory/symfony/blob/ad47bc47380188041b7889f40e380ad3766a0110/src/Symfony/Component/Filesystem/Filesystem.php#L458) uses the [Filesystem::rename()](https://github.com/webfactory/symfony/blob/ad47bc47380188041b7889f40e380ad3766a0110/src/Symfony/Component/Filesystem/Filesystem.php#L239) (which throws an exception if file exists)| Q | A| ------------- | ---| Bug fix?| yes| New feature?| no| BC breaks?| no| Deprecations?| no| Tests pass?| yes| Fixed tickets|#7816| License | MIT| Doc PR| ~Commits-------4f4ec76 [Filesystem] Made sure Filesystem::dumpFile() overwrites an existing file.
@fabpotfabpot closed thisApr 24, 2013
@fabpotfabpot merged commit4f4ec76 intosymfony:masterApr 24, 2013
@jakzaljakzal deleted the filesystem-dump-file branchApril 24, 2013 09:30
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@jakzal@mpdude@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp