From 8150fdf044818c503a588c1b3ef0ddbb93cfa1be Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 15 Jul 2011 12:44:03 -0700 Subject: [PATCH] Deprecate ArcanistBaseWorkflow::getUserGUID in favor of "PHID" Summary: One day all "GUID" references will be gone, maybe. Test Plan: grep, ran workflow before changing and got a warning about deprecation Reviewed By: aran Reviewers: mgummelt, tuomaspelkonen, aran, jungejason CC: aran Differential Revision: 671 --- src/workflow/base/ArcanistBaseWorkflow.php | 33 ++++++++++++------- src/workflow/base/__init__.php | 1 + .../commit/ArcanistCommitWorkflow.php | 2 +- src/workflow/diff/ArcanistDiffWorkflow.php | 6 ++-- src/workflow/list/ArcanistListWorkflow.php | 2 +- .../ArcanistMarkCommittedWorkflow.php | 2 +- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/workflow/base/ArcanistBaseWorkflow.php b/src/workflow/base/ArcanistBaseWorkflow.php index 4d9999d7..7d0de227 100644 --- a/src/workflow/base/ArcanistBaseWorkflow.php +++ b/src/workflow/base/ArcanistBaseWorkflow.php @@ -34,7 +34,7 @@ * and/or @{method:authenticateConduit} later in a workflow to upgrade it. * Once a conduit is open, you can access the client by calling * @{method:getConduit}, which allows you to invoke methods. You can get - * verified information about the user identity by calling @{method:getUserGUID} + * verified information about the user identity by calling @{method:getUserPHID} * or @{method:getUserName} after authentication occurs. * * @task conduit Conduit @@ -47,7 +47,7 @@ class ArcanistBaseWorkflow { private $conduitCredentials; private $conduitAuthenticated; - private $userGUID; + private $userPHID; private $userName; private $repositoryAPI; private $workingCopy; @@ -175,7 +175,7 @@ class ArcanistBaseWorkflow { * - ##certificate## (required) The Conduit certificate to use. * - ##description## (optional) Description of the invoking command. * - * Successful authentication allows you to call @{method:getUserGUID} and + * Successful authentication allows you to call @{method:getUserPHID} and * @{method:getUserName}, as well as use the client you access with * @{method:getConduit} to make authenticated calls. * @@ -240,7 +240,7 @@ class ArcanistBaseWorkflow { } $this->userName = $user; - $this->userGUID = $connection['userPHID']; + $this->userPHID = $connection['userPHID']; $this->conduitAuthenticated = true; @@ -280,20 +280,29 @@ class ArcanistBaseWorkflow { /** * Returns the PHID for the user once they've authenticated via Conduit. * - * NOTE: This method will be deprecated and renamed to ##getUserPHID()## at - * some point. - * * @return phid Authenticated user PHID. * @task conduit */ - final public function getUserGUID() { - if (!$this->userGUID) { + final public function getUserPHID() { + if (!$this->userPHID) { $workflow = get_class($this); throw new Exception( "This workflow ('{$workflow}') requires authentication, override ". "requiresAuthentication() to return true."); } - return $this->userGUID; + return $this->userPHID; + } + + /** + * Deprecated. See @{method:getUserPHID}. + * + * @deprecated + */ + final public function getUserGUID() { + phutil_deprecated( + 'ArcanistBaseWorkflow::getUserGUID', + 'This method has been renamed to getUserPHID().'); + return $this->getUserPHID(); } /** @@ -391,8 +400,8 @@ class ArcanistBaseWorkflow { $workflow->setRepositoryAPI($this->repositoryAPI); } - if ($this->userGUID) { - $workflow->userGUID = $this->getUserGUID(); + if ($this->userPHID) { + $workflow->userPHID = $this->getUserPHID(); $workflow->userName = $this->getUserName(); } diff --git a/src/workflow/base/__init__.php b/src/workflow/base/__init__.php index 139552c7..a7a8889f 100644 --- a/src/workflow/base/__init__.php +++ b/src/workflow/base/__init__.php @@ -19,6 +19,7 @@ phutil_require_module('phutil', 'conduit/client'); phutil_require_module('phutil', 'console'); phutil_require_module('phutil', 'filesystem'); phutil_require_module('phutil', 'future/exec'); +phutil_require_module('phutil', 'moduleutils'); phutil_require_module('phutil', 'utils'); diff --git a/src/workflow/commit/ArcanistCommitWorkflow.php b/src/workflow/commit/ArcanistCommitWorkflow.php index e455f1c1..ab6fb525 100644 --- a/src/workflow/commit/ArcanistCommitWorkflow.php +++ b/src/workflow/commit/ArcanistCommitWorkflow.php @@ -73,7 +73,7 @@ EOTEXT array( 'query' => 'committable', 'guids' => array( - $this->getUserGUID(), + $this->getUserPHID(), ), )); diff --git a/src/workflow/diff/ArcanistDiffWorkflow.php b/src/workflow/diff/ArcanistDiffWorkflow.php index 0f376827..f5ddd206 100644 --- a/src/workflow/diff/ArcanistDiffWorkflow.php +++ b/src/workflow/diff/ArcanistDiffWorkflow.php @@ -302,7 +302,7 @@ EOTEXT 'repositoryUUID' => $repo_uuid, 'creationMethod' => 'arc', 'arcanistProject' => $working_copy->getProjectID(), - 'authorPHID' => $this->getUserGUID(), + 'authorPHID' => $this->getUserPHID(), ); $diff_info = $conduit->callMethodSynchronous( @@ -493,7 +493,7 @@ EOTEXT $result = $future->resolve(); echo "Updated an existing Differential revision:\n"; } else { - $revision['user'] = $this->getUserGUID(); + $revision['user'] = $this->getUserPHID(); $future = $conduit->callMethod( 'differential.createrevision', $revision); @@ -955,7 +955,7 @@ EOTEXT if (!phutil_console_confirm($message)) { throw new ArcanistUsageException('Specify reviewers and retry.'); } - } else if (in_array($this->getUserGUID(), $reviewers)) { + } else if (in_array($this->getUserPHID(), $reviewers)) { throw new ArcanistUsageException( "You can not be a reviewer for your own revision."); } diff --git a/src/workflow/list/ArcanistListWorkflow.php b/src/workflow/list/ArcanistListWorkflow.php index 19312b24..0ab5fd65 100644 --- a/src/workflow/list/ArcanistListWorkflow.php +++ b/src/workflow/list/ArcanistListWorkflow.php @@ -52,7 +52,7 @@ EOTEXT $revision_future = $conduit->callMethod( 'differential.find', array( - 'guids' => array($this->getUserGUID()), + 'guids' => array($this->getUserPHID()), 'query' => 'open', )); diff --git a/src/workflow/mark-committed/ArcanistMarkCommittedWorkflow.php b/src/workflow/mark-committed/ArcanistMarkCommittedWorkflow.php index 483de58e..8ed7ac83 100644 --- a/src/workflow/mark-committed/ArcanistMarkCommittedWorkflow.php +++ b/src/workflow/mark-committed/ArcanistMarkCommittedWorkflow.php @@ -69,7 +69,7 @@ EOTEXT array( 'query' => 'committable', 'guids' => array( - $this->getUserGUID(), + $this->getUserPHID(), ), ));