[6.x] Add $unique parameter to Asset::move()#14236
Open
lwekuiper wants to merge 1 commit intostatamic:6.xfrom
Open
[6.x] Add $unique parameter to Asset::move()#14236lwekuiper wants to merge 1 commit intostatamic:6.xfrom
lwekuiper wants to merge 1 commit intostatamic:6.xfrom
Conversation
Add $unique parameter to move() for parity with rename(). When true, ensureUniqueFilename() generates a collision-free name in the target folder. Simplify rename() to delegate uniqueness logic to move().
jasonvarga
requested changes
Mar 12, 2026
Member
jasonvarga
left a comment
There was a problem hiding this comment.
Adding a new argument is a breaking change.
Either target master so this will be in v7 (but there is no planned release for a while).
Or, make this change in a non-breaking way. Maybe you could create a moveUnique method that checks uniqueness then calls move. It could be marked as deprecated with the intention of making the breaking change in v7.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Asset::rename($filename, $unique = false)supports automatic unique filename generation viaensureUniqueFilename(), butAsset::move($folder, $filename)does not. When moving an asset to a folder where a filename collision exists, developers must implement their own uniqueness logic.This PR adds the same
$uniqueparameter tomove()for parity withrename(), and simplifiesrename()to delegate its uniqueness logic tomove().Changes
Asset::move($folder, $filename, $unique)— new optional$uniqueparameter. Whentrue, callsensureUniqueFilename()before building the new path.Asset::rename()— simplified to delegate uniqueness tomove()instead of handling it directly.Asset::moveQuietly()— no changes needed, already usesfunc_get_args().