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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
960ff4f1
Commit
960ff4f1
authored
Jan 23, 2015
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
Apply wrappers to existing mounts before registering it
parent
67f1534e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/files/filesystem.php
+3
-7
3 additions, 7 deletions
lib/private/files/filesystem.php
lib/private/files/storage/storagefactory.php
+8
-1
8 additions, 1 deletion
lib/private/files/storage/storagefactory.php
with
11 additions
and
8 deletions
lib/private/files/filesystem.php
+
3
−
7
View file @
960ff4f1
...
...
@@ -175,15 +175,11 @@ class Filesystem {
* @param callable $wrapper
*/
public
static
function
addStorageWrapper
(
$wrapperName
,
$wrapper
)
{
if
(
!
self
::
getLoader
()
->
addStorageWrapper
(
$wrapperName
,
$wrapper
))
{
$mounts
=
self
::
getMountManager
()
->
getAll
();
if
(
!
self
::
getLoader
()
->
addStorageWrapper
(
$wrapperName
,
$wrapper
,
$mounts
))
{
// do not re-wrap if storage with this name already existed
return
;
}
$mounts
=
self
::
getMountManager
()
->
getAll
();
foreach
(
$mounts
as
$mount
)
{
$mount
->
wrapStorage
(
$wrapper
);
}
}
/**
...
...
@@ -201,7 +197,7 @@ class Filesystem {
/**
* Returns the mount manager
*
* @return \OC\Files\
Filesystem\
Mount\Manager
* @return \OC\Files\Mount\Manager
*/
public
static
function
getMountManager
()
{
if
(
!
self
::
$mounts
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/private/files/storage/storagefactory.php
+
8
−
1
View file @
960ff4f1
...
...
@@ -23,13 +23,20 @@ class StorageFactory implements IStorageFactory {
*
* @param string $wrapperName name of the wrapper
* @param callable $callback callback
* @param \OCP\Files\Mount\IMountPoint[] $existingMounts existing mount points to apply the wrapper to
* @return bool true if the wrapper was added, false if there was already a wrapper with this
* name registered
*/
public
function
addStorageWrapper
(
$wrapperName
,
$callback
)
{
public
function
addStorageWrapper
(
$wrapperName
,
$callback
,
$existingMounts
=
[]
)
{
if
(
isset
(
$this
->
storageWrappers
[
$wrapperName
]))
{
return
false
;
}
// apply to existing mounts before registering it to prevent applying it double in MountPoint::createStorage
foreach
(
$existingMounts
as
$mount
)
{
$mount
->
wrapStorage
(
$callback
);
}
$this
->
storageWrappers
[
$wrapperName
]
=
$callback
;
return
true
;
}
...
...
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