-
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.
DEP Upgrade legue/flysystem to version 3.0 (#524)
- Loading branch information
1 parent
a730c06
commit a2733b9
Showing
26 changed files
with
225 additions
and
142 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
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,35 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Assets\Flysystem; | ||
|
||
use League\Flysystem\Filesystem as LeagueFilesystem; | ||
use League\Flysystem\FilesystemAdapter; | ||
use League\Flysystem\PathNormalizer; | ||
use League\Flysystem\WhitespacePathNormalizer; | ||
|
||
class Filesystem extends LeagueFilesystem | ||
{ | ||
private $adapter; | ||
|
||
public function __construct( | ||
FilesystemAdapter $adapter, | ||
array $config = [], | ||
PathNormalizer $pathNormalizer = null | ||
) { | ||
$this->adapter = $adapter; | ||
$this->pathNormalizer = $pathNormalizer ?: new WhitespacePathNormalizer(); | ||
parent::__construct($adapter, $config, $pathNormalizer); | ||
} | ||
|
||
public function getAdapter(): FilesystemAdapter | ||
{ | ||
return $this->adapter; | ||
} | ||
|
||
public function has(string $location): bool | ||
{ | ||
$path = $this->pathNormalizer->normalizePath($location); | ||
|
||
return strlen($path) === 0 ? false : ($this->getAdapter()->fileExists($path) || $this->getAdapter()->directoryExists($path)); | ||
} | ||
} |
Oops, something went wrong.