summaryrefslogtreecommitdiffstats
path: root/lib/private/util.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-04-01 17:12:06 +0200
committerRobin Appelman <icewind@owncloud.com>2015-04-01 17:12:06 +0200
commit3cb53b7756155a5e6208fee48da0ecbab8f19815 (patch)
tree0fa051b25db2a88205e15dc2bceb0e53025fd2f8 /lib/private/util.php
parent0af2dc7d3775f5d40cdfd3fe0cd4325abd6ce40d (diff)
downloadnextcloud-server-3cb53b7756155a5e6208fee48da0ecbab8f19815.tar.gz
nextcloud-server-3cb53b7756155a5e6208fee48da0ecbab8f19815.zip
setup storage wrappers before setting up the filesystem
Diffstat (limited to 'lib/private/util.php')
-rw-r--r--lib/private/util.php62
1 files changed, 33 insertions, 29 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index e423bb6a7df..9e70e3ca35f 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -133,6 +133,39 @@ class OC_Util {
self::$fsSetup = true;
}
+ \OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
+ if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) {
+ /** @var \OC\Files\Storage\Common $storage */
+ $storage->setMountOptions($mount->getOptions());
+ }
+ return $storage;
+ });
+
+ \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
+ // set up quota for home storages, even for other users
+ // which can happen when using sharing
+
+ /**
+ * @var \OC\Files\Storage\Storage $storage
+ */
+ if ($storage->instanceOfStorage('\OC\Files\Storage\Home')
+ || $storage->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')
+ ) {
+ /** @var \OC\Files\Storage\Home $storage */
+ if (is_object($storage->getUser())) {
+ $user = $storage->getUser()->getUID();
+ $quota = OC_Util::getUserQuota($user);
+ if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
+ return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
+ }
+ }
+ }
+
+ return $storage;
+ });
+
+ OC_Hook::emit('OC_Filesystem', 'preSetup', array('user' => $user));
+
//check if we are using an object storage
$objectStore = OC_Config::getValue('objectstore');
if (isset($objectStore)) {
@@ -146,37 +179,8 @@ class OC_Util {
return false;
}
- \OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
- if($storage->instanceOfStorage('\OC\Files\Storage\Common')) {
- /** @var \OC\Files\Storage\Common $storage */
- $storage->setMountOptions($mount->getOptions());
- }
- return $storage;
- });
-
//if we aren't logged in, there is no use to set up the filesystem
if ($user != "") {
- \OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
- // set up quota for home storages, even for other users
- // which can happen when using sharing
-
- /**
- * @var \OC\Files\Storage\Storage $storage
- */
- if ($storage->instanceOfStorage('\OC\Files\Storage\Home')
- || $storage->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')
- ) {
- if (is_object($storage->getUser())) {
- $user = $storage->getUser()->getUID();
- $quota = OC_Util::getUserQuota($user);
- if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
- return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
- }
- }
- }
-
- return $storage;
- });
$userDir = '/' . $user . '/files';