improve performance for large numbers of builds

This commit changes the way that index.php gathers its necessary
data.  My test case involved a subproject build that received
~5,500 builds per day.  Before this change, index.php?display=project
took roughly a minute to load.  With these changes, I have the load
time down under 4 seconds.
fix test for database upgrade
Merge remote-tracking branch 'origin/master' into improve_index_performance

Conflicts:
	index.php
Merge pull request #5 from Kitware/improve_index_performance

Improve load time of index.php when there are lots of builds