You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #15458 [Filesystem] Add feature to create hardlinks for files (andrerom)
This PR was submitted for the 2.8 branch but it was merged into the 3.2-dev branch instead (closes#15458).
Discussion
----------
[Filesystem] Add feature to create hardlinks for files
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Todo:
- [x] Tests
- [ ] Doc
- [x] Getting someone to test on Windows as exception might differ from symlink functionality
## Why
Symlinks are good for directories, but for files hardlinks are sometime a better match when needing to represent same file in several locations.
One use case for this feature is for multi tagging of Http Cache when running against FileSystem. Multi tagging is used in FoSHttpCache and supported when running Varnish, but not with Symfony HTTPCache, yet.. With hardlinks combined with meta information containing tags within the file, lookup and reverse lookup is thus easily possible.
## What
Introduces method `hardlink()` with similar behavior as `symlink`, difference being:
- Allowing several targets to be provided to match use case in 'why'
- Like `symlink` removes existing target if not the same, but uses `fileinode` to compare target & source
Commits
-------
8475002 [Filesystem] Add feature to create hardlinks for files
thrownewIOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
thrownewIOException(sprintf('Unable to create %s link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
338
381
}
339
-
thrownewIOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
340
382
}
383
+
thrownewIOException(sprintf('Failed to create %s link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target);
0 commit comments