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
e236e564
Commit
e236e564
authored
9 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
In case of maintenance we should add a message to the exception
parent
aa595392
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/connector/sabre/maintenanceplugin.php
+13
-11
13 additions, 11 deletions
lib/private/connector/sabre/maintenanceplugin.php
with
13 additions
and
11 deletions
lib/private/connector/sabre/maintenanceplugin.php
+
13
−
11
View file @
e236e564
...
...
@@ -25,13 +25,16 @@
namespace
OC\Connector\Sabre
;
class
MaintenancePlugin
extends
\Sabre\DAV\ServerPlugin
{
use
Sabre\DAV\Exception\ServiceUnavailable
;
use
Sabre\DAV\Server
;
use
Sabre\DAV\ServerPlugin
;
class
MaintenancePlugin
extends
ServerPlugin
{
/**
* Reference to main server object
*
* @var
\Sabre\DAV\
Server
* @var Server
*/
private
$server
;
...
...
@@ -43,11 +46,10 @@ class MaintenancePlugin extends \Sabre\DAV\ServerPlugin
*
* This method should set up the required event subscriptions.
*
* @param
\Sabre\DAV\
Server $server
* @param Server $server
* @return void
*/
public
function
initialize
(
\Sabre\DAV\Server
$server
)
{
public
function
initialize
(
Server
$server
)
{
$this
->
server
=
$server
;
$this
->
server
->
on
(
'beforeMethod'
,
array
(
$this
,
'checkMaintenanceMode'
),
10
);
}
...
...
@@ -56,19 +58,19 @@ class MaintenancePlugin extends \Sabre\DAV\ServerPlugin
* This method is called before any HTTP method and returns http status code 503
* in case the system is in maintenance mode.
*
* @throws
\Sabre\DAV\Exception\
ServiceUnavailable
* @throws ServiceUnavailable
* @internal param string $method
* @return bool
*/
public
function
checkMaintenanceMode
()
{
if
(
\OC
::
$server
->
getSystemConfig
()
->
getValue
(
'singleuser'
,
false
))
{
throw
new
\Sabre\DAV\Exception\ServiceUnavailable
(
);
throw
new
ServiceUnavailable
(
'System in single user mode.'
);
}
if
(
\OC
_
Config
::
getValue
(
'maintenance'
,
false
))
{
throw
new
\Sabre\DAV\Exception\ServiceUnavailable
(
);
if
(
\OC
::
$server
->
getSystem
Config
()
->
getValue
(
'maintenance'
,
false
))
{
throw
new
ServiceUnavailable
(
'System in maintenance mode.'
);
}
if
(
\OC
::
checkUpgrade
(
false
))
{
throw
new
\Sabre\DAV\Exception\
ServiceUnavailable
(
'Upgrade needed'
);
throw
new
ServiceUnavailable
(
'Upgrade needed'
);
}
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