prep for build machines
diff --git a/downloadsites/webtools/artifacts/cleanup.sh b/downloadsites/webtools/artifacts/cleanup.sh
new file mode 100644
index 0000000..54cf1b8
--- /dev/null
+++ b/downloadsites/webtools/artifacts/cleanup.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# script to delete warm-up builds, except the one promoted
+# the promoted on is left just for safety
+
+
+declaredStream=$1
+declaredDir=$2
+# make sure directories to delete start with same 3 chars as target
+pattern=${declaredDir:0:5}
+
+
+echo restrict to directory names that match $pattern
+echo act on directories older than $declaredDir
+
+
+# example of full form from command line
+# find ./drops -maxdepth 1 -type d -name I-I* -not -cnewer drops/I-I200603180020-200603180020  -exec rm -fr {} \;
+
+
+if [ "$3" != "-doit" ] ; then
+   echo "    This is a dry run. Add -doit to actually remove"
+   thisCommand=" echo " 
+else 
+   thisCommand=" rm -fr "
+fi 
+
+
+
+find ./drops -maxdepth 2 -type d -name "$pattern*" -not -newer "./drops/$declaredStream/$declaredDir" -exec $thisCommand  {} \; 
+
+
+
+
diff --git a/downloadsites/webtools/artifacts/declare.sh b/downloadsites/webtools/artifacts/declare.sh
new file mode 100644
index 0000000..4700d7f
--- /dev/null
+++ b/downloadsites/webtools/artifacts/declare.sh
@@ -0,0 +1,24 @@
+echo $1 $2
+
+declaredStream=$1
+declaredDir=$2
+
+FROMDIR=../committers/drops
+TODIR=../downloads/drops/${declaredStream}
+FROMDIR=$FROMDIR/${declaredStream}/${declaredDir}
+echo  "declaring build ${declaredDir} on buildstream  ${declaredStream}"
+echo  "   into ${TODIR}"
+echo  "   using the build from ${FROMDIR}"
+
+
+cp -R ${FROMDIR} ${TODIR}
+
+fromString="webtools/committers"
+toString="webtools/downloads"
+replaceCommand="s!${fromString}!${toString}!g"
+
+perl -w -pi -e ${replaceCommand} ${TODIR}/${declaredDir}/*.php
+
+#       update the update site
+#cp -ruv $HOME/downloads/webtools/committers/drops/$1/updateSite/features/   $HOME/downloads/webtools/milestones/
+#cp -ruv $HOME/downloads/webtools/committers/drops/$1/updateSite/plugins/   $HOME/downloads/webtools/milestones/
diff --git a/downloadsites/webtools/artifacts/declareUpdates.sh b/downloadsites/webtools/artifacts/declareUpdates.sh
new file mode 100644
index 0000000..0095491
--- /dev/null
+++ b/downloadsites/webtools/artifacts/declareUpdates.sh
@@ -0,0 +1,17 @@
+
+declaredStream=$1
+declaredDir=$2
+
+FROMDIR=$HOME/downloads/webtools/committers/drops
+FROMDIR=$FROMDIR/${declaredStream}/${declaredDir}/updateSite
+
+TODIR=$HOME/downloads/webtools/declaredUpdates
+
+echo  "declaring update ${declaredDir} on buildstream  ${declaredStream}"
+echo  "   into ${TODIR}"
+echo  "   using the build from ${FROMDIR}"
+
+
+# update the update site with changes only
+rsync --ignore-existing -rv $FROMDIR/features $TODIR
+rsync --ignore-existing -rv $FROMDIR/plugins $TODIR
diff --git a/downloadsites/webtools/artifacts/dlconfig.txt b/downloadsites/webtools/artifacts/dlconfig.txt
new file mode 100644
index 0000000..8cf2851
--- /dev/null
+++ b/downloadsites/webtools/artifacts/dlconfig.txt
@@ -0,0 +1,11 @@
+dropPrefix[]=R&
+dropPrefix[]=M&
+dropPrefix[]=S&
+dropPrefix[]=I&
+dropPrefix[]=N&
+
+dropType[]=<b>R</b>eleased (In progress)&
+dropType[]=<b>M</b>aintenance (In progress)&
+dropType[]=<b>S</b>table (Milestone) (In progress)&
+dropType[]=<b>I</b>ntegration (In progress)&
+dropType[]=<b>N</b>ightly (Head) Build&
diff --git a/downloadsites/webtools/artifacts/index.php b/downloadsites/webtools/artifacts/index.php
new file mode 100644
index 0000000..bd04bab
--- /dev/null
+++ b/downloadsites/webtools/artifacts/index.php
@@ -0,0 +1,71 @@
+<?php
+echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n" ;
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<?php
+include 'pagePropertyVariables.php';
+?>
+
+<link rel="stylesheet" href="http://dev.eclipse.org/default_style.css" />
+<link rel="stylesheet" href="../wtpDropStyle.css" />
+<title><?php echo $pageTitle; ?></title>
+</head>
+<body>
+
+
+<?php
+
+// tiny banner to remind when looking at "local" machine results
+$serverName = $_SERVER["SERVER_NAME"];
+
+if (!stristr($serverName, "eclipse.org") && !stristr($serverName,"you.are.at.eclipsecon.org")) {
+    echo '<center>
+          <p>
+          Reminder: this is <font color="#FF0000">' . 
+    $serverName .
+    '</font>
+          See also 
+          <a href="http://download.eclipse.org/webtools/downloads" target="_top">
+          the live public Eclipse site
+          </a>.
+          </p>
+          <hr />
+          </center>';
+
+}
+
+if (function_exists("date_default_timezone_set")) {
+    date_default_timezone_set("UTC");
+    //echo "<p>default timezone: ";
+    //echo date_default_timezone_get();
+    //echo "</p>";
+}
+
+?>
+
+
+<?php
+ini_set("display_errors", "true");
+error_reporting (E_ALL);
+?>
+
+<?php
+$QString = $_SERVER['QUERY_STRING'];
+$C = strcmp($QString, "test");
+?>
+
+
+<?php
+include '../topAndInit.php';
+include '../latestBuilds.php';
+include '../recentHistory.php';
+include '../bottomAndFooter.php';
+?>
+
+
+</body>
+</html>
+
diff --git a/downloadsites/webtools/artifacts/pagePropertyVariables.php b/downloadsites/webtools/artifacts/pagePropertyVariables.php
new file mode 100644
index 0000000..967b78e
--- /dev/null
+++ b/downloadsites/webtools/artifacts/pagePropertyVariables.php
@@ -0,0 +1,32 @@
+<?php
+
+$pageTitle="Eclipse Web Tools Platform (WTP) Downloads - for Committers and
+Early Testers";
+$indexTop="<font class=indextop>
+Web Tools Platform<br />
+committer downloads</font><br />
+<font class=indexsub>Latest early trial downloads from the Web Tools Platform project</font>";
+
+$pageExplanation="
+    <p>This is the starting page for where you can find the latest <a
+      href=\"http://wiki.eclipse.org/index.php/WTP_Build_Types\">continuous build</a> produced by the <a
+      href=\"http://www.eclipse.org/webtools/main.php\">Eclipse Web Tools
+    Platform (WTP) Project</a>. Please note that each build page details
+    the pre-reqs for that particular build.</p>
+
+    <p>If you got here to this continuous-build site by accident or casual
+    browsing, please be aware that <a
+      href=\"http://download.eclipse.org/webtools/downloads/\" target=\"_top\">
+    declared builds</a> are available!</p>
+
+";
+
+$mainTableHeader="Latest Downloads (In progress, towards a declared build)";
+
+$pageFooterEnd="<p><a href=\"http://download.eclipse.org/webtools/downloads/\"
+              target=\"_top\">Declared builds</a> are available which are for
+            end-users and adopters.</p>"; 
+
+$subsectionHeading="Recent History";
+
+?>
\ No newline at end of file
diff --git a/downloadsites/webtools/artifacts/rename.sh b/downloadsites/webtools/artifacts/rename.sh
new file mode 100644
index 0000000..8d8b1f8
--- /dev/null
+++ b/downloadsites/webtools/artifacts/rename.sh
@@ -0,0 +1,312 @@
+#!/bin/bash
+
+#  build renamer script - fix/rename all of a given I/M/S build's artefacts instead of regen'ing them
+#    copy existing build folder; rename zips, md5s; sed text files
+
+# default path to builds
+buildDropsDir=$PWD;
+
+tmpdir=/home/data/users/jlanuti/downloads/webtools/committers/drops/tmp-renameBuild.sh-$USER;
+mkdir -p $tmpdir;
+
+verbose="";
+pairs="";
+
+# to use these colour escapes, must do `echo -e -e`
+red="\033[1;31m";		green="\033[1;32m";
+yellow="\033[1;33m";	blue="\033[1;34m"
+norm="\033[0;39m";
+
+# default to default properties file
+defaultPropertiesFile=./promoteToEclipse.properties
+propertiesFiles="";
+
+if [ $# -lt 1 ]; then
+  echo "";
+  echo "[ren] This script is used to copy, then rename an existing local build so that it can be promoted";
+  echo "      again under a new name. By renaming instead of rebuilding, binary compatibility is possible";
+  echo "      w/o having to retest. If -sub is not specified, script will look for the folder to rename ";
+  echo -e "      in the current folder ("$yellow""$PWD""$norm").";
+  echo "";
+  echo "[ren] Usage (<> = required, [] = optional, string replacements must be listed LAST, and will be";
+  echo "      processed IN ORDER listed.):";
+  echo "";
+  echo -e " "$green"sudo -u www-data $PWD/renameBuild.sh"$norm" [-sub <subprojectName>] \\"
+  echo -e "   -branch [sourceBranch"$blue"="$norm"]<targetBranch> -buildID <sourceBuildID"$blue"="$norm"targetBuildID> \\"
+  echo -e "   -buildAlias [sourceAlias"$blue"="$norm"]<targetAlias> \\";
+  echo -e "   [-verbose] [-buildDropsDir /path/to/some/folder] \\";
+  echo -e "   [beforestring"$blue"="$norm"afterstring] [beforestring2"$blue"="$norm"afterstring2] ... \\";
+  echo -e "   "$yellow"2>&1 | tee ~/renameBuild_\`date +%Y%m%d_%H%M%S\`.txt"$norm"";
+  echo "";
+  echo "[ren] To rename with string replacements [Eclipse driver folder & file]: ";
+  echo "";
+  echo -e " "$green"sudo -u www-data $PWD/renameBuild.sh"$norm" -sub "$red"emf"$norm" -verbose \\";
+  echo -e "   -branch 2.2.0 -buildID S200606271057"$blue"="$norm"R200606271057 -buildAlias 2.2.0RC9a"$blue"="$norm"2.2.0 \\";
+  echo -e "   eclipse-SDK-M20060609-1217-linux-gtk.tar.gz"$blue"="$norm"eclipse-SDK-3.2-linux-gtk.tar.gz \\";
+  echo -e "   M20060609-1217"$blue"="$norm"R-3.2-200606281325 \\";
+  echo -e "   /eclipse/downloads/drops/"$blue"="$norm"http://download.eclipse.org/downloads/drops/ \\"; # TODO: remove this hack once index.html pages are fixed after 2.2.0
+  echo -e "   fullmoon.torolab.ibm.com"$blue"="$norm"download.eclipse.org";
+  echo "";
+  echo "[ren] To rename with string replacements [Eclipse + EMF driver folders & files]: ";
+  echo "";
+  echo -e " "$green"sudo -u www-data $PWD/renameBuild.sh"$norm" -sub "$red"uml2"$norm" -verbose \\";
+  echo -e "   -branch 2.0.0 -buildID S200606221411"$blue"="$norm"R200606221411 -buildAlias 2.0RC9a"$blue"="$norm"2.0.0 \\";
+  echo -e "   eclipse-SDK-M20060609-1217-linux-gtk.tar.gz"$blue"="$norm"eclipse-SDK-3.2-linux-gtk.tar.gz \\";
+  echo -e "   M20060609-1217"$blue"="$norm"R-3.2-200606281325 \\";
+  echo -e "   /eclipse/downloads/drops/"$blue"="$norm"http://download.eclipse.org/downloads/drops/ \\";   # TODO: remove this hack once index.html pages are fixed after 2.0.0
+  echo -e "   emf-sdo-xsd-SDK-2.2.0RC9.zip"$blue"="$norm"emf-sdo-xsd-SDK-2.2.0.zip \\";
+  echo -e "   S200606221156"$blue"="$norm"R200606271057 \\";
+  #echo -e "   /tools/emf/downloads/drops/"$blue"="$norm"../../../../../../tools/emf/downloads/drops/ \\"; # TODO: remove this hack once index.html pages are fixed after 2.0.0
+  echo -e "   fullmoon.torolab.ibm.com"$blue"="$norm"download.eclipse.org";
+  echo -e "   emf.torolab.ibm.com"$blue"="$norm"download.eclipse.org";
+  echo "";
+  echo -e " "$green"sudo -u www-data $PWD/renameBuild.sh"$norm" -sub "$red"ocl"$norm" -verbose \\";
+  echo -e "   -branch 1.0.0 -buildID S200606261119"$blue"="$norm"R200606261119 -buildAlias 1.0.0RC6"$blue"="$norm"1.0.0 \\";
+  echo -e "   eclipse-SDK-M20060609-1217-linux-gtk.tar.gz"$blue"="$norm"eclipse-SDK-3.2-linux-gtk.tar.gz \\";
+  echo -e "   M20060609-1217"$blue"="$norm"R-3.2-200606281325 \\";
+  echo -e "   emf-sdo-xsd-SDK-2.2.0RC9.zip"$blue"="$norm"emf-sdo-xsd-SDK-2.2.0.zip \\";
+  echo -e "   S200606221156"$blue"="$norm"R200606271057 \\";
+  echo -e "   fullmoon.torolab.ibm.com"$blue"="$norm"download.eclipse.org";
+  echo -e "   emf.torolab.ibm.com"$blue"="$norm"download.eclipse.org";
+  echo "";
+  exit;
+fi
+
+echo "";
+echo -e "[ren] Started `date +%Y%m%d\ %H\:%M\:%S`.";  
+
+# collect cmdline options
+while [ $# -gt 0 ]; do
+    case $1 in
+    	'-branch') 
+   			# check if param 2 contains a "="
+			t=$2;t=${t##*=*}; # get a nullstring if there was a "=" in the string
+			if [ "x$t" = "x" ]; then # $
+	    		sourceBranch=$2; sourceBranch=${sourceBranch%%=*}; # trim from = to end
+				targetBranch=$2; targetBranch=${targetBranch##*=}; # trim up to the =
+			else
+				sourceBranch=$2;
+				targetBranch=$2;
+			fi
+			shift 1;
+			;;
+    	'-buildID') 
+    		sourceBuildID=$2; sourceBuildID=${sourceBuildID%%=*}; # trim from = to end
+			targetBuildID=$2; targetBuildID=${targetBuildID##*=}; # trim up to the =
+			shift 1;
+			;;
+    	'-buildAlias') 
+			# check if param 2 contains a "="
+			t=$2;t=${t##*=*}; # get a nullstring if there was a "=" in the string
+			if [ "x$t" = "x" ]; then # $
+	    		sourceAlias=$2; sourceAlias=${sourceAlias%%=*}; # trim from = to end
+				targetAlias=$2; targetAlias=${targetAlias##*=}; # trim up to the =
+			else
+				sourceAlias=$sourceBuildID;
+				targetAlias=$2;
+			fi
+			shift 1;
+			;;
+		'-sub')
+			subprojectName=$2;
+			#echo "   $1 $2";
+			# chain them together in order of priority: override (if applic), subproj specific one, default
+			propertiesFiles=$propertiesFiles" ./promoteToEclipse."$subprojectName".properties "$defaultPropertiesFile; 
+			loaded=0;
+			for propertiesFile in $propertiesFiles; do
+			  if [ "$loaded" -eq 0 ] && [ -r $propertiesFile ]; then 
+				echo -n "    [loading $propertiesFile ... "; . $propertiesFile; echo "done]"; loaded=1;
+			  fi
+			done
+			if [ "$loaded" -eq 0 ]; then
+			    echo "    [Can't load any of: $propertiesFiles. Exiting!]";
+			    exit 99;
+			fi
+			shift 1
+			;;
+
+        '-buildDropsDir')
+            buildDropsDir=$2;
+            shift 1;
+            ;;
+        '-verbose')
+            verbose="true";
+            shift 0;
+            ;;
+        *)
+            pairs=$pairs" "$1;
+            shift 0;
+            ;;
+    esac
+    shift 1
+done
+
+if [ "$subprojectName" = "" ]; then # no value set!
+  echo "[promote] No subproject name set in properties file or by -sub flag. Script cannot continue. Exiting...";
+  exit 99;
+fi
+
+getBuildType () 
+{
+  tmpType=$1; tmpType=${tmpType:0:1}; # one of N, M, I, S, R
+  #echo -e "tmpType=$tmpType";
+  case $tmpType in
+    'N')
+    tmpType='Nightly';
+    ;;
+    'M')
+    tmpType='Maintenance';
+    ;;
+    'I')
+    tmpType='Integration';
+    ;;
+    'S')
+    tmpType='Stable';
+    ;;
+    'R')
+    tmpType='Release';
+    ;;
+  esac
+}
+
+getBuildType $sourceBuildID; sourceType=$tmpType;
+getBuildType $targetBuildID; targetType=$tmpType;
+
+echo "";
+echo -e "[ren] Source: branch=$red$sourceBranch$norm; build=$red$sourceBuildID$norm; type=$red$sourceType$norm; alias=$red$sourceAlias$norm";
+echo -e "[ren] Target: branch=$green$targetBranch$norm; build=$green$targetBuildID$norm; type=$green$targetType$norm; alias=$green$targetAlias$norm";
+if [ "x$verbose" != "x" ] && [ "x$pairs" != "x" ]; then
+  echo -e "[ren] Substitution pairs:";
+  for pair in $pairs; do
+      before=$pair; before=${before%%=*}; # trim from the = to the end 
+      after=$pair;  after=${after##*=};  # trim up to the = 
+      if [ "$before" != "$after" ]; then
+          echo -e "        $red$before$norm -> $green$after$norm";
+      fi
+  done
+fi
+
+# define source/target folders
+sourceFolder="$buildDropsDir/$sourceBranch/$sourceBuildID";
+targetFolder="$buildDropsDir/$targetBranch/$targetBuildID";
+
+echo ""; 
+echo -e "[ren] Step 1: copy $sourceFolder";
+echo -e "                to $targetFolder";
+mkdir -p $targetFolder; cp -r $sourceFolder/* $targetFolder/;
+
+echo ""; echo -e "[ren] Step 2: rename any zip/md5 files in target folder matching "$sourceBuildID;
+cd $targetFolder;
+
+list=`find $targetFolder -name "*$sourceBuildID\.zip*" -o -name "*$sourceAlias\.zip*"`
+num=0;
+for file in $list; do
+  (( num++ ));
+done
+
+cnt=0;
+for file in $list; do
+  (( cnt++ ));
+  targ="$file";
+  targ="${targ//$sourceAlias/$targetAlias}";
+  targ="${targ//$sourceBuildID/$targetAlias}";
+  targ="${targ//$sourceBranch/$targetBranch}";
+  if [ "x$verbose" != "x" ]; then
+    echo -e "[ren] [$blue$cnt$norm/$blue$num$norm] "${file##*\/}" -> "${targ##*\/};
+  fi
+  mv -f "$file" "$targ";
+done
+
+if [ "x$verbose" = "x" ]; then
+  echo -e "[ren] $green$num$norm files renamed.";
+fi
+
+echo ""; 
+echo -e "[ren] Step 3: fix text files (xml, md5, html, txt) with $red$sourceAlias$norm, $red$sourceBuildID$norm, $red$sourceBranch$norm or $red$sourceType$norm";
+
+# pass in a /fully/qualifed/path/to/a/file and a group owner (eg., www-data); fsize will contain the filesize in bytes
+getFileSize() 
+{
+  f=$1; # file name
+  g=$2; # group name
+  fsize=`alias ls='ls' && ls -ls "$f"`; fsize=${fsize%%"$f"*}; fsize=${fsize##*$g}; 
+  fsize=`echo -e $fsize | sed -e 's/[a-zA-Z\-]//g' -e 's/.*       //g' -e 's/[0-9]\+\ \+[0-9]\+\:[0-9]\+//g' -e 's/[\/\ \.]\+//g'`
+}
+
+totalnum=0;
+for ext in "xml" "md5" "html" "txt" "cfg" "php"; do
+  list=`find $targetFolder -name "*\.$ext"`;
+  num=0;
+  for file in $list; do
+    (( totalnum++ ));
+    (( num++ ));
+  done
+
+  cnt=0;
+  for file in $list; do
+    (( cnt++ ));
+    if [ `cat $file | grep -c "$sourceBuildID\|$sourceBranch"` > 0 ]; then # file contains the string, must sed it
+      filename="${file##*\/}";
+      tmpfile="$tmpdir/$filename";
+      tmpfile2="$tmpdir/$filename"2;
+      if [ "x$verbose" != "x" ]; then
+        echo -e -n "[ren] [$blue$cnt$norm/$blue$num$norm] Replacing $yellow$filename$norm: ";
+      fi
+
+      # get old filesize
+      getFileSize "$file" "www-data"; res1=$fsize;
+
+      # make changes: 
+      # replace "N2004...".zip with "2.0.2".zip
+      # replace "Nightly Build: N2004..." with "Release Build: 2.0.2"
+      # replace "Nightly" with "Release"
+      # replace "N2004..." with "R2004..."
+      # replace "2.0.3.1" with "2.0.4"
+      
+      # to escape "." as "\." use ${foo//./\\.} instead of $foo
+      cat "$file" | sed \
+        -e 's/'${sourceAlias//./\\.}'/'${targetAlias//./\\.}'/g' \
+        -e 's/'${sourceBuildID//./\\.}\.zip'/'${targetAlias//./\\.}\.zip'/g' \
+        -e 's/'$sourceType' Build\: '${sourceBuildID//./\\.}'/'$targetType' Build\: '${targetAlias//./\\.}'/g' \
+        -e 's/'$sourceType'/'$targetType'/g' \
+        -e 's/'${sourceBuildID//./\\.}'/'${targetBuildID//./\\.}'/g' \
+        -e 's/'${sourceBranch//./\\.}'/'${targetBranch//./\\.}'/g' \
+        > "$tmpfile";
+
+      # replace <beforestring> with <afterstring>, eg., eclipse-SDK-I20050201-0800-linux-gtk.zip with eclipse-SDK-3.1M5-linux-gtk.tar.gz
+      if [ "x$pairs" != "x" ]; then
+          for pair in $pairs; do
+              before=$pair; before=${before%%=*}; # trim from the = to the end 
+              after=$pair;  after=${after##*=};  # trim up to the = 
+              before=${before//\//\\\/}; before=${before//./\\.}; # escape "." and "/"
+              after=${after//\//\\\/};   after=${after//./\\.};   # escape "." and "/"
+              if [ "$before" != "$after" ]; then
+                  cat "$tmpfile" | sed -e 's/'"$before"'/'"$after"'/g' > "$tmpfile2";
+                  mv -f "$tmpfile2" "$tmpfile";
+              fi
+          done
+      fi
+
+      # get new filesize
+      getFileSize "$tmpfile" "www-data"; res2=$fsize;
+
+      # replace file
+      if [ "x$verbose" != "x" ]; then
+        echo -e "size: $res1 -> $res2";
+      fi
+      mv -f "$tmpfile" "$file";
+    fi
+  done
+  if [ "x$verbose" != "x" ]; then
+    echo "";
+  fi
+done
+
+if [ "x$verbose" = "x" ]; then
+  echo -e "[ren] $green$totalnum$norm files changed.";
+  echo "";
+fi
+
+rm -fr $tmpdir;
+echo "[ren] Finished `date +%Y%m%d\ %H\:%M\:%S`. Please verify that your build's index.html contains no invalid links.";  
+echo "";
diff --git a/downloadsites/webtools/artifacts/report.php b/downloadsites/webtools/artifacts/report.php
new file mode 100644
index 0000000..8266879
--- /dev/null
+++ b/downloadsites/webtools/artifacts/report.php
@@ -0,0 +1,147 @@
+<?php
+  function count_pattern($directory, $filenameFilter, $pattern)
+  {
+    $count = 0;
+    $dir = dir($directory);
+    while ($anEntry = $dir->read())
+    {
+      if ($anEntry != "." && $anEntry != "..")
+      {
+        $anEntry = $directory."/".$anEntry;
+        if (is_dir($anEntry))
+        {
+          $count += count_pattern($anEntry, $filenameFilter, $pattern);
+        }
+        else
+        {
+          if (stristr($anEntry, $filenameFilter))
+          {
+            $handle = @fopen($anEntry, "r");
+            if (FALSE !== $handle) {
+                   $size = filesize($anEntry);
+                   $content = fread($handle, $size);
+                   fclose($handle);
+                   $count += substr_count($content, $pattern);
+          }
+        }
+      }
+    }
+    }
+    return $count;
+  }
+
+  function parse_testResult($filename)
+  {
+    $junitFailures = 0;
+    $compileErrors = 0;
+    $compileWarnings = 0;
+     if (is_file($filename)) {
+     $handle = @fopen($filename, "r");
+    if ($handle)
+    {
+      $size = filesize($filename);
+      $content = fread($handle, $size);
+      fclose($handle);
+      $junitStart = strpos($content, "Errors &amp; Failures");
+      $junitEnd = strpos($content, "</table>", $junitStart);
+      $junitInfo = substr($content, $junitStart, $junitEnd - $junitStart);
+      $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">");
+      while ($start !== false)
+      {
+        $start += 29;
+        $stop = strpos($junitInfo, "</font></b></td>", $start);
+        if ($stop !== false)
+        {
+          $result = substr($junitInfo, $start, $stop - $start);
+          if (is_numeric($result))
+          {
+            $junitFailures += $result;
+          }
+          else if (strcmp($result, "DNF") == 0)
+          {
+            $junitFailures++;
+          }
+        }
+        $start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">", $stop);
+      }
+      $compileStart = strpos($content, "Compile Logs (Jar Files)");
+      $compileEnd = strpos($content, "</table>", $compileStart);
+      $compileInfo = substr($content, $compileStart, $compileEnd - $compileStart);
+      $rowStart = strpos($compileInfo, "<tr>");
+      while ($rowStart !== false)
+      {
+        $start += 4;
+        $rowStop = strpos($compileInfo, "</tr>", $rowStart);
+        if ($rowStop !== false)
+        {
+          $row = substr($compileInfo, $rowStart, $rowStop - $rowStart);
+          $cellStart = strpos($row, "<td");
+          $gotError = false;
+          $gotWarning = false;
+          while ($cellStart !== false && (!$gotError || !$gotWarning))
+          {
+            // this parsing logic got a bit more complicated in M2_33 basebuild, as the
+            // tag <td align="center"> was used, instead of <td>
+            // $cellStart += 4;
+            $cellStart = strpos($row, ">", $cellStart);
+            $cellStart = $cellStart + 1;
+            $cellStop = strpos($row, "</td>", $cellStart);
+            if ($cellStop !== false)
+            {
+              $cell = substr($row, $cellStart, $cellStop - $cellStart);
+              if (is_numeric($cell))
+              {
+                if (!$gotError)
+                {
+                  $compileErrors += $cell;
+                  $gotError = true;
+                }
+                else if (!$gotWarning)
+                {
+                  $compileWarnings += $cell;
+                  $gotWarning = true;
+                }
+              }
+            }
+             // this parsing logic got a bit more complicated in M2_33 basebuild, as the
+            // tag <td align="center"> was used, instead of <td>
+            $cellStart = strpos($row, "<td", $cellStop);
+          }
+        }
+        $rowStart = strpos($compileInfo, "<tr>", $rowStop);
+      }
+    }
+    }
+    $results = array($compileErrors, $compileWarnings, $junitFailures);
+    return $results;
+  }
+
+  function parse($filename, $key)
+  {
+    if (!is_readable($filename))
+    {
+      return 0;
+    }
+    $value;
+    $handle = @fopen($filename, "r");
+    if (!$handle)
+    {
+      return 0;
+    }
+    $size = filesize($filename);
+    $content = fread($handle, $size);
+    fclose($handle);
+    $start = strpos($content, $key);
+    while ($start !== false)
+    {
+      $start += strlen($key);
+      $stop = strpos($content, "\"", $start);
+      if ($stop !== false)
+      {
+        $value += substr($content, $start, $stop - $start);
+      }
+      $start = strpos($content, $key, $stop);
+    }
+    return $value;
+  }
+?>
diff --git a/downloadsites/webtools/artifacts/report2.php b/downloadsites/webtools/artifacts/report2.php
new file mode 100644
index 0000000..0859c0d
--- /dev/null
+++ b/downloadsites/webtools/artifacts/report2.php
@@ -0,0 +1,127 @@
+
+        <?php
+
+function parse2_testResults($filename)
+{
+	$junitFailures = -1;
+	if (is_file($filename)) {
+		$handle = @fopen($filename, "r");
+		if ($handle)
+		{
+			$junitFailures = 0;
+			$size = filesize($filename);
+			$content = fread($handle, $size);
+			fclose($handle);
+			$junitStart = strpos($content, "Errors &amp; Failures");
+			$junitEnd = strpos($content, "</table>", $junitStart);
+			$junitInfo = substr($content, $junitStart, $junitEnd - $junitStart);
+			$start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">");
+			while ($start !== false)
+			{
+				$start += 29;
+				$stop = strpos($junitInfo, "</font></b></td>", $start);
+				if ($stop !== false)
+				{
+					$result = substr($junitInfo, $start, $stop - $start);
+					if (is_numeric($result))
+					{
+						$junitFailures += $result;
+					}
+					else if (strcmp($result, "DNF") == 0)
+					{
+						$junitFailures++;
+					}
+				}
+				$start = strpos($junitInfo, "<td><b><font color=\"#ff0000\">", $stop);
+			}
+			$results = array($junitFailures);
+			return $results;
+		}
+	}
+}
+
+function parse2_compileResults($filename)
+{
+        $compileErrors = 0;
+        $compileAccessWarnings = 0;
+        $compileOtherWarnings = 0;
+        if (is_file($filename)) {
+                //echo "$filename<br />";
+                $handle = @fopen($filename, "r");
+                if ($handle)
+                {
+                        $size = filesize($filename);
+                        //echo "size: $size<br />";
+                        $content = fread($handle, $size);
+                        fclose($handle);
+
+                        //echo "$content";
+                        $compileStart = strpos($content, "<table id=tabledata");
+                        $compileEnd = strpos($content, "</table", $compileStart);
+                        $compileInfo = substr($content, $compileStart, $compileEnd - $compileStart);
+                        //echo "compileInfo: $compileInfo<br />";
+                        $rowStart = strpos($compileInfo, "<tr>");
+                        $rowStart = strpos($compileInfo, "<tr>");
+                        $start = $rowStart+4;
+                        while ($rowStart !== false)
+                        {
+
+                                $start += 4;
+                                $rowStop = strpos($compileInfo, "</tr>", $rowStart);
+                                //if ($rowStop !== false)
+                                //{
+                                        $row = substr($compileInfo, $rowStart, $rowStop - $rowStart);
+                                        //echo "$row";
+                                        //while ($cellStart !== false)
+                                        //{
+                                                // this parsing logic got a bit more complicated in M5_33 basebuild, as the
+                                                // a whole different structure was used.
+                                                // we'll try to quick fix this, but need our own index task
+                                                $cellStart = strpos($row, "#ERROR");
+                                                $cellStart = strpos($row, ">", $cellStart);
+                                                $cellStart = $cellStart + 1;
+                                                $cellStop = strpos($row, "<", $cellStart);
+                                                if ($cellStop !== false)
+                                                {
+                                                        $cell = substr($row, $cellStart, $cellStop - $cellStart);
+                                                        if (is_numeric($cell))
+                                                        {
+                                                                        $compileErrors += $cell;
+                                                        }
+                                                        $cellStart = strpos($row, "#ACCESSRULES_WARNINGS");
+                                                        $cellStart = strpos($row, ">", $cellStart);
+                                                        $cellStart = $cellStart + 1;
+                                                        $cellStop = strpos($row, "<", $cellStart);
+                                                        $cell = substr($row, $cellStart, $cellStop - $cellStart);
+                                                        if (is_numeric($cell))
+                                                        {
+                                                                        $compileAccessWarnings += $cell;
+                                                        }
+                                                        $cellStart = strpos($row, "#OTHER_WARNINGS");
+                                                        $cellStart = strpos($row, ">", $cellStart);
+                                                        $cellStart = $cellStart + 1;
+                                                        $cellStop = strpos($row, "<", $cellStart);
+                                                        $cell = substr($row, $cellStart, $cellStop - $cellStart);
+                                                        if (is_numeric($cell))
+                                                        {
+                                                                        $compileOtherWarnings += $cell;
+                                                        }
+                                                }
+                                                // look for next row.
+                                                //$cellStart = strpos($row, "<tr", $cellStop);
+                                        //}
+                                //}
+                                $rowStart = strpos($compileInfo, "<tr>", $rowStop);
+                        }
+                }
+        }
+
+        $results = array($compileErrors, $compileAccessWarnings, $compileOtherWarnings);
+        return $results;
+}
+
+
+
+?>
+
+