@@ -32,56 +32,56 @@ |
||
| 32 | 32 | use OCP\Files\SimpleFS\ISimpleFolder; |
| 33 | 33 | |
| 34 | 34 | class Root extends AppData { |
| 35 | - private $isMultibucketPreviewDistributionEnabled = false; |
|
| 36 | - public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) { |
|
| 37 | - parent::__construct($rootFolder, $systemConfig, 'preview'); |
|
| 35 | + private $isMultibucketPreviewDistributionEnabled = false; |
|
| 36 | + public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) { |
|
| 37 | + parent::__construct($rootFolder, $systemConfig, 'preview'); |
|
| 38 | 38 | |
| 39 | - $this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true; |
|
| 40 | - } |
|
| 39 | + $this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - public function getFolder(string $name): ISimpleFolder { |
|
| 44 | - $internalFolder = self::getInternalFolder($name); |
|
| 43 | + public function getFolder(string $name): ISimpleFolder { |
|
| 44 | + $internalFolder = self::getInternalFolder($name); |
|
| 45 | 45 | |
| 46 | - try { |
|
| 47 | - return parent::getFolder($internalFolder); |
|
| 48 | - } catch (NotFoundException $e) { |
|
| 49 | - /* |
|
| 46 | + try { |
|
| 47 | + return parent::getFolder($internalFolder); |
|
| 48 | + } catch (NotFoundException $e) { |
|
| 49 | + /* |
|
| 50 | 50 | * The new folder structure is not found. |
| 51 | 51 | * Lets try the old one |
| 52 | 52 | */ |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - try { |
|
| 56 | - return parent::getFolder($name); |
|
| 57 | - } catch (NotFoundException $e) { |
|
| 58 | - /* |
|
| 55 | + try { |
|
| 56 | + return parent::getFolder($name); |
|
| 57 | + } catch (NotFoundException $e) { |
|
| 58 | + /* |
|
| 59 | 59 | * The old folder structure is not found. |
| 60 | 60 | * Lets try the multibucket fallback if available |
| 61 | 61 | */ |
| 62 | - if ($this->isMultibucketPreviewDistributionEnabled) { |
|
| 63 | - return parent::getFolder('old-multibucket/' . $internalFolder); |
|
| 64 | - } |
|
| 62 | + if ($this->isMultibucketPreviewDistributionEnabled) { |
|
| 63 | + return parent::getFolder('old-multibucket/' . $internalFolder); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - // when there is no further fallback just throw the exception |
|
| 67 | - throw $e; |
|
| 68 | - } |
|
| 69 | - } |
|
| 66 | + // when there is no further fallback just throw the exception |
|
| 67 | + throw $e; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function newFolder(string $name): ISimpleFolder { |
|
| 72 | - $internalFolder = self::getInternalFolder($name); |
|
| 73 | - return parent::newFolder($internalFolder); |
|
| 74 | - } |
|
| 71 | + public function newFolder(string $name): ISimpleFolder { |
|
| 72 | + $internalFolder = self::getInternalFolder($name); |
|
| 73 | + return parent::newFolder($internalFolder); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /* |
|
| 76 | + /* |
|
| 77 | 77 | * Do not allow directory listing on this special root |
| 78 | 78 | * since it gets to big and time consuming |
| 79 | 79 | */ |
| 80 | - public function getDirectoryListing(): array { |
|
| 81 | - return []; |
|
| 82 | - } |
|
| 80 | + public function getDirectoryListing(): array { |
|
| 81 | + return []; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - public static function getInternalFolder(string $name): string { |
|
| 85 | - return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name; |
|
| 86 | - } |
|
| 84 | + public static function getInternalFolder(string $name): string { |
|
| 85 | + return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name; |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * Lets try the multibucket fallback if available |
| 61 | 61 | */ |
| 62 | 62 | if ($this->isMultibucketPreviewDistributionEnabled) { |
| 63 | - return parent::getFolder('old-multibucket/' . $internalFolder); |
|
| 63 | + return parent::getFolder('old-multibucket/'.$internalFolder); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // when there is no further fallback just throw the exception |
@@ -82,6 +82,6 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public static function getInternalFolder(string $name): string { |
| 85 | - return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name; |
|
| 85 | + return implode('/', str_split(substr(md5($name), 0, 7))).'/'.$name; |
|
| 86 | 86 | } |
| 87 | 87 | } |