Add a statistics page that displays the number of users, active users, comments and applications.
This commit is contained in:
committed by
Jeremy Newman
parent
3b09de0902
commit
8ccc06ba4b
@@ -20,6 +20,7 @@ function global_sidebar_menu() {
|
|||||||
$g->add("Submit App", $apidb_root."appsubmit.php");
|
$g->add("Submit App", $apidb_root."appsubmit.php");
|
||||||
$g->add("Documentation", $apidb_root."help/");
|
$g->add("Documentation", $apidb_root."help/");
|
||||||
$g->add("Help & Support", $apidb_root."support.php");
|
$g->add("Help & Support", $apidb_root."support.php");
|
||||||
|
$g->add("Appdb Stats", $apidb_root."appdbStats.php");
|
||||||
$g->done();
|
$g->done();
|
||||||
|
|
||||||
$g = new htmlmenu("Search");
|
$g = new htmlmenu("Search");
|
||||||
|
|||||||
@@ -412,4 +412,20 @@ function getNotifyEmailAddressList($appId, $versionId)
|
|||||||
return $retval;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -189,4 +189,36 @@ function getQueuedMaintainerCount()
|
|||||||
return $ob->queued_maintainers;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -42,11 +42,7 @@ apidb_header("Wine Application Database");
|
|||||||
</p>
|
</p>
|
||||||
<?
|
<?
|
||||||
|
|
||||||
$countQuery = "SELECT count(versionId) as hits FROM appVersion WHERE versionName != 'NONAME'";
|
$numApps = getNumberOfVersions();
|
||||||
$result = mysql_query($countQuery);
|
|
||||||
$ob = mysql_fetch_object($result);
|
|
||||||
|
|
||||||
$numApps = $ob->hits;
|
|
||||||
|
|
||||||
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
|
$voteQuery = "SELECT appVotes.appId, appName, count(userId) as count ".
|
||||||
"FROM appVotes, appFamily ".
|
"FROM appVotes, appFamily ".
|
||||||
|
|||||||
Reference in New Issue
Block a user