Add a statistics page that displays the number of users, active users, comments and applications.

This commit is contained in:
Chris Morgan
2004-12-01 22:26:50 +00:00
committed by Jeremy Newman
parent 3b09de0902
commit 8ccc06ba4b
4 changed files with 50 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ function global_sidebar_menu() {
$g->add("Submit App", $apidb_root."appsubmit.php");
$g->add("Documentation", $apidb_root."help/");
$g->add("Help & Support", $apidb_root."support.php");
$g->add("Appdb Stats", $apidb_root."appdbStats.php");
$g->done();
$g = new htmlmenu("Search");

View File

@@ -412,4 +412,20 @@ function getNotifyEmailAddressList($appId, $versionId)
return $retval;
}
/* Get the number of users in the database */
function getNumberOfUsers()
{
$result = mysql_query("SELECT count(*) as num_users FROM user_list;");
$row = mysql_fetch_object($result);
return $row->num_users;
}
/* Get the number of active users within $days of the current day */
function getActiveUsersWithinDays($days)
{
$result = mysql_query("SELECT count(*) as num_users FROM user_list WHERE stamp >= 'NOW() - $days';");
$row = mysql_fetch_object($result);
return $row->num_users;
}
?>

View File

@@ -189,4 +189,36 @@ function getQueuedMaintainerCount()
return $ob->queued_maintainers;
}
/* Get the number of users in the database */
function getNumberOfComments()
{
$result = mysql_query("SELECT count(*) as num_comments FROM appComments;");
$row = mysql_fetch_object($result);
return $row->num_comments;
}
/* Get the number of versions in the database */
function getNumberOfVersions()
{
$result = mysql_query("SELECT count(versionId) as num_versions FROM appVersion WHERE versionName != 'NONAME';");
$row = mysql_fetch_object($result);
return $row->num_versions;
}
/* Get the number of app familes in the database */
function getNumberOfAppFamilies()
{
$result = mysql_query("SELECT count(*) as num_appfamilies FROM appFamily;");
$row = mysql_fetch_object($result);
return $row->num_appfamilies;
}
/* Get the number of images in the database */
function getNumberOfImages()
{
$result = mysql_query("SELECT count(*) as num_images FROM appData WHERE type='image';");
$row = mysql_fetch_object($result);
return $row->num_images;
}
?>

View File

@@ -42,11 +42,7 @@ apidb_header("Wine Application Database");
</p>
<?
$countQuery = "SELECT count(versionId) as hits FROM appVersion WHERE versionName != 'NONAME'";
$result = mysql_query($countQuery);
$ob = mysql_fetch_object($result);
$numApps = $ob->hits;
$numApps = getNumberOfVersions();
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
"FROM appVotes, appFamily ".