From e2b4f85e1be472d347f18f37c194350b799b13db Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Wed, 3 Jan 2018 04:14:45 -0500 Subject: [PATCH] getmemberships is now complete --- getmemberships.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/getmemberships.php b/getmemberships.php index 71b393f..d926e6b 100755 --- a/getmemberships.php +++ b/getmemberships.php @@ -12,8 +12,7 @@ list($projectsById, $projectsByDomain) = getProjectList($limit, $offset, $client writeDomains($projectsByDomain); $userList = getUserList($limit, $offset, $client); $membershipMapping = getUserMemberships($userList, $client); -print_r($projectsById); -print_r($membershipMapping); +writeUsers($projectsById, $membershipMapping); function writeDomains($projectsByDomain) { $domainHandle = fopen('./data/domainmap.csv', 'w'); @@ -23,6 +22,14 @@ function writeDomains($projectsByDomain) { fclose($domainHandle); } +function writeUsers($projectsById, $membershipMapping) { + $domainHandle = fopen('./data/usermap.csv', 'w'); + foreach ($membershipMapping as $email => $projectId) { + fwrite ($domainHandle, "$email,{$projectsById[$projectId]}\n"); + } + fclose($domainHandle); +} + function getProjectList($limit, $offset, $client) { // We'll set a more realistic total user count after the first loop. $totalProjects = 99999;