@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
at recaptime-dev/main 57 lines 1.5 kB view raw
1<?php 2 3final class DiffusionLookSoonConduitAPIMethod 4 extends DiffusionConduitAPIMethod { 5 6 public function getAPIMethodName() { 7 return 'diffusion.looksoon'; 8 } 9 10 public function getMethodDescription() { 11 return pht( 12 'Advises this server to look for new commits in a repository as soon '. 13 'as possible. This advice is most useful if you have just pushed new '. 14 'commits to that repository.'); 15 } 16 17 protected function defineReturnType() { 18 return 'void'; 19 } 20 21 protected function defineParamTypes() { 22 return array( 23 'callsigns' => 'optional list<string> (deprecated)', 24 'repositories' => 'optional list<string>', 25 'urgency' => 'optional string', 26 ); 27 } 28 29 protected function execute(ConduitAPIRequest $request) { 30 // NOTE: The "urgency" parameter does nothing, it is just a hilarious joke 31 // which exemplifies the boundless clever wit of this project. 32 33 $identifiers = $request->getValue('repositories'); 34 35 if (!$identifiers) { 36 $identifiers = $request->getValue('callsigns'); 37 } 38 39 if (!$identifiers) { 40 return null; 41 } 42 43 $repositories = id(new PhabricatorRepositoryQuery()) 44 ->setViewer($request->getUser()) 45 ->withIdentifiers($identifiers) 46 ->execute(); 47 48 foreach ($repositories as $repository) { 49 $repository->writeStatusMessage( 50 PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE, 51 PhabricatorRepositoryStatusMessage::CODE_OKAY); 52 } 53 54 return null; 55 } 56 57}