cvs: pearweb /include pear-database.php
| From: | Greg Beaver | Date: | Fri, 21 Oct 2005 05:34:17 +0000 |
| Subject: | cvs: pearweb /include pear-database.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-35751@lists.php.net to get a copy of this message | ||
cellog Fri Oct 21 01:34:17 2005 EDT
Modified files:
/pearweb/include pear-database.php
Log:
add command to list all packages in a category
remove unused, unecessary variable and nuke notice
http://cvs.php.net/diff.php/pearweb/include/pear-database.php?r1=1.295&r2=1.296&ty=u
Index: pearweb/include/pear-database.php
diff -u pearweb/include/pear-database.php:1.295 pearweb/include/pear-database.php:1.296
--- pearweb/include/pear-database.php:1.295 Fri Oct 14 09:34:58 2005
+++ pearweb/include/pear-database.php Fri Oct 21 01:34:16 2005
@@ -17,7 +17,7 @@
| Tomas V.V.Cox <cox@php.net> |
| Martin Jansen <mj@php.net> |
+----------------------------------------------------------------------+
- $Id: pear-database.php,v 1.295 2005/10/14 13:34:58 mj Exp $
+ $Id: pear-database.php,v 1.296 2005/10/21 05:34:16 cellog Exp $
*/
require_once 'DB/storage.php';
@@ -248,6 +248,29 @@
}
// }}}
+ // {{{ proto array category::listPackages(string) API 1.0
+
+ /**
+ * Return a list of packages in this category
+ *
+ * @param string $category
+ * @return array
+ */
+ function listPackages($category)
+ {
+ global $dbh;
+ $query = 'SELECT
+ p.id, p.name
+ FROM
+ packages p, categories c
+ WHERE
+ p.category = c.id AND
+ c.name = ?';
+ $recent = $dbh->getAll($query, array($category), DB_FETCHMODE_ASSOC);
+ return $recent;
+ }
+
+ // }}}
// {{{ proto array category::getRecent(int, string) API 1.0
/**
@@ -832,7 +855,7 @@
"SELECT p.name, r.id AS rid, r.version AS stable, r.state AS state ".
"FROM packages p, releases r ".
"WHERE " . $package_type .
- ' p.id = r.package ' . $release_state .
+ ' p.id = r.package ' .
"ORDER BY r.releasedate ASC ", false, null, DB_FETCHMODE_ASSOC);
$stablereleases = $dbh->getAssoc(
"SELECT p.name, r.id AS rid, r.version AS stable, r.state AS state ".