Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91675565
PhabricatorPackagesPublisherKeyTransaction.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
Wed, Nov 13, 08:46
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 15, 08:46 (2 d)
Engine
blob
Format
Raw Data
Handle
22303628
Attached To
rPH Phabricator
PhabricatorPackagesPublisherKeyTransaction.php
View Options
<?php
final
class
PhabricatorPackagesPublisherKeyTransaction
extends
PhabricatorPackagesPublisherTransactionType
{
const
TRANSACTIONTYPE
=
'packages.publisher.key'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getPublisherKey
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setPublisherKey
(
$value
);
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getName
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Publishers must have a unique publisher key.'
));
}
if
(!
$this
->
isNewObject
())
{
foreach
(
$xactions
as
$xaction
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Once a publisher is created, its key can not be changed.'
),
$xaction
);
}
}
foreach
(
$xactions
as
$xaction
)
{
$value
=
$xaction
->
getNewValue
();
try
{
PhabricatorPackagesPublisher
::
assertValidPublisherKey
(
$value
);
}
catch
(
Exception
$ex
)
{
$errors
[]
=
$this
->
newInvalidError
(
$ex
->
getMessage
(),
$xaction
);
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment