| <?php |
| /******************************************************************************* |
| * Copyright (c) 2010, 2013 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 |
| *******************************************************************************/ |
| |
| /** |
| * @deprecated |
| * |
| * Updated to pull Git data from the PMI. We need to re-evaluate how we |
| * interact between project data and Dash/Git. Today, Dash (and other services) |
| * use this script to determine what repositories it should care about and who |
| * owns them. Dash needs to be more self-contained. |
| */ |
| require_once(dirname(__FILE__) . '/common.inc'); |
| require_once(dirname(__FILE__) . '/../classes/Project.class.php'); |
| mustBeEclipseFoundationCaller(); |
| |
| header("Content-type: text/plain"); |
| switch($_REQUEST['type']) { |
| default: |
| case 'cvs': $type = 'LIKE "%cvsroot%"'; break; |
| case 'svn': $type = 'NOT LIKE "%cvsroot%" AND VALUE NOT LIKE "%git%"'; break; |
| case 'git': return getGitRepositories(); |
| } |
| |
| require_once ("/home/data/httpd/eclipse-php-classes/system/dbconnection.class.php"); |
| require_once ("/home/data/httpd/eclipse-php-classes/system/dbconnection_foundation_ro.class.php"); |
| |
| $_dbcf = new DBConnectionFoundation(); |
| $_dbhf = $_dbcf->connect(); |
| |
| $resultf = mysql_query("SELECT ProjectID FROM Projects |
| WHERE IsActive = TRUE", $_dbhf); |
| $active_projects = array(); |
| while( $rowf = mysql_fetch_assoc($resultf) ) { |
| $active_projects[$rowf['ProjectID']] = 1; |
| } |
| |
| $dbc = new DBConnection(); |
| $dbh = $dbc->connect(); |
| |
| $result = mysql_query("SELECT ProjectID, Value FROM v_projectinfo_merged |
| WHERE MainKey = 'sourcerepository' AND Value $type AND Value != ''", $dbh); |
| |
| while($row = mysql_fetch_assoc($result)) { |
| if( $active_projects[$row['ProjectID']] ) { |
| $repo = getSourceRepository($row['Value']); |
| echo $row['ProjectID'] . "\t" . $repo->getPath() . "\n"; |
| } |
| } |
| |
| function getGitRepositories() { |
| $json = json_decode(file_get_contents('https://projects.eclipse.org/json/repos/git'), true); |
| foreach($json as $project => $repositories) { |
| foreach($repositories as $repository) { |
| echo "$project\t$repository\n"; |
| } |
| } |
| } |
| ?> |