mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Extend all "ManagementWorkflow" classes from a base class
Summary: Ref T2015. Not directly related to Drydock, but I've wanted to do this for a bit. Introduce a common base class for all the workflows in the scripts in `bin/*`. This slightly reduces code duplication by moving `isExecutable()` to the base, but also provides `getViewer()`. This is a little nicer than `PhabricatorUser::getOmnipotentUser()` and gives us a layer of indirection if we ever want to introduce more general viewer mechanisms in scripts. Test Plan: Lint; ran some of the scripts. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2015 Differential Revision: https://secure.phabricator.com/D7838
This commit is contained in:
parent
1ba52fac86
commit
e397103bf2
40 changed files with 77 additions and 138 deletions
|
@ -1560,6 +1560,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMainMenuIconView' => 'view/page/menu/PhabricatorMainMenuIconView.php',
|
||||
'PhabricatorMainMenuSearchView' => 'view/page/menu/PhabricatorMainMenuSearchView.php',
|
||||
'PhabricatorMainMenuView' => 'view/page/menu/PhabricatorMainMenuView.php',
|
||||
'PhabricatorManagementWorkflow' => 'infrastructure/management/PhabricatorManagementWorkflow.php',
|
||||
'PhabricatorManiphestConfigOptions' => 'applications/maniphest/config/PhabricatorManiphestConfigOptions.php',
|
||||
'PhabricatorManiphestTaskTestDataGenerator' => 'applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php',
|
||||
'PhabricatorMarkupCache' => 'applications/cache/storage/PhabricatorMarkupCache.php',
|
||||
|
@ -3020,7 +3021,7 @@ phutil_register_library_map(array(
|
|||
'DivinerReturnTableView' => 'AphrontTagView',
|
||||
'DivinerSectionView' => 'AphrontTagView',
|
||||
'DivinerStaticPublisher' => 'DivinerPublisher',
|
||||
'DivinerWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'DivinerWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'DoorkeeperBridge' => 'Phobject',
|
||||
'DoorkeeperBridgeAsana' => 'DoorkeeperBridge',
|
||||
'DoorkeeperBridgeJIRA' => 'DoorkeeperBridge',
|
||||
|
@ -3099,7 +3100,7 @@ phutil_register_library_map(array(
|
|||
'DrydockManagementCreateResourceWorkflow' => 'DrydockManagementWorkflow',
|
||||
'DrydockManagementLeaseWorkflow' => 'DrydockManagementWorkflow',
|
||||
'DrydockManagementReleaseWorkflow' => 'DrydockManagementWorkflow',
|
||||
'DrydockManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'DrydockManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'DrydockPHIDTypeBlueprint' => 'PhabricatorPHIDType',
|
||||
'DrydockPHIDTypeLease' => 'PhabricatorPHIDType',
|
||||
'DrydockPHIDTypeResource' => 'PhabricatorPHIDType',
|
||||
|
@ -3197,7 +3198,7 @@ phutil_register_library_map(array(
|
|||
'HarbormasterDAO' => 'PhabricatorLiskDAO',
|
||||
'HarbormasterHTTPRequestBuildStepImplementation' => 'VariableBuildStepImplementation',
|
||||
'HarbormasterManagementBuildWorkflow' => 'HarbormasterManagementWorkflow',
|
||||
'HarbormasterManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'HarbormasterManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'HarbormasterObject' => 'HarbormasterDAO',
|
||||
'HarbormasterPHIDTypeBuild' => 'PhabricatorPHIDType',
|
||||
'HarbormasterPHIDTypeBuildItem' => 'PhabricatorPHIDType',
|
||||
|
@ -3672,7 +3673,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuditListView' => 'AphrontView',
|
||||
'PhabricatorAuditMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||
'PhabricatorAuditManagementDeleteWorkflow' => 'PhabricatorAuditManagementWorkflow',
|
||||
'PhabricatorAuditManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorAuditManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorAuditPreviewController' => 'PhabricatorAuditController',
|
||||
'PhabricatorAuditReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'PhabricatorAuthAccountView' => 'AphrontView',
|
||||
|
@ -3687,7 +3688,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuthManagementLDAPWorkflow' => 'PhabricatorAuthManagementWorkflow',
|
||||
'PhabricatorAuthManagementRecoverWorkflow' => 'PhabricatorAuthManagementWorkflow',
|
||||
'PhabricatorAuthManagementRefreshWorkflow' => 'PhabricatorAuthManagementWorkflow',
|
||||
'PhabricatorAuthManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorAuthManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorAuthNeedsApprovalController' => 'PhabricatorAuthController',
|
||||
'PhabricatorAuthNewController' => 'PhabricatorAuthProviderConfigController',
|
||||
'PhabricatorAuthOldOAuthRedirectController' => 'PhabricatorAuthController',
|
||||
|
@ -3740,7 +3741,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorBusyExample' => 'PhabricatorUIExample',
|
||||
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorCacheManagementPurgeWorkflow' => 'PhabricatorSearchManagementWorkflow',
|
||||
'PhabricatorCacheManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorCacheManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorCalendarBrowseController' => 'PhabricatorCalendarController',
|
||||
'PhabricatorCalendarController' => 'PhabricatorController',
|
||||
'PhabricatorCalendarDAO' => 'PhabricatorLiskDAO',
|
||||
|
@ -3815,7 +3816,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConfigManagementGetWorkflow' => 'PhabricatorConfigManagementWorkflow',
|
||||
'PhabricatorConfigManagementListWorkflow' => 'PhabricatorConfigManagementWorkflow',
|
||||
'PhabricatorConfigManagementSetWorkflow' => 'PhabricatorConfigManagementWorkflow',
|
||||
'PhabricatorConfigManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorConfigManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorConfigOption' =>
|
||||
array(
|
||||
0 => 'Phobject',
|
||||
|
@ -3892,7 +3893,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDaemonManagementStartWorkflow' => 'PhabricatorDaemonManagementWorkflow',
|
||||
'PhabricatorDaemonManagementStatusWorkflow' => 'PhabricatorDaemonManagementWorkflow',
|
||||
'PhabricatorDaemonManagementStopWorkflow' => 'PhabricatorDaemonManagementWorkflow',
|
||||
'PhabricatorDaemonManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorDaemonManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorDataNotAttachedException' => 'Exception',
|
||||
'PhabricatorDebugController' => 'PhabricatorController',
|
||||
'PhabricatorDefaultFileStorageEngineSelector' => 'PhabricatorFileStorageEngineSelector',
|
||||
|
@ -3946,7 +3947,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFactManagementDestroyWorkflow' => 'PhabricatorFactManagementWorkflow',
|
||||
'PhabricatorFactManagementListWorkflow' => 'PhabricatorFactManagementWorkflow',
|
||||
'PhabricatorFactManagementStatusWorkflow' => 'PhabricatorFactManagementWorkflow',
|
||||
'PhabricatorFactManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorFactManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorFactRaw' => 'PhabricatorFactDAO',
|
||||
'PhabricatorFactSimpleSpec' => 'PhabricatorFactSpec',
|
||||
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
|
||||
|
@ -3960,7 +3961,7 @@ phutil_register_library_map(array(
|
|||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||
),
|
||||
'PhabricatorFeedManagementRepublishWorkflow' => 'PhabricatorFeedManagementWorkflow',
|
||||
'PhabricatorFeedManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorFeedManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorFeedPublicStreamController' => 'PhabricatorFeedController',
|
||||
'PhabricatorFeedQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorFeedSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
|
@ -4029,7 +4030,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFilesManagementMigrateWorkflow' => 'PhabricatorFilesManagementWorkflow',
|
||||
'PhabricatorFilesManagementPurgeWorkflow' => 'PhabricatorFilesManagementWorkflow',
|
||||
'PhabricatorFilesManagementRebuildWorkflow' => 'PhabricatorFilesManagementWorkflow',
|
||||
'PhabricatorFilesManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorFilesManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorFlag' =>
|
||||
array(
|
||||
0 => 'PhabricatorFlagDAO',
|
||||
|
@ -4077,7 +4078,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorLegalpadPHIDTypeDocument' => 'PhabricatorPHIDType',
|
||||
'PhabricatorLintEngine' => 'PhutilLintEngine',
|
||||
'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow',
|
||||
'PhabricatorLipsumManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist',
|
||||
'PhabricatorLiskDAO' => 'LiskDAO',
|
||||
'PhabricatorLocalDiskFileStorageEngine' => 'PhabricatorFileStorageEngine',
|
||||
|
@ -4119,7 +4120,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMailManagementSendTestWorkflow' => 'PhabricatorSearchManagementWorkflow',
|
||||
'PhabricatorMailManagementShowInboundWorkflow' => 'PhabricatorSearchManagementWorkflow',
|
||||
'PhabricatorMailManagementShowOutboundWorkflow' => 'PhabricatorSearchManagementWorkflow',
|
||||
'PhabricatorMailManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorMailManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorMailReceiverTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorMailingListPHIDTypeList' => 'PhabricatorPHIDType',
|
||||
'PhabricatorMailingListQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
|
@ -4135,6 +4136,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMainMenuIconView' => 'AphrontView',
|
||||
'PhabricatorMainMenuSearchView' => 'AphrontView',
|
||||
'PhabricatorMainMenuView' => 'AphrontView',
|
||||
'PhabricatorManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorManiphestConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorManiphestTaskTestDataGenerator' => 'PhabricatorTestDataGenerator',
|
||||
'PhabricatorMarkupCache' => 'PhabricatorCacheDAO',
|
||||
|
@ -4305,7 +4307,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorPolicyInterface' => 'PhabricatorPHIDInterface',
|
||||
'PhabricatorPolicyManagementShowWorkflow' => 'PhabricatorPolicyManagementWorkflow',
|
||||
'PhabricatorPolicyManagementUnlockWorkflow' => 'PhabricatorPolicyManagementWorkflow',
|
||||
'PhabricatorPolicyManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorPolicyManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorPolicyPHIDTypePolicy' => 'PhabricatorPHIDType',
|
||||
'PhabricatorPolicyQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorPolicyRuleAdministrators' => 'PhabricatorPolicyRule',
|
||||
|
@ -4421,7 +4423,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryManagementLookupUsersWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementMarkImportedWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementPullWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorRepositoryManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorRepositoryMercurialCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
||||
'PhabricatorRepositoryMercurialCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
||||
'PhabricatorRepositoryMirror' =>
|
||||
|
@ -4459,7 +4461,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorS3FileStorageEngine' => 'PhabricatorFileStorageEngine',
|
||||
'PhabricatorSSHLog' => 'Phobject',
|
||||
'PhabricatorSSHPassthruCommand' => 'Phobject',
|
||||
'PhabricatorSSHWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorSSHWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorSavedQuery' =>
|
||||
array(
|
||||
0 => 'PhabricatorSearchDAO',
|
||||
|
@ -4480,7 +4482,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorSearchEngineMySQL' => 'PhabricatorSearchEngine',
|
||||
'PhabricatorSearchHovercardController' => 'PhabricatorSearchBaseController',
|
||||
'PhabricatorSearchManagementIndexWorkflow' => 'PhabricatorSearchManagementWorkflow',
|
||||
'PhabricatorSearchManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorSearchManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorSearchOrderController' => 'PhabricatorSearchBaseController',
|
||||
'PhabricatorSearchQuery' => 'PhabricatorSearchDAO',
|
||||
'PhabricatorSearchResultView' => 'AphrontView',
|
||||
|
@ -4574,7 +4576,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorStorageManagementProbeWorkflow' => 'PhabricatorStorageManagementWorkflow',
|
||||
'PhabricatorStorageManagementStatusWorkflow' => 'PhabricatorStorageManagementWorkflow',
|
||||
'PhabricatorStorageManagementUpgradeWorkflow' => 'PhabricatorStorageManagementWorkflow',
|
||||
'PhabricatorStorageManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||
'PhabricatorStorageManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
|
||||
'PhabricatorSubscriptionsEditController' => 'PhabricatorController',
|
||||
'PhabricatorSubscriptionsEditor' => 'PhabricatorEditor',
|
||||
|
|
|
@ -178,10 +178,6 @@ final class PhabricatorAuditManagementDeleteWorkflow
|
|||
return 0;
|
||||
}
|
||||
|
||||
private function getViewer() {
|
||||
return PhabricatorUser::getOmnipotentUser();
|
||||
}
|
||||
|
||||
private function loadUsers($users) {
|
||||
$users = $this->parseList($users);
|
||||
if (!$users) {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorAuditManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorAuthManagementRecoverWorkflow
|
|||
public function execute(PhutilArgumentParser $args) {
|
||||
|
||||
$can_recover = id(new PhabricatorPeopleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withIsAdmin(true)
|
||||
->execute();
|
||||
if (!$can_recover) {
|
||||
|
@ -48,7 +48,7 @@ final class PhabricatorAuthManagementRecoverWorkflow
|
|||
$username = head($usernames);
|
||||
|
||||
$user = id(new PhabricatorPeopleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withUsernames(array($username))
|
||||
->executeOne();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ final class PhabricatorAuthManagementRefreshWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$query = id(new PhabricatorExternalAccountQuery())
|
||||
->setViewer($viewer);
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorAuthManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorCacheManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorConfigManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ final class PhabricatorDaemonManagementLogWorkflow
|
|||
$id = head($id);
|
||||
|
||||
$daemon = id(new PhabricatorDaemonLogQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorDaemonManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
protected function loadAvailableDaemonClasses() {
|
||||
$loader = new PhutilSymbolLoader();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class DivinerWorkflow extends PhutilArgumentWorkflow {
|
||||
abstract class DivinerWorkflow extends PhabricatorManagementWorkflow {
|
||||
|
||||
private $config;
|
||||
private $bookConfigPath;
|
||||
|
@ -9,10 +9,6 @@ abstract class DivinerWorkflow extends PhutilArgumentWorkflow {
|
|||
return $this->bookConfigPath;
|
||||
}
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getConfig($key, $default = null) {
|
||||
return idx($this->config, $key, $default);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ final class DrydockManagementCloseWorkflow
|
|||
"Specify one or more resource IDs to close.");
|
||||
}
|
||||
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$resources = id(new DrydockResourceQuery())
|
||||
->setViewer($viewer)
|
||||
|
|
|
@ -49,7 +49,7 @@ final class DrydockManagementCreateResourceWorkflow
|
|||
$attributes = $options->parse($attributes);
|
||||
}
|
||||
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$blueprint = id(new DrydockBlueprintQuery())
|
||||
->setViewer($viewer)
|
||||
|
|
|
@ -25,7 +25,7 @@ final class DrydockManagementReleaseWorkflow
|
|||
"Specify one or more lease IDs to release.");
|
||||
}
|
||||
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$leases = id(new DrydockLeaseQuery())
|
||||
->setViewer($viewer)
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class DrydockManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorFactManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ final class PhabricatorFeedManagementRepublishWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$key = $args->getArg('key');
|
||||
if (count($key) < 1) {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorFeedManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorFilesManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
protected function buildIterator(PhutilArgumentParser $args) {
|
||||
$names = $args->getArg('names');
|
||||
|
@ -20,7 +16,7 @@ abstract class PhabricatorFilesManagementWorkflow
|
|||
|
||||
if ($names) {
|
||||
$query = id(new PhabricatorObjectQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withNames($names)
|
||||
->withTypes(array(PhabricatorFilePHIDTypeFile::TYPECONST));
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ final class HarbormasterManagementBuildWorkflow
|
|||
}
|
||||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$names = $args->getArg('buildable');
|
||||
if (count($names) != 1) {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class HarbormasterManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ final class PhabricatorLipsumGenerateWorkflow
|
|||
echo "\n";
|
||||
while (true) {
|
||||
$type = $supported_types[array_rand($supported_types)];
|
||||
$admin = PhabricatorUser::getOmnipotentUser();
|
||||
$admin = $this->getViewer();
|
||||
try {
|
||||
$taskgen = newv($type, array());
|
||||
$object = $taskgen->generate();
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorLipsumManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorMailManagementListInboundWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$mails = id(new PhabricatorMetaMTAReceivedMail())->loadAllWhere(
|
||||
'1 = 1 ORDER BY id DESC LIMIT %d',
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorMailManagementListOutboundWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
|
||||
'1 = 1 ORDER BY id DESC LIMIT %d',
|
||||
|
|
|
@ -42,7 +42,7 @@ final class PhabricatorMailManagementReceiveTestWorkflow
|
|||
}
|
||||
|
||||
$user = id(new PhabricatorPeopleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withUsernames(array($as))
|
||||
->executeOne();
|
||||
if (!$user) {
|
||||
|
|
|
@ -61,7 +61,7 @@ final class PhabricatorMailManagementSendTestWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$from = $args->getArg('from');
|
||||
if ($from) {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorMailManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ final class PhabricatorPolicyManagementShowWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$obj_names = $args->getArg('objects');
|
||||
if (!$obj_names) {
|
||||
|
|
|
@ -22,7 +22,7 @@ final class PhabricatorPolicyManagementUnlockWorkflow
|
|||
|
||||
public function execute(PhutilArgumentParser $args) {
|
||||
$console = PhutilConsole::getConsole();
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$obj_names = $args->getArg('objects');
|
||||
if (!$obj_names) {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorPolicyManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ final class PhabricatorRepositoryManagementEditWorkflow
|
|||
}
|
||||
|
||||
$actor = id(new PhabricatorPeopleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withUsernames(array($username))
|
||||
->executeOne();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ final class PhabricatorRepositoryManagementListWorkflow
|
|||
$console = PhutilConsole::getConsole();
|
||||
|
||||
$repos = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->execute();
|
||||
if ($repos) {
|
||||
foreach ($repos as $repo) {
|
||||
|
|
|
@ -89,7 +89,7 @@ final class PhabricatorRepositoryManagementLookupUsersWorkflow
|
|||
}
|
||||
|
||||
return id(new PhabricatorHandleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs(array($phid))
|
||||
->executeOne();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorRepositoryManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
protected function loadRepositories(PhutilArgumentParser $args, $param) {
|
||||
$callsigns = $args->getArg($param);
|
||||
|
@ -15,7 +11,7 @@ abstract class PhabricatorRepositoryManagementWorkflow
|
|||
}
|
||||
|
||||
$repos = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withCallsigns($callsigns)
|
||||
->execute();
|
||||
|
||||
|
@ -37,7 +33,7 @@ abstract class PhabricatorRepositoryManagementWorkflow
|
|||
}
|
||||
|
||||
$query = id(new DiffusionCommitQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withIdentifiers($names);
|
||||
|
||||
$query->execute();
|
||||
|
|
|
@ -92,7 +92,7 @@ final class PhabricatorSearchManagementIndexWorkflow
|
|||
|
||||
private function loadPHIDsByNames(array $names) {
|
||||
$query = id(new PhabricatorObjectQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->setViewer($this->getViewer())
|
||||
->withNames($names);
|
||||
$query->execute();
|
||||
$objects = $query->getNamedResults();
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group search
|
||||
*/
|
||||
abstract class PhabricatorSearchManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
|
||||
final public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow {
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getViewer() {
|
||||
// Some day, we might provide a more general viewer mechanism to scripts.
|
||||
// For now, workflows can call this method for convenience and future
|
||||
// flexibility.
|
||||
return PhabricatorUser::getOmnipotentUser();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorSSHWorkflow extends PhutilArgumentWorkflow {
|
||||
abstract class PhabricatorSSHWorkflow extends PhabricatorManagementWorkflow {
|
||||
|
||||
private $user;
|
||||
private $iochannel;
|
||||
|
@ -24,10 +24,6 @@ abstract class PhabricatorSSHWorkflow extends PhutilArgumentWorkflow {
|
|||
return $this->user;
|
||||
}
|
||||
|
||||
final public function isExecutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setIOChannel(PhutilChannel $channel) {
|
||||
$this->iochannel = $channel;
|
||||
return $this;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
abstract class PhabricatorStorageManagementWorkflow
|
||||
extends PhutilArgumentWorkflow {
|
||||
extends PhabricatorManagementWorkflow {
|
||||
|
||||
private $patches;
|
||||
private $api;
|
||||
|
@ -25,8 +25,4 @@ abstract class PhabricatorStorageManagementWorkflow
|
|||
return $this->api;
|
||||
}
|
||||
|
||||
public function isExecutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue