Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ public function __construct($webRoot, \OC\Config $config) {
$c->getConfig(),
$c->getThemingDefaults(),
\OC::$SERVERROOT,
$cacheFactory->createLocal('SCSS')
$cacheFactory->create('SCSS')
);
});
$this->registerService(EventDispatcher::class, function () {
Expand Down
47 changes: 46 additions & 1 deletion lib/private/legacy/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,46 @@ private static function initObjectStoreRootFS($config) {
}
}

/**
* mounting an object storage as the root fs will in essence remove the
* necessity of a data folder being present.
*
* @param array $config containing 'class' and optional 'arguments'
*/
private static function initObjectStoreMultibucketRootFS($config) {
// check misconfiguration
if (empty($config['class'])) {
\OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR);
}
if (!isset($config['arguments'])) {
$config['arguments'] = array();
}

// instantiate object store implementation
$name = $config['class'];
if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) {
$segments = explode('\\', $name);
OC_App::loadApp(strtolower($segments[1]));
}

if (!isset($config['arguments']['bucket'])) {
$config['arguments']['bucket'] = '';
}
// put the root FS always in first bucket for multibucket configuration
$config['arguments']['bucket'] .= '0';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically a copy of initObjectStoreRootFS() only the 5 lines above this comment are added.


$config['arguments']['objectstore'] = new $config['class']($config['arguments']);
// mount with plain / root object store implementation
$config['class'] = '\OC\Files\ObjectStore\ObjectStoreStorage';

// mount object storage as root
\OC\Files\Filesystem::initMountManager();
if (!self::$rootMounted) {
\OC\Files\Filesystem::mount($config['class'], $config['arguments'], '/');
self::$rootMounted = true;
}
}

/**
* Can be set up
*
Expand Down Expand Up @@ -215,7 +255,12 @@ public static function setupFS($user = '') {

//check if we are using an object storage
$objectStore = \OC::$server->getSystemConfig()->getValue('objectstore', null);
if (isset($objectStore)) {
$objectStoreMultibucket = \OC::$server->getSystemConfig()->getValue('objectstore_multibucket', null);

// use the same order as in ObjectHomeMountProvider
if (isset($objectStoreMultibucket)) {
self::initObjectStoreMultibucketRootFS($objectStoreMultibucket);
} elseif (isset($objectStore)) {
self::initObjectStoreRootFS($objectStore);
} else {
self::initLocalStorageRootFS();
Expand Down