Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
3c66a8c8
Commit
3c66a8c8
authored
10 years ago
by
Jörn Friedrich Dreyer
Browse files
Options
Downloads
Patches
Plain Diff
allow configuring objectstore as home and root storage
parent
a921ad89
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/files/filesystem.php
+13
-4
13 additions, 4 deletions
lib/private/files/filesystem.php
lib/private/util.php
+42
-7
42 additions, 7 deletions
lib/private/util.php
with
55 additions
and
11 deletions
lib/private/files/filesystem.php
+
13
−
4
View file @
3c66a8c8
...
...
@@ -325,13 +325,22 @@ class Filesystem {
$userObject
=
\OC_User
::
getManager
()
->
get
(
$user
);
if
(
!
is_null
(
$userObject
))
{
$homeStorage
=
\OC_Config
::
getValue
(
'home_storage'
,
array
(
'class'
=>
'\OC\Files\Storage\Home'
,
'arguments'
=>
array
()
));
if
(
empty
(
$config
[
'class'
]))
{
//FIXME log error? or fallback to '\OC\Files\Storage\Home'?
}
if
(
!
isset
(
$config
[
'arguments'
]))
{
$config
[
'arguments'
]
=
array
();
}
$homeStorage
[
'arguments'
][
'user'
]
=
$userObject
;
// check for legacy home id (<= 5.0.12)
if
(
\OC\Files\Cache\Storage
::
exists
(
'local::'
.
$root
.
'/'
))
{
self
::
mount
(
'\OC\Files\Storage\Home'
,
array
(
'user'
=>
$userObject
,
'legacy'
=>
true
),
$user
);
}
else
{
self
::
mount
(
'\OC\Files\Storage\Home'
,
array
(
'user'
=>
$userObject
),
$user
);
$homeStorage
[
'arguments'
][
'legacy'
]
=
true
;
}
self
::
mount
(
$homeStorage
[
'class'
],
$homeStorage
[
'arguments'
],
$user
);
}
else
{
self
::
mount
(
'\OC\Files\Storage\Local'
,
array
(
'datadir'
=>
$root
),
$user
);
...
...
This diff is collapsed.
Click to expand it.
lib/private/util.php
+
42
−
7
View file @
3c66a8c8
...
...
@@ -12,6 +12,39 @@ class OC_Util {
private
static
$rootMounted
=
false
;
private
static
$fsSetup
=
false
;
private
static
function
initLocalStorageRootFS
()
{
// mount local file backend as root
$configDataDirectory
=
OC_Config
::
getValue
(
"datadirectory"
,
OC
::
$SERVERROOT
.
"/data"
);
//first set up the local "root" storage
\OC\Files\Filesystem
::
initMounts
();
if
(
!
self
::
$rootMounted
)
{
\OC\Files\Filesystem
::
mount
(
'\OC\Files\Storage\Local'
,
array
(
'datadir'
=>
$configDataDirectory
),
'/'
);
self
::
$rootMounted
=
true
;
}
}
/**
* mounting an object storage as the root fs will in essence remove the
* necessity of a data folder being present.
* TODO make home storage aware of this and use the object storage instead of local disk access
* @param array $config containing 'class' and optional 'arguments'
*/
private
static
function
initObjectStorageRootFS
(
$config
)
{
// check misconfiguration
if
(
empty
(
$config
[
'class'
]))
{
//FIXME log error?
}
if
(
!
isset
(
$config
[
'arguments'
]))
{
$config
[
'arguments'
]
=
array
();
}
// mount object storage as root
\OC\Files\Filesystem
::
initMounts
();
if
(
!
self
::
$rootMounted
)
{
\OC\Files\Filesystem
::
mount
(
$config
[
'class'
],
$config
[
'arguments'
],
'/'
);
self
::
$rootMounted
=
true
;
}
}
/**
* Can be set up
* @param string $user
...
...
@@ -39,12 +72,12 @@ class OC_Util {
self
::
$fsSetup
=
true
;
}
$configDataDirectory
=
OC_Config
::
getValue
(
"datadirectory"
,
OC
::
$SERVERROOT
.
"/data"
);
//first set up the local "root"
storage
\OC\Files\Filesystem
::
initMounts
();
if
(
!
self
::
$rootMounted
)
{
\OC\Files\Filesystem
::
mount
(
'\OC\Files\Storage\Local'
,
array
(
'datadir'
=>
$configDataDirectory
),
'/'
);
self
::
$rootMounted
=
true
;
//check if we are using an object storage
$object_storage
=
OC_Config
::
getValue
(
'object_
storage
'
);
if
(
isset
(
$object_storage
)
)
{
self
::
initObjectStorageRootFS
(
$object_storage
);
}
else
{
self
::
initLocalStorageRootFS
()
;
}
if
(
$user
!=
''
&&
!
OCP\User
::
userExists
(
$user
))
{
...
...
@@ -60,7 +93,9 @@ class OC_Util {
/**
* @var \OC\Files\Storage\Storage $storage
*/
if
(
$storage
->
instanceOfStorage
(
'\OC\Files\Storage\Home'
))
{
if
(
$storage
->
instanceOfStorage
(
'\OC\Files\Storage\Home'
)
||
$storage
->
instanceOfStorage
(
'\OCA\ObjectStore\AbstractObjectStore'
)
// FIXME introduce interface \OC\Files\Storage\HomeStorage? or add method?
)
{
$user
=
$storage
->
getUser
()
->
getUID
();
$quota
=
OC_Util
::
getUserQuota
(
$user
);
if
(
$quota
!==
\OC\Files\SPACE_UNLIMITED
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment