Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
2.6 kB · 79 lines
PHP
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980<?php
final class DiffusionRepositoryEditActivateController extends DiffusionRepositoryManageController {
public function handleRequest(AphrontRequest $request) { $response = $this->loadDiffusionContextForEdit(); if ($response) { return $response; }
$viewer = $this->getViewer(); $drequest = $this->getDiffusionRequest(); $repository = $drequest->getRepository();
$panel_uri = id(new DiffusionRepositoryBasicsManagementPanel()) ->setRepository($repository) ->getPanelURI();
if ($request->isFormPost()) { if (!$repository->isTracked()) { $new_status = PhabricatorRepository::STATUS_ACTIVE; } else { $new_status = PhabricatorRepository::STATUS_INACTIVE; }
$xaction = id(new PhabricatorRepositoryTransaction()) ->setTransactionType( PhabricatorRepositoryActivateTransaction::TRANSACTIONTYPE) ->setNewValue($new_status);
$editor = id(new PhabricatorRepositoryEditor()) ->setContinueOnNoEffect(true) ->setContinueOnMissingFields(true) ->setContentSourceFromRequest($request) ->setActor($viewer) ->applyTransactions($repository, array($xaction));
return id(new AphrontReloadResponse())->setURI($panel_uri); }
if ($repository->isTracked()) { $title = pht('Deactivate Repository'); $body = pht( 'If you deactivate this repository, it will no longer be updated. '. 'Observation and mirroring will cease, and pushing and pulling will '. 'be disabled. You can reactivate the repository later.'); $submit = pht('Deactivate Repository'); } else { $title = pht('Activate Repository');
$is_new = $repository->isNewlyInitialized(); if ($is_new) { if ($repository->isHosted()) { $body = pht( 'This repository will become a new hosted repository. '. 'It will begin serving read and write traffic.'); } else { $body = pht( 'This repository will observe an existing remote repository. '. 'It will begin fetching changes from the remote.'); } } else { $body = pht( 'This repository will resume updates, observation, mirroring, '. 'and serving any configured read and write traffic.'); }
$submit = pht('Activate Repository'); }
return $this->newDialog() ->setTitle($title) ->appendChild($body) ->addSubmitButton($submit) ->addCancelButton($panel_uri); }
}