Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / controller / DiffusionRepositoryEditPublishingController.php
blob3d55a5c2b128ba48151185e7331a734600bea0c7
1 <?php
3 final class DiffusionRepositoryEditPublishingController
4 extends DiffusionRepositoryManageController {
6 public function handleRequest(AphrontRequest $request) {
7 $response = $this->loadDiffusionContextForEdit();
8 if ($response) {
9 return $response;
12 $viewer = $this->getViewer();
13 $drequest = $this->getDiffusionRequest();
14 $repository = $drequest->getRepository();
16 $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
17 ->setRepository($repository)
18 ->getPanelURI();
20 if ($request->isFormPost()) {
21 if ($repository->isPublishingDisabled()) {
22 $new_status = true;
23 } else {
24 $new_status = false;
27 $xaction = id(new PhabricatorRepositoryTransaction())
28 ->setTransactionType(
29 PhabricatorRepositoryNotifyTransaction::TRANSACTIONTYPE)
30 ->setNewValue($new_status);
32 $editor = id(new PhabricatorRepositoryEditor())
33 ->setContinueOnNoEffect(true)
34 ->setContinueOnMissingFields(true)
35 ->setContentSourceFromRequest($request)
36 ->setActor($viewer)
37 ->applyTransactions($repository, array($xaction));
39 return id(new AphrontReloadResponse())->setURI($panel_uri);
42 $body = array();
43 if (!$repository->isPublishingDisabled()) {
44 $title = pht('Disable Publishing');
45 $body[] = pht(
46 'If you disable publishing for this repository, new commits '.
47 'will not: send email, publish feed stories, trigger audits, or '.
48 'trigger Herald.');
50 $body[] = pht(
51 'This option is most commonly used to temporarily allow a major '.
52 'repository maintenance operation (like a history rewrite) to '.
53 'occur with minimal disruption to users.');
55 $submit = pht('Disable Publishing');
56 } else {
57 $title = pht('Reactivate Publishing');
58 $body[] = pht(
59 'If you reactivate publishing for this repository, new commits '.
60 'that become reachable from permanent refs will: send email, '.
61 'publish feed stories, trigger audits, and trigger Herald.');
63 $body[] = pht(
64 'Commits which became reachable from a permanent ref while '.
65 'publishing was disabled will not trigger these actions '.
66 'retroactively.');
68 $submit = pht('Reactivate Publishing');
71 $dialog = $this->newDialog()
72 ->setTitle($title)
73 ->addSubmitButton($submit)
74 ->addCancelButton($panel_uri);
76 foreach ($body as $graph) {
77 $dialog->appendParagraph($graph);
80 return $dialog;