Cleanup: Make variable naming more clear

Match the generator name passed via the command line.
This commit is contained in:
2020-09-17 11:38:25 +02:00
parent 775a1c2eef
commit b2d7879162

View File

@@ -12,7 +12,7 @@ function getSVNRepositoryName($repository) {
// Get user's heys and put them to the configuration // Get user's heys and put them to the configuration
function handleSingleUserPHID( function handleSingleUserPHID(
$viewer, $userPHID, $repository, &$authfile, &$access) { $viewer, $userPHID, $repository, &$namemap, &$access) {
$user = id(new PhabricatorPeopleQuery()) $user = id(new PhabricatorPeopleQuery())
->setViewer($viewer) ->setViewer($viewer)
->withPHIDs(array($userPHID)) ->withPHIDs(array($userPHID))
@@ -26,9 +26,9 @@ function handleSingleUserPHID(
} }
$user_name = $user->getUserName(); $user_name = $user->getUserName();
if (!array_key_exists($user_name, $authfile)) { if (!array_key_exists($user_name, $namemap)) {
$authfile[$user_name] = array('email' => $user->loadPrimaryEmailAddress(), $namemap[$user_name] = array('email' => $user->loadPrimaryEmailAddress(),
'name' => $user->getRealName()); 'name' => $user->getRealName());
} }
$repository_name = getSVNRepositoryName($repository); $repository_name = getSVNRepositoryName($repository);
@@ -69,7 +69,7 @@ function handleSingleUserPHID(
// Parse repository and put it's members to the config file // Parse repository and put it's members to the config file
function handleSingleRepository( function handleSingleRepository(
$viewer, $repository, &$authfile, &$access) { $viewer, $repository, &$namemap, &$access) {
$policies = PhabricatorPolicyQuery::loadPolicies( $policies = PhabricatorPolicyQuery::loadPolicies(
$viewer, $viewer,
$repository); $repository);
@@ -94,11 +94,11 @@ function handleSingleRepository(
$memberPHIDs = $project->getMemberPHIDs(); $memberPHIDs = $project->getMemberPHIDs();
foreach ($memberPHIDs as $memberPHID) { foreach ($memberPHIDs as $memberPHID) {
handleSingleUserPHID( handleSingleUserPHID(
$viewer, $memberPHID, $repository, $authfile, $access); $viewer, $memberPHID, $repository, $namemap, $access);
} }
} else if ($type == PhabricatorPolicyType::TYPE_USER) { } else if ($type == PhabricatorPolicyType::TYPE_USER) {
handleSingleUserPHID( handleSingleUserPHID(
$viewer, $pushable->getPHID(), $repository, $authfile, $access); $viewer, $pushable->getPHID(), $repository, $namemap, $access);
} else if ($type == PhabricatorPolicyPHIDTypePolicy::TYPECONST) { } else if ($type == PhabricatorPolicyPHIDTypePolicy::TYPECONST) {
/* pass */ /* pass */
} else { } else {
@@ -114,7 +114,7 @@ function rebuildConfiguration($what) {
->setViewer($viewer) ->setViewer($viewer)
->execute(); ->execute();
$authfile = array(); $namemap = array();
$access = array(); $access = array();
require_once 'archived_repos.php'; require_once 'archived_repos.php';
@@ -128,7 +128,7 @@ function rebuildConfiguration($what) {
$type = $repository->getVersionControlSystem(); $type = $repository->getVersionControlSystem();
if ($type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN) { if ($type == PhabricatorRepositoryType::REPOSITORY_TYPE_SVN) {
handleSingleRepository( handleSingleRepository(
$viewer, $repository, $authfile, $access); $viewer, $repository, $namemap, $access);
} }
} }
@@ -149,7 +149,7 @@ function rebuildConfiguration($what) {
print("* = r\n\n"); print("* = r\n\n");
} }
} else if ($what == 'NAMEMAP') { } else if ($what == 'NAMEMAP') {
foreach ($authfile as $user => $data) { foreach ($namemap as $user => $data) {
print("$user\t${data['email']}\t${data['name']}\n"); print("$user\t${data['email']}\t${data['name']}\n");
} }
} }