-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW Use natural paths for public files to support permalinks (#223)
* NEW Use natural paths for public files to support permalinks. * API Define a FileResolutionStrategy, FileIDHelper and ParsedFileID API.
- Loading branch information
1 parent
7b0f1e2
commit bb0ae72
Showing
38 changed files
with
4,083 additions
and
571 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Assets\FilenameParsing; | ||
|
||
/** | ||
* Helps build and parse Filename Identifiers (ake: FileIDs) according to a predefined format. | ||
* | ||
* @internal This is still an evolving API. It may change in the next minor release. | ||
*/ | ||
interface FileIDHelper | ||
{ | ||
|
||
/** | ||
* Map file tuple (hash, name, variant) to a filename to be used by flysystem | ||
* | ||
* @param string|ParsedFileID $filename Name of file or ParsedFileID object | ||
* @param string $hash Hash of original file | ||
* @param string $variant (if given) | ||
* @return string Adapter specific identifier for this file/version | ||
*/ | ||
public function buildFileID($filename, $hash = null, $variant = null); | ||
|
||
|
||
/** | ||
* Clean up filename to remove constructs that might clash with the underlying path format of this FileIDHelper. | ||
* | ||
* @param string $filename | ||
* @return string | ||
*/ | ||
public function cleanFilename($filename); | ||
|
||
/** | ||
* Get Filename, Variant and Hash from a fileID. If a FileID can not be parsed, returns `null`. | ||
* | ||
* @param string $fileID | ||
* @return ParsedFileID|null | ||
*/ | ||
public function parseFileID($fileID); | ||
|
||
/** | ||
* Determine if the provided fileID is a variant of `$parsedFileID`. | ||
* @param string $fileID | ||
* @param ParsedFileID $parsedFileID | ||
* @return boolean | ||
*/ | ||
public function isVariantOf($fileID, ParsedFileID $parsedFileID); | ||
|
||
/** | ||
* Compute the relative path where variants of the provided parsed file ID are expected to be stored. | ||
* | ||
* @param ParsedFileID $parsedFileID | ||
* @return string | ||
*/ | ||
public function lookForVariantIn(ParsedFileID $parsedFileID); | ||
} |
Oops, something went wrong.