Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86423171
PhabricatorOwnersPackageAuditingTransaction.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
Sun, Oct 6, 10:02
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Oct 8, 10:02 (2 d)
Engine
blob
Format
Raw Data
Handle
21420731
Attached To
rPH Phabricator
PhabricatorOwnersPackageAuditingTransaction.php
View Options
<?php
final
class
PhabricatorOwnersPackageAuditingTransaction
extends
PhabricatorOwnersPackageTransactionType
{
const
TRANSACTIONTYPE
=
'owners.auditing'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getAuditingState
();
}
public
function
generateNewValue
(
$object
,
$value
)
{
return
PhabricatorOwnersAuditRule
::
getStorageValueFromAPIValue
(
$value
);
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setAuditingState
(
$value
);
}
public
function
getTitle
()
{
$old_value
=
$this
->
getOldValue
();
$new_value
=
$this
->
getNewValue
();
$old_rule
=
PhabricatorOwnersAuditRule
::
newFromState
(
$old_value
);
$new_rule
=
PhabricatorOwnersAuditRule
::
newFromState
(
$new_value
);
return
pht
(
'%s changed the audit rule for this package from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderValue
(
$old_rule
->
getDisplayName
()),
$this
->
renderValue
(
$new_rule
->
getDisplayName
()));
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
// See PHI1047. This transaction type accepted some weird stuff. Continue
// supporting it for now, but move toward sensible consistency.
$modern_options
=
PhabricatorOwnersAuditRule
::
getModernValueMap
();
$deprecated_options
=
PhabricatorOwnersAuditRule
::
getDeprecatedValueMap
();
foreach
(
$xactions
as
$xaction
)
{
$new_value
=
$xaction
->
getNewValue
();
if
(
isset
(
$modern_options
[
$new_value
]))
{
continue
;
}
if
(
isset
(
$deprecated_options
[
$new_value
]))
{
continue
;
}
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Package auditing value "%s" is not supported. Supported options '
.
'are: %s. Deprecated options are: %s.'
,
$new_value
,
implode
(
', '
,
$modern_options
),
implode
(
', '
,
$deprecated_options
)),
$xaction
);
}
return
$errors
;
}
}
Event Timeline
Log In to Comment