Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
f1b6b079
Unverified
Commit
f1b6b079
authored
Apr 29, 2016
by
Joas Schilling
Browse files
Add a warning if a storage wrapper was registered outside of the hook
parent
ba0099f7
Changes
2
Show whitespace changes
Inline
Side-by-side
lib/private/Files/Filesystem.php
View file @
f1b6b079
...
...
@@ -207,12 +207,30 @@ class Filesystem {
*/
private
static
$loader
;
/** @var bool */
private
static
$logWarningWhenAddingStorageWrapper
=
true
;
/**
* @param bool $shouldLog
* @internal
*/
public
static
function
logWarningWhenAddingStorageWrapper
(
$shouldLog
)
{
self
::
$logWarningWhenAddingStorageWrapper
=
(
bool
)
$shouldLog
;
}
/**
* @param string $wrapperName
* @param callable $wrapper
* @param int $priority
*/
public
static
function
addStorageWrapper
(
$wrapperName
,
$wrapper
,
$priority
=
50
)
{
if
(
self
::
$logWarningWhenAddingStorageWrapper
)
{
\
OC
::
$server
->
getLogger
()
->
warning
(
"Storage wrapper '
{
wrapper
}
' was not registered via the 'OC_Filesystem - preSetup' hook which could cause potential problems."
,
[
'wrapper'
=>
$wrapperName
,
'app'
=>
'filesystem'
,
]);
}
$mounts
=
self
::
getMountManager
()
->
getAll
();
if
(
!
self
::
getLoader
()
->
addStorageWrapper
(
$wrapperName
,
$wrapper
,
$priority
,
$mounts
))
{
// do not re-wrap if storage with this name already existed
...
...
lib/private/util.php
View file @
f1b6b079
...
...
@@ -145,6 +145,7 @@ class OC_Util {
\
OC\Files\Filesystem
::
initMountManager
();
\
OC\Files\Filesystem
::
logWarningWhenAddingStorageWrapper
(
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 */
...
...
@@ -195,6 +196,7 @@ class OC_Util {
});
OC_Hook
::
emit
(
'OC_Filesystem'
,
'preSetup'
,
array
(
'user'
=>
$user
));
\
OC\Files\Filesystem
::
logWarningWhenAddingStorageWrapper
(
true
);
//check if we are using an object storage
$objectStore
=
\
OC
::
$server
->
getSystemConfig
()
->
getValue
(
'objectstore'
,
null
);
...
...
Write
Preview
Markdown
is supported
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