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
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");
}
}