error handling on mappings

This commit is contained in:
Jon Goldberg 2023-04-04 14:29:17 -04:00
parent ae8fb35f99
commit 9d4cce22d0
1 changed files with 3 additions and 1 deletions

View File

@ -30,7 +30,9 @@ function writeDomains($projectsByDomain) {
function writeUsers($projectsById, $membershipMapping) {
$userHandle = fopen(__DIR__ . '/data/usermap.csv', 'w');
foreach ($membershipMapping as $email => $projectId) {
fwrite ($userHandle, "$email,{$projectsById[$projectId]}\n");
if ($projectsById[$projectId] ?? FALSE) {
fwrite ($userHandle, "$email,{$projectsById[$projectId]}\n");
}
}
// Handle special user cases.
$specialUsers = fopen(__DIR__ . '/data/specialusers.csv', 'r');