When Phabricator is in read-only mode, explain why
Summary:
Ref T4571. Allows users to click the "read-only mode" notification to get more information about why an install is in read-only mode.
Installs can be in this mode for several reasons (explicit administrative action, no masters defined, no masters reachable), and it's useful to be able to tell the difference.
Test Plan: {F1212930}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4571
Differential Revision: https://secure.phabricator.com/D15671
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
final class PhabricatorSystemReadOnlyController
|
||||
extends PhabricatorController {
|
||||
|
||||
public function shouldRequireLogin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$reason = $request->getURIData('reason');
|
||||
|
||||
$body = array();
|
||||
switch ($reason) {
|
||||
case PhabricatorEnv::READONLY_CONFIG:
|
||||
$title = pht('Administrative Read-Only Mode');
|
||||
$body[] = pht(
|
||||
'An administrator has placed Phabricator into read-only mode.');
|
||||
$body[] = pht(
|
||||
'This mode may be used to perform temporary maintenance, test '.
|
||||
'configuration, or archive an installation permanently.');
|
||||
$body[] = pht(
|
||||
'Read-only mode was enabled by the explicit action of a human '.
|
||||
'administrator, so you can get more information about why it '.
|
||||
'has been turned on by rolling your chair away from your desk and '.
|
||||
'yelling "Hey! Why is Phabricator in read-only mode??!" using '.
|
||||
'your very loudest outside voice.');
|
||||
$button = pht('Wait Patiently');
|
||||
break;
|
||||
default:
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$body[] = pht(
|
||||
'In read-only mode you can read existing information, but you will not '.
|
||||
'be able to edit information or create new information until this mode '.
|
||||
'is disabled.');
|
||||
|
||||
$dialog = $this->newDialog()
|
||||
->setTitle($title)
|
||||
->setWidth(AphrontDialogView::WIDTH_FORM)
|
||||
->addCancelButton('/', $button);
|
||||
|
||||
foreach ($body as $paragraph) {
|
||||
$dialog->appendParagraph($paragraph);
|
||||
}
|
||||
|
||||
return $dialog;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user