getmemberships is now complete

This commit is contained in:
Jon Goldberg 2018-01-03 04:14:45 -05:00
parent b411b63827
commit e2b4f85e1b

View File

@ -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;