blob: 6f5060291e043d56ea7ea17eb9306a09d519fe11 [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2013, 2017 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wayne Beaton (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
// Temporary script to pull data for LocationTech forge in transition to
// Eclipse forge.
require_once(dirname(__FILE__) . "/../../eclipse.org-common/system/app.class.php");
$App = new App();
require_once(dirname(__FILE__) . "/../classes/common.php");
require_once(dirname(__FILE__) . "/../classes/database.inc");
require_once(dirname(__FILE__) . "/../classes/debug.php");
mustBeEclipseFoundationCaller();
// Export everybody who has ever had a project relationship.
$sql = "SELECT
p.PersonId as id, p.FName, p.LName, p.Email, pp.ProjectId, pp.Relation, pp.ActiveDate, pp.InactiveDate
from People as p join PeopleProjects as pp on p.PersonId = pp.PersonId
where pp.ProjectId like 'locationtech.%'";
$people = array();
query ('foundation',$sql, array(), function($row) use (&$people) {
$id = utf8_encode($row['id']);
$people[$id]['id'] = $id;
$people[$id]['first'] = $row['FName'];
$people[$id]['last'] = $row['LName'];
$people[$id]['email'] = $row['Email'];
$project = utf8_encode($row['ProjectId']);
$project = preg_replace("/^locationtech\./", 'technology.', $project);
$people[$id]['roles'][] = array(
// Remove the forge qualifer (if any).
'project' => $project,
'relation' => $row['Relation'],
'active' => date('Y-m-d' , strtotime($row['ActiveDate'])),
'inactive' => ($date = strtotime($row['InactiveDate'])) ? date('Y-m-d' , $date) : null
);
});
$output = array();
$output['debug']['sql'][] = $sql;
$output['people'] = $people;
echo json_encode($output);
?>