Do not call wrapStorage if storate with same name added twice
This commit is contained in:
parent
ff5715779c
commit
6fb553e92c
3 changed files with 12 additions and 1 deletions
|
@ -175,7 +175,10 @@ class Filesystem {
|
|||
* @param callable $wrapper
|
||||
*/
|
||||
public static function addStorageWrapper($wrapperName, $wrapper) {
|
||||
self::getLoader()->addStorageWrapper($wrapperName, $wrapper);
|
||||
if (!self::getLoader()->addStorageWrapper($wrapperName, $wrapper)) {
|
||||
// do not re-wrap if storage with this name already existed
|
||||
return;
|
||||
}
|
||||
|
||||
$mounts = self::getMountManager()->getAll();
|
||||
foreach ($mounts as $mount) {
|
||||
|
|
|
@ -23,9 +23,15 @@ class StorageFactory implements IStorageFactory {
|
|||
*
|
||||
* @param string $wrapperName
|
||||
* @param callable $callback
|
||||
* @return true if the wrapper was added, false if there was already a wrapper with this
|
||||
* name registered
|
||||
*/
|
||||
public function addStorageWrapper($wrapperName, $callback) {
|
||||
if (isset($this->storageWrappers[$wrapperName])) {
|
||||
return false;
|
||||
}
|
||||
$this->storageWrappers[$wrapperName] = $callback;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,8 @@ interface IStorageFactory {
|
|||
*
|
||||
* @param string $wrapperName
|
||||
* @param callable $callback
|
||||
* @return true if the wrapper was added, false if there was already a wrapper with this
|
||||
* name registered
|
||||
*/
|
||||
public function addStorageWrapper($wrapperName, $callback);
|
||||
|
||||
|
|
Loading…
Reference in a new issue