Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102364278
PhabricatorAuditSynchronizeManagementWorkflow.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, Feb 19, 22:53
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Feb 21, 22:53 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24339242
Attached To
rPH Phabricator
PhabricatorAuditSynchronizeManagementWorkflow.php
View Options
<?php
final
class
PhabricatorAuditSynchronizeManagementWorkflow
extends
PhabricatorAuditManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'synchronize'
)
->
setExamples
(
'**synchronize** ...'
)
->
setSynopsis
(
pht
(
'Update audit status for commits.'
))
->
setArguments
(
array_merge
(
$this
->
getCommitConstraintArguments
(),
array
()));
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$viewer
=
$this
->
getViewer
();
$objects
=
$this
->
loadCommitsWithConstraints
(
$args
);
foreach
(
$objects
as
$object
)
{
$commits
=
$this
->
loadCommitsForConstraintObject
(
$object
);
foreach
(
$commits
as
$commit
)
{
$commit
=
id
(
new
DiffusionCommitQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$commit
->
getPHID
()))
->
needAuditRequests
(
true
)
->
executeOne
();
if
(!
$commit
)
{
continue
;
}
$old_status
=
$commit
->
getAuditStatus
();
$commit
->
updateAuditStatus
(
$commit
->
getAudits
());
$new_status
=
$commit
->
getAuditStatus
();
if
(
$old_status
==
$new_status
)
{
echo
tsprintf
(
"%s
\n
"
,
pht
(
'No changes for "%s".'
,
$commit
->
getDisplayName
()));
}
else
{
echo
tsprintf
(
"%s
\n
"
,
pht
(
'Updating "%s": "%s" -> "%s".'
,
$commit
->
getDisplayName
(),
PhabricatorAuditCommitStatusConstants
::
getStatusName
(
$old_status
),
PhabricatorAuditCommitStatusConstants
::
getStatusName
(
$new_status
)));
$commit
->
save
();
}
}
}
}
}
Event Timeline
Log In to Comment