Added simple check to see if urls are valid.
diff --git a/commits/repositories.php b/commits/repositories.php
index 6ac301c..64d369b 100644
--- a/commits/repositories.php
+++ b/commits/repositories.php
@@ -9,15 +9,32 @@
 * Contributors:
 *    Wayne Beaton (Eclipse Foundation)- initial API and implementation
 *******************************************************************************/
-$path = '/gitroot/';
-//$path = '/home/wayne/git/';
-$find="find $path -type d -name *.git | xargs -I '{}' git --git-dir={} rev-parse --git-dir 2> /dev/null";
+$path = '/gitroot/tycho';
+//$path = '/home/wayne/git/www';
 
-$handle = popen($find, 'r');
-while ($repository = fgets($handle)) {
-	captureRepository(trim($repository));
+scanForRepositories($path);
+
+function scanForRepositories($path) {
+	createTables();
+	$find="find $path -type d -name *.git | xargs -I '{}' git --git-dir={} rev-parse --git-dir 2> /dev/null";
+	$handle = popen($find, 'r');
+	while ($repository = fgets($handle)) {
+		captureRepository(trim($repository));
+	}
+	pclose($handle);
 }
-pclose($handle);
+
+function createTables() {
+	$sql = "create table if not exists repositories (
+			name varchar(100) not null,
+			git varchar(255) not null primary key,
+			gerrit varchar(255),
+			http varchar(255),
+			github varchar(255),
+			description varchar(1024)
+		)";
+	echo preg_replace('/\s/', ' ', $sql);
+}
 
 function captureRepository($repository) {
 	$name = getName($repository);
@@ -25,8 +42,10 @@
 	$gerrit = getGerritLink($repository);
 	$http = getHttpLink($repository);
 	$github = "https://github.com/eclipse/$name";
+	$description = addslashes(getDescription($repository));
 	
-	echo "update repositories set name='$name' git='$git' gerrit='$gerrit' http='$http' github='$github' where repo='$git');\n";
+	echo "insert ignore into repositories (name, git) values('$name', '$git');\n";
+	echo "update repositories set name='$name' git='$git' gerrit='$gerrit' http='$http' github='$github' $description='$description' where repo='$git');\n";
 }
 
 function getName($path) {
@@ -53,7 +72,21 @@
 	preg_match('/\/gitroot\/(.+)/', $path, $matches);
 	$partial = $matches[1];
 	$gerrit = "https://git.eclipse.org/r/p/$partial";
-	return $gerrit;
+	return isValidUrl($gerrit) ? $gerrit : '';
+}
+
+function getDescription($path) {
+	return @file_get_contents("$path/description");
+}
+
+function isValidUrl($url) {
+	foreach(get_headers($url) as $header) {
+		if (preg_match('/^HTTP.*(\d)\d\d/', $header, $matches)) {
+			// We are happy with 200 or 300 codes.
+			return $matches[1] == '2' || $matches[1] = '3';
+		}
+	}
+	return false;
 }
 
 // Pull in a list of repostories