3 final class DiffusionRepositoryEditActivateController
4 extends DiffusionRepositoryManageController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $response = $this->loadDiffusionContextForEdit();
12 $viewer = $this->getViewer();
13 $drequest = $this->getDiffusionRequest();
14 $repository = $drequest->getRepository();
16 $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
17 ->setRepository($repository)
20 if ($request->isFormPost()) {
21 if (!$repository->isTracked()) {
22 $new_status = PhabricatorRepository
::STATUS_ACTIVE
;
24 $new_status = PhabricatorRepository
::STATUS_INACTIVE
;
27 $xaction = id(new PhabricatorRepositoryTransaction())
29 PhabricatorRepositoryActivateTransaction
::TRANSACTIONTYPE
)
30 ->setNewValue($new_status);
32 $editor = id(new PhabricatorRepositoryEditor())
33 ->setContinueOnNoEffect(true)
34 ->setContinueOnMissingFields(true)
35 ->setContentSourceFromRequest($request)
37 ->applyTransactions($repository, array($xaction));
39 return id(new AphrontReloadResponse())->setURI($panel_uri);
42 if ($repository->isTracked()) {
43 $title = pht('Deactivate Repository');
45 'If you deactivate this repository, it will no longer be updated. '.
46 'Observation and mirroring will cease, and pushing and pulling will '.
47 'be disabled. You can reactivate the repository later.');
48 $submit = pht('Deactivate Repository');
50 $title = pht('Activate Repository');
52 $is_new = $repository->isNewlyInitialized();
54 if ($repository->isHosted()) {
56 'This repository will become a new hosted repository. '.
57 'It will begin serving read and write traffic.');
60 'This repository will observe an existing remote repository. '.
61 'It will begin fetching changes from the remote.');
65 'This repository will resume updates, observation, mirroring, '.
66 'and serving any configured read and write traffic.');
69 $submit = pht('Activate Repository');
72 return $this->newDialog()
75 ->addSubmitButton($submit)
76 ->addCancelButton($panel_uri);