Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
3cb53b77
Commit
3cb53b77
authored
Apr 01, 2015
by
Robin Appelman
Browse files
setup storage wrappers before setting up the filesystem
parent
0af2dc7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/files_trashbin/lib/trashbin.php
View file @
3cb53b77
...
...
@@ -957,7 +957,7 @@ class Trashbin {
*/
public
static
function
registerHooks
()
{
// create storage wrapper on setup
\
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'
s
etup'
,
'OCA\Files_Trashbin\Storage'
,
'setupStorage'
);
\
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'
preS
etup'
,
'OCA\Files_Trashbin\Storage'
,
'setupStorage'
);
//Listen to delete user signal
\
OCP\Util
::
connectHook
(
'OC_User'
,
'pre_deleteUser'
,
'OCA\Files_Trashbin\Hooks'
,
'deleteUser_hook'
);
//Listen to post write hook
...
...
lib/private/util.php
View file @
3cb53b77
...
...
@@ -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'
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment