3 final class PhabricatorRepositoryServiceTransaction
4 extends PhabricatorRepositoryTransactionType
{
6 const TRANSACTIONTYPE
= 'repo:service';
8 public function generateOldValue($object) {
9 return $object->getAlmanacServicePHID();
12 public function generateNewValue($object, $value) {
20 public function applyInternalEffects($object, $value) {
21 $object->setAlmanacServicePHID($value);
24 public function getTitle() {
25 $old = $this->getOldValue();
26 $new = $this->getOldValue();
28 if (strlen($old) && !strlen($new)) {
30 '%s moved storage for this repository from %s to local.',
31 $this->renderAuthor(),
32 $this->renderOldHandle());
33 } else if (!strlen($old) && strlen($new)) {
34 // TODO: Possibly, we should distinguish between automatic assignment
35 // on creation vs explicit adjustment.
37 '%s set storage for this repository to %s.',
38 $this->renderAuthor(),
39 $this->renderNewHandle());
42 '%s moved storage for this repository from %s to %s.',
43 $this->renderAuthor(),
44 $this->renderOldHandle(),
45 $this->renderNewHandle());
49 public function validateTransactions($object, array $xactions) {
52 // TODO: This could use some validation, values should be valid Almanac
53 // services of appropriate types. It's only reachable via the CLI so it's
54 // difficult to get wrong in practice.