@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When creating a repository with EditEngine, allocate it onto a random cluster service

Summary: Ref T10748. This copies existing code in the `CreateController` which will eventually be removed.

Test Plan:
- Created a new repository with the EditPro workflow.
- Saw it come up into the cluster properly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10748

Differential Revision: https://secure.phabricator.com/D15835

+38
+38
src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
··· 45 45 $repository->setVersionControlSystem($vcs); 46 46 } 47 47 48 + // Pick a random open service to allocate this repository on, if any exist. 49 + // If there are no services, we aren't in cluster mode and will allocate 50 + // locally. If there are services but none permit allocations, we fail. 51 + 52 + // Eventually we can make this more flexible, but this rule is a reasonable 53 + // starting point as we begin to deploy cluster services. 54 + 55 + $services = id(new AlmanacServiceQuery()) 56 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 57 + ->withServiceTypes( 58 + array( 59 + AlmanacClusterRepositoryServiceType::SERVICETYPE, 60 + )) 61 + ->needProperties(true) 62 + ->execute(); 63 + if ($services) { 64 + // Filter out services which do not permit new allocations. 65 + foreach ($services as $key => $possible_service) { 66 + if ($possible_service->getAlmanacPropertyValue('closed')) { 67 + unset($services[$key]); 68 + } 69 + } 70 + 71 + if (!$services) { 72 + throw new Exception( 73 + pht( 74 + 'This install is configured in cluster mode, but all available '. 75 + 'repository cluster services are closed to new allocations. '. 76 + 'At least one service must be open to allow new allocations to '. 77 + 'take place.')); 78 + } 79 + 80 + shuffle($services); 81 + $service = head($services); 82 + 83 + $repository->setAlmanacServicePHID($service->getPHID()); 84 + } 85 + 48 86 return $repository; 49 87 } 50 88