[31370] trunk/www/includes/common.inc
jmpp at macports.org
jmpp at macports.org
Wed Nov 21 11:50:20 PST 2007
Revision: 31370
http://trac.macosforge.org/projects/macports/changeset/31370
Author: jmpp at macports.org
Date: 2007-11-21 11:50:18 -0800 (Wed, 21 Nov 2007)
Log Message:
-----------
Add categories_count() function to count the total number of distinct categories (wheter primary or secondary) that we have in our ports tree.
Modified Paths:
--------------
trunk/www/includes/common.inc
Modified: trunk/www/includes/common.inc
===================================================================
--- trunk/www/includes/common.inc 2007-11-21 19:30:29 UTC (rev 31369)
+++ trunk/www/includes/common.inc 2007-11-21 19:50:18 UTC (rev 31370)
@@ -100,6 +100,23 @@
}
+######################################################################
+
+# Total count of port categories:
+function categories_count() {
+ global $portsdb;
+
+ $result = mysql_query("SELECT COUNT(DISTINCT category) FROM $portsdb.categories") or die ("Error: " . mysql_error());
+ if ($result) {
+ $row = mysql_fetch_array($result);
+ $count = $row[0];
+ } else {
+ $count = 0;
+ }
+ return $count;
+}
+
+
######################################################################
# Warning against darwinports.com leach!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071121/e2390c49/attachment.html
More information about the macports-changes
mailing list