Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / almanac / xaction / AlmanacInterfaceAddressTransaction.php
blob7eb8e0a5670f9176307388b1ecbfc9ff101e4a85
1 <?php
3 final class AlmanacInterfaceAddressTransaction
4 extends AlmanacInterfaceTransactionType {
6 const TRANSACTIONTYPE = 'almanac:interface:address';
8 public function generateOldValue($object) {
9 return $object->getAddress();
12 public function applyInternalEffects($object, $value) {
13 $object->setAddress($value);
16 public function getTitle() {
17 return pht(
18 '%s changed the address for this interface from %s to %s.',
19 $this->renderAuthor(),
20 $this->renderOldValue(),
21 $this->renderNewValue());
24 public function validateTransactions($object, array $xactions) {
25 $errors = array();
27 if ($this->isEmptyTextTransaction($object->getAddress(), $xactions)) {
28 $errors[] = $this->newRequiredError(
29 pht('Interfaces must have an address.'));
32 foreach ($xactions as $xaction) {
34 // NOTE: For now, we don't validate addresses. We generally expect users
35 // to provide IPv4 addresses, but it's reasonable for them to provide
36 // IPv6 addresses, and some installs currently use DNS names. This is
37 // off-label but works today.
41 return $errors;