aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-08-06 20:10:25 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-08-06 22:31:39 +0200
commit45428e49482b8c1916859fbe80564670fa51f8ff (patch)
tree4f30448487a473296866b83051a66de262571077 /lib
parent4fdd38c7378415c552859dc4c0d2dda709f699ec (diff)
downloadnextcloud-server-45428e49482b8c1916859fbe80564670fa51f8ff.tar.gz
nextcloud-server-45428e49482b8c1916859fbe80564670fa51f8ff.zip
Add config option to enable multibucket preview distribution
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php3
-rw-r--r--lib/private/Preview/Storage/Root.php18
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
index dba1dfc28e5..9bbb744bbcc 100644
--- a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
+++ b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
@@ -55,6 +55,9 @@ class ObjectStorePreviewCacheMountProvider implements IRootMountProvider {
if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) {
return [];
}
+ if ($this->config->getSystemValue('objectstore.multibucket.preview-distribution', false) !== true) {
+ return [];
+ }
$instanceId = $this->config->getSystemValueString('instanceid', '');
$mountPoints = [];
diff --git a/lib/private/Preview/Storage/Root.php b/lib/private/Preview/Storage/Root.php
index 37ae1758121..a284b037b35 100644
--- a/lib/private/Preview/Storage/Root.php
+++ b/lib/private/Preview/Storage/Root.php
@@ -32,23 +32,23 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFolder;
class Root extends AppData {
+ private $isMultibucketPreviewDistributionEnabled = false;
public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) {
parent::__construct($rootFolder, $systemConfig, 'preview');
+
+ $this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true;
}
public function getFolder(string $name): ISimpleFolder {
$internalFolder = $this->getInternalFolder($name);
- try {
- return parent::getFolder('old-multibucket/' . $internalFolder);
- } catch (NotFoundException $e) {
- // not in multibucket fallback #1
- }
- try {
- return parent::getFolder('old-multibucket/' . $name);
- } catch (NotFoundException $e) {
- // not in multibucket fallback #2
+ if ($this->isMultibucketPreviewDistributionEnabled) {
+ try {
+ return parent::getFolder('old-multibucket/' . $internalFolder);
+ } catch (NotFoundException $e) {
+ // not in multibucket fallback
+ }
}
try {