logo       

cvs: pearweb / generateREST.php /include pear-database.php pear-format-htm: msg#00008

php.pear.core

Subject: cvs: pearweb / generateREST.php /include pear-database.php pear-format-html-form.php pear-rest.php

mj Wed Oct 4 09:45:09 2006 UTC

Modified files:
/pearweb/include pear-database.php pear-rest.php
pear-format-html-form.php
/pearweb generateREST.php
Log:
* Calling package::listAll() issues a few heavy SQL queries that are not
necessary for generating the REST files. Thus there is now a new method
package::listAllNames() which returns only the necessary data.

# This change became necessary because things like package editing exceeded
# the maximum execution time.


http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database.php?r1=1.311&r2=1.312&diff_format=u
Index: pearweb/include/pear-database.php
diff -u pearweb/include/pear-database.php:1.311
pearweb/include/pear-database.php:1.312
--- pearweb/include/pear-database.php:1.311 Mon Oct 2 10:55:37 2006
+++ pearweb/include/pear-database.php Wed Oct 4 09:45:09 2006
@@ -17,7 +17,7 @@
| Tomas V.V.Cox <cox@xxxxxxx> |
| Martin Jansen <mj@xxxxxxx> |
+----------------------------------------------------------------------+
- $Id: pear-database.php,v 1.311 2006/10/02 10:55:37 mj Exp $
+ $Id: pear-database.php,v 1.312 2006/10/04 09:45:09 mj Exp $
*/

require_once 'DB/storage.php';
@@ -817,6 +817,26 @@
}

// }}}
+ // {{{ NOEXPORT struct package::listAllNames()
+
+ /**
+ * Lists the IDs and names of all approved PEAR packages
+ *
+ * Returns an associative array where the key of each element is
+ * a package ID, while the value is the name of the corresponding
+ * package.
+ *
+ * @static
+ * @return array
+ */
+ function listAllNames()
+ {
+ global $dbh;
+
+ return $dbh->getAssoc("SELECT id, name FROM packages WHERE
package_type = 'pear' AND approved = 1");
+ }
+
+ // }}}
// {{{ proto struct package::listAll([bool], [bool], [bool]) API 1.0

/**
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-rest.php?r1=1.26&r2=1.27&diff_format=u
Index: pearweb/include/pear-rest.php
diff -u pearweb/include/pear-rest.php:1.26 pearweb/include/pear-rest.php:1.27
--- pearweb/include/pear-rest.php:1.26 Thu Oct 27 05:24:23 2005
+++ pearweb/include/pear-rest.php Wed Oct 4 09:45:09 2006
@@ -182,7 +182,7 @@
http://pear.php.net/dtd/rest.allpackages.xsd";>
<c>' . PEAR_CHANNELNAME . '</c>
';
- foreach (package::listAll(false, false, false) as $package => $gh)
+ foreach (package::listAllNames() as $package)
{
$info .= ' <p>' . $package . '</p>
';
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-format-html-form.php?r1=1.3&r2=1.4&diff_format=u
Index: pearweb/include/pear-format-html-form.php
diff -u pearweb/include/pear-format-html-form.php:1.3
pearweb/include/pear-format-html-form.php:1.4
--- pearweb/include/pear-format-html-form.php:1.3 Wed Jan 26 12:40:05 2005
+++ pearweb/include/pear-format-html-form.php Wed Oct 4 09:45:09 2006
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
| Author: Martin Jansen <mj@xxxxxxx> |
+----------------------------------------------------------------------+
- $Id: pear-format-html-form.php,v 1.3 2005/01/26 12:40:05 pajoye Exp $
+ $Id: pear-format-html-form.php,v 1.4 2006/10/04 09:45:09 mj Exp $
*/

require_once "HTML/Form.php";
@@ -29,7 +29,7 @@
*
* @author Martin Jansen <mj@xxxxxxx>
* @extends HTML_Form
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
class PEAR_Web_Form extends HTML_Form {

@@ -47,9 +47,9 @@
static $values = null;

if (!is_array($values)) {
- $list = package::listAll(false);
+ $list = package::listAllNames();

- foreach ($list as $p_name => $package) {
+ foreach ($list as $p_name) {
$values[$p_name] = $p_name;
}
}
http://cvs.php.net/viewvc.cgi/pearweb/generateREST.php?r1=1.8&r2=1.9&diff_format=u
Index: pearweb/generateREST.php
diff -u pearweb/generateREST.php:1.8 pearweb/generateREST.php:1.9
--- pearweb/generateREST.php:1.8 Thu Oct 27 04:57:51 2005
+++ pearweb/generateREST.php Wed Oct 4 09:45:09 2006
@@ -2,7 +2,7 @@
/**
* Generate static REST files for pear.php.net from existing data
* @author Greg Beaver <cellog@xxxxxxx>
- * @version $Id: generateREST.php,v 1.8 2005/10/27 04:57:51 cellog Exp $
+ * @version $Id: generateREST.php,v 1.9 2006/10/04 09:45:09 mj Exp $
*/
/**
* Useful files to have
@@ -90,7 +90,7 @@
require_once 'PEAR/PackageFile.php';
$config = &PEAR_Config::singleton();
$pkg = new PEAR_PackageFile($config);
-foreach (package::listAll(false, false, false) as $package => $info) {
+foreach (package::listAllNames() as $package) {
echo " $package\n";
$pear_rest->savePackageREST($package);
echo " Maintainers...";

--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise