From b2d7879162b19d31fbde3b6119b9cac42c1c63c5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 17 Sep 2020 11:38:25 +0200 Subject: [PATCH] Cleanup: Make variable naming more clear Match the generator name passed via the command line. --- scripts/svnauth/rebuild_svnauth.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/svnauth/rebuild_svnauth.php b/scripts/svnauth/rebuild_svnauth.php index 695b1ec74b..879c55cfe8 100755 --- a/scripts/svnauth/rebuild_svnauth.php +++ b/scripts/svnauth/rebuild_svnauth.php @@ -12,7 +12,7 @@ function getSVNRepositoryName($repository) { // Get user's heys and put them to the configuration function handleSingleUserPHID( - $viewer, $userPHID, $repository, &$authfile, &$access) { + $viewer, $userPHID, $repository, &$namemap, &$access) { $user = id(new PhabricatorPeopleQuery()) ->setViewer($viewer) ->withPHIDs(array($userPHID)) @@ -26,9 +26,9 @@ function handleSingleUserPHID( } $user_name = $user->getUserName(); - if (!array_key_exists($user_name, $authfile)) { - $authfile[$user_name] = array('email' => $user->loadPrimaryEmailAddress(), - 'name' => $user->getRealName()); + if (!array_key_exists($user_name, $namemap)) { + $namemap[$user_name] = array('email' => $user->loadPrimaryEmailAddress(), + 'name' => $user->getRealName()); } $repository_name = getSVNRepositoryName($repository); @@ -69,7 +69,7 @@ function handleSingleUserPHID( // Parse repository and put it's members to the config file function handleSingleRepository( - $viewer, $repository, &$authfile, &$access) { + $viewer, $repository, &$namemap, &$access) { $policies = PhabricatorPolicyQuery::loadPolicies( $viewer, $repository); @@ -94,11 +94,11 @@ function handleSingleRepository( $memberPHIDs = $project->getMemberPHIDs(); foreach ($memberPHIDs as $memberPHID) { handleSingleUserPHID( - $viewer, $memberPHID, $repository, $authfile, $access); + $viewer, $memberPHID, $repository, $namemap, $access); } } else if ($type == PhabricatorPolicyType::TYPE_USER) { handleSingleUserPHID( - $viewer, $pushable->getPHID(), $repository, $authfile, $access); + $viewer, $pushable->getPHID(), $repository, $namemap, $access); } else if ($type == PhabricatorPolicyPHIDTypePolicy::TYPECONST) { /* pass */ } else { @@ -114,7 +114,7 @@ function rebuildConfiguration($what) { ->setViewer($viewer) ->execute(); - $authfile = array(); + $namemap = array(); $access = array(); require_once 'archived_repos.php'; @@ -128,7 +128,7 @@ function rebuildConfiguration($what) { $type = $repository->getVersionControlSystem(); if ($type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN) { handleSingleRepository( - $viewer, $repository, $authfile, $access); + $viewer, $repository, $namemap, $access); } } @@ -149,7 +149,7 @@ function rebuildConfiguration($what) { print("* = r\n\n"); } } else if ($what == 'NAMEMAP') { - foreach ($authfile as $user => $data) { + foreach ($namemap as $user => $data) { print("$user\t${data['email']}\t${data['name']}\n"); } }