Path: blob/master/src/applications/almanac/xaction/AlmanacInterfaceAddressTransaction.php
12256 views
<?php12final class AlmanacInterfaceAddressTransaction3extends AlmanacInterfaceTransactionType {45const TRANSACTIONTYPE = 'almanac:interface:address';67public function generateOldValue($object) {8return $object->getAddress();9}1011public function applyInternalEffects($object, $value) {12$object->setAddress($value);13}1415public function getTitle() {16return pht(17'%s changed the address for this interface from %s to %s.',18$this->renderAuthor(),19$this->renderOldValue(),20$this->renderNewValue());21}2223public function validateTransactions($object, array $xactions) {24$errors = array();2526if ($this->isEmptyTextTransaction($object->getAddress(), $xactions)) {27$errors[] = $this->newRequiredError(28pht('Interfaces must have an address.'));29}3031foreach ($xactions as $xaction) {3233// NOTE: For now, we don't validate addresses. We generally expect users34// to provide IPv4 addresses, but it's reasonable for them to provide35// IPv6 addresses, and some installs currently use DNS names. This is36// off-label but works today.3738}3940return $errors;41}4243}444546