Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91610204
AlmanacInterfaceAddressTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 12, 16:47
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 14, 16:47 (2 d)
Engine
blob
Format
Raw Data
Handle
22290154
Attached To
rPH Phabricator
AlmanacInterfaceAddressTransaction.php
View Options
<?php
final
class
AlmanacInterfaceAddressTransaction
extends
AlmanacInterfaceTransactionType
{
const
TRANSACTIONTYPE
=
'almanac:interface:address'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getAddress
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setAddress
(
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the address for this interface from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getAddress
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Interfaces must have an address.'
));
}
foreach
(
$xactions
as
$xaction
)
{
// NOTE: For now, we don't validate addresses. We generally expect users
// to provide IPv4 addresses, but it's reasonable for them to provide
// IPv6 addresses, and some installs currently use DNS names. This is
// off-label but works today.
}
return
$errors
;
}
}
Event Timeline
Log In to Comment