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;