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() {
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) {
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.