2017-01-31 17:52:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorAuditSynchronizeManagementWorkflow
|
|
|
|
extends PhabricatorAuditManagementWorkflow {
|
|
|
|
|
|
|
|
protected function didConstruct() {
|
|
|
|
$this
|
|
|
|
->setName('synchronize')
|
Make "bin/audit delete" synchronize commit audit status, and improve "bin/audit synchronize" documentation
Summary:
Depends on D20126. See PHI1056. Ref T13244.
- `bin/audit delete` destroys audit requests, but does not update the overall audit state for associated commits. For example, if you destroy all audit requests for a commit, it does not move to "No Audit Required".
- `bin/audit synchronize` does this synchronize step, but is poorly documented.
Make `bin/audit delete` synchronize affected commits.
Document `bin/audit synchronize` better.
There's some reasonable argument that `bin/audit synchronize` perhaps shouldn't exist, but it does let you recover from an accidentally (or intentionally) mangled database state. For now, let it live.
Test Plan:
- Ran `bin/audit delete`, saw audits destroyed and affected commits synchornized.
- Ran `bin/audit synchronize`, saw behavior unchanged.
- Ran `bin/audit help`, got better help.
Reviewers: amckinley
Reviewed By: amckinley
Maniphest Tasks: T13244
Differential Revision: https://secure.phabricator.com/D20127
2019-02-07 19:27:17 +01:00
|
|
|
->setExamples(
|
|
|
|
"**synchronize** __repository__ ...\n".
|
|
|
|
"**synchronize** __commit__ ...\n".
|
|
|
|
"**synchronize** --all")
|
|
|
|
->setSynopsis(
|
|
|
|
pht(
|
|
|
|
'Update commits to make their summary audit state reflect the '.
|
|
|
|
'state of their actual audit requests. This can fix inconsistencies '.
|
|
|
|
'in database state if audit requests have been mangled '.
|
|
|
|
'accidentally (or on purpose).'))
|
2017-01-31 17:52:38 +01:00
|
|
|
->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) {
|
Make "bin/audit delete" synchronize commit audit status, and improve "bin/audit synchronize" documentation
Summary:
Depends on D20126. See PHI1056. Ref T13244.
- `bin/audit delete` destroys audit requests, but does not update the overall audit state for associated commits. For example, if you destroy all audit requests for a commit, it does not move to "No Audit Required".
- `bin/audit synchronize` does this synchronize step, but is poorly documented.
Make `bin/audit delete` synchronize affected commits.
Document `bin/audit synchronize` better.
There's some reasonable argument that `bin/audit synchronize` perhaps shouldn't exist, but it does let you recover from an accidentally (or intentionally) mangled database state. For now, let it live.
Test Plan:
- Ran `bin/audit delete`, saw audits destroyed and affected commits synchornized.
- Ran `bin/audit synchronize`, saw behavior unchanged.
- Ran `bin/audit help`, got better help.
Reviewers: amckinley
Reviewed By: amckinley
Maniphest Tasks: T13244
Differential Revision: https://secure.phabricator.com/D20127
2019-02-07 19:27:17 +01:00
|
|
|
$this->synchronizeCommitAuditState($commit->getPHID());
|
2017-01-31 17:52:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|