cvs: pearweb /include pear-database.php /public_html package-new.php packages.php /sql addcategories.php addpackages.php addusers.php data.php
| From: | Stig Bakken | Date: | Tue, 04 Sep 2001 05:10:31 +0000 |
| Subject: | cvs: pearweb /include pear-database.php /public_html package-new.php packages.php /sql addcategories.php addpackages.php addusers.php data.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-788@lists.php.net to get a copy of this message | ||
ssb Tue Sep 4 01:10:31 2001 EDT
Added files:
/pearweb/sql addpackages.php addusers.php
Modified files:
/pearweb/include pear-database.php
/pearweb/public_html package-new.php packages.php
/pearweb/sql addcategories.php data.php
Log:
* added packages in pear/ as test data
Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.13 pearweb/include/pear-database.php:1.14 --- pearweb/include/pear-database.php:1.13 Sun Sep 2 21:58:27 2001 +++ pearweb/include/pear-database.php Tue Sep 4 01:10:30 2001 @@ -62,7 +62,7 @@ $tree[$node]['leftvisit'] = $visitno; $inc = 1; if (isset($cnt[$node])) { - $inc += $cnt[$node] * 2; + $inc += $cnt[$node]; } if ($debug) { var_dump($cnt[$node]); @@ -189,22 +189,22 @@ $license = "PEAR License"; } if (empty($category)) { - return PEAR::raiseError("no `category' field"); + return PEAR::raiseError("add_package: no `category' field"); } if (empty($name)) { - return PEAR::raiseError("no `name' field"); + return PEAR::raiseError("add_package: no `name' field"); } - $query = "INSERT INTO packages (id,name,category,license,summary,". - "description) VALUES(?,?,?,?,?,?)"; + $query = "INSERT INTO packages (id,name,category,license,summary,description) VALUES(?,?,?,?,?,?)"; $id = $dbh->nextId("packages"); - $sth = $dbh->prepare($query); - if (DB::isError($sth)) { + if (DB::isError($sth = $dbh->prepare($query))) { return $sth; } - $err = $dbh->execute($sth, array($id, $name, $category, $license, - $summary, $description)); + $err = $dbh->execute($sth, array($id, $name, $category, $license, $summary, $description)); if (DB::isError($err)) { return $err; + } + if (isset($lead) && DB::isError($err = add_maintainer($id, $lead, 'lead'))) { + return $err; } if (DB::isError($err = renumber_visitations())) { return $err; Index: pearweb/public_html/package-new.php diff -u pearweb/public_html/package-new.php:1.1 pearweb/public_html/package-new.php:1.2 --- pearweb/public_html/package-new.php:1.1 Sun Sep 2 00:39:16 2001 +++ pearweb/public_html/package-new.php Tue Sep 4 01:10:30 2001 @@ -38,6 +38,7 @@ 'license' => $license, 'summary' => $summary, 'description' => $desc, + 'lead' => $PHP_AUTH_USER, )); $dbh->popExpect(); if (DB::isError($pkg) && $pkg->getCode() == DB_ERROR_ALREADY_EXISTS) { @@ -45,7 +46,6 @@ "Package already exists"); exit; } - $err = add_maintainer($pkg, $PHP_AUTH_USER, 'lead'); $display_form = false; response_header("Package Registered"); print "The package `$name' has been registered in PEAR.<br />\n"; Index: pearweb/public_html/packages.php diff -u pearweb/public_html/packages.php:1.11 pearweb/public_html/packages.php:1.12 --- pearweb/public_html/packages.php:1.11 Sun Sep 2 23:38:48 2001 +++ pearweb/public_html/packages.php Tue Sep 4 01:10:30 2001 @@ -25,7 +25,9 @@ $nrow = 0; while ($sth->fetchInto($row)) { extract($row); - $npackages = ($rightvisit - $leftvisit - 1) / 2; + $npackages = $rightvisit - $leftvisit - 1; +// $d = $rightvisit - $leftvisit; +// if ($d > 0) $npackages = ($d + 1) / 2; if ($npackages == 0) { //continue; // XXXX Uncomment me to only show categories with packages } // XXXX change me with elseif (show table head only when there are values) Index: pearweb/sql/addcategories.php diff -u pearweb/sql/addcategories.php:1.2 pearweb/sql/addcategories.php:1.3 --- pearweb/sql/addcategories.php:1.2 Sat Sep 1 22:21:46 2001 +++ pearweb/sql/addcategories.php Tue Sep 4 01:10:31 2001 @@ -1,49 +1,44 @@ <?php -// Drops all categories and adds sample categories - -error_reporting(E_ALL); -require_once 'DB.php'; -require_once 'DB/storage.php'; -require_once '../include/pear-database.php'; - -if (empty($dbh)) { - $dbh = DB::connect('mysql://pear:pear@localhost/pear'); - $dbh->setErrorHandling(PEAR_ERROR_DIE); -} +print "Adding categories...\n"; +$dbh->expectError(DB_ERROR_NOSUCHTABLE); $dbh->query('DELETE FROM categories'); -$categories = array( - 'Benchmarking' => '', - 'Caching' => '', - 'Console' => '', - 'Encryption' => '', - 'Database' => '', - 'Date and Time' => '', - 'File System' => '', - 'HTML' => '', - 'HTTP' => '', - 'Images' => '', - 'Logging' => '', - 'Mail' => '', - 'Math' => '', - 'Networking' => '', - 'Numbers' => '', - 'Payment' => '', - 'Scheduling' => '', - 'XML' => '' -); +$dbh->dropSequence('categories'); +$dbh->popExpect(); + +$categories = ' +Authentication; +Benchmarking; +Caching; +Configuration; +Console; +Encryption; +Database; +Date and Time; +File System; +HTML; +HTTP; +Images; +Logging; +Mail; +Math; +Networking; +Numbers; +Payment; +PEAR;PEAR infrastructure +Scheduling; +Science; +XML; +'; -foreach($categories as $name => $desc) { +foreach (explode("\n", $categories) as $line) { + if (trim($line) == '') { + continue; + } + list($name, $desc) = explode(";", trim($line)); add_category(array('name' => $name, 'desc' => $desc)); + print "Category: $name\n"; } -/*$sql = 'select * from categories order by id'; -$res = $dbh->query($sql); -echo "-------------------\n"; -while($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { - foreach($row as $field => $value) { - echo "$field => $value\n"; - } - echo "-------------------\n"; -}*/ + ?> Index: pearweb/sql/data.php diff -u pearweb/sql/data.php:1.4 pearweb/sql/data.php:1.5 --- pearweb/sql/data.php:1.4 Sun Sep 2 00:15:44 2001 +++ pearweb/sql/data.php Tue Sep 4 01:10:31 2001 @@ -1,15 +1,14 @@ <?php require_once "DB.php"; +require_once "../include/pear-database.php"; PEAR::setErrorHandling(PEAR_ERROR_DIE); list($progname, $type, $user, $pass, $db) = $argv; $dbh = DB::connect("$type://$user:$pass@localhost/$db"); -$dbh->query("INSERT INTO users VALUES('ssb', '738aa8d3bc02eb8712acd0eb2cf6dfd5', 'Stig S. Bakken', 'stig@php.net', 'http://www.pvv.org/~ssb/', '2001-04-18', 'ssb', NULL, 1, 1, 1, NULL)"); -$dbh->query("INSERT INTO users VALUES('mj', '4f5c2e35084da4469fb82cc494eeb847', 'Martin Jansen', 'mj@php.net', 'http://martin-jansen.de/', '2001-05-24', 'mj', NULL, 1, 1, 1, NULL)"); -$dbh->query("INSERT INTO users VALUES('cox', '124854bf5ca680411fca8676e6014819', 'Tomas V.V.Cox', 'cox@php.net', 'http://vulcanonet.com', '2001-08-31', 'cox', NULL, 1, 1, 1, NULL)"); - +include "./addusers.php"; include "./addcategories.php"; +include "./addpackages.php"; ?> Index: pearweb/sql/addpackages.php +++ pearweb/sql/addpackages.php <?php print "Adding packages...\n"; // Drops all categories and adds sample categories $dbh->expectError(DB_ERROR_NOSUCHTABLE); $dbh->query('DELETE FROM packages'); $dbh->dropSequence('packages'); $dbh->popExpect(); $packages = ' Auth_HTTP;Authentication;mj;Methods for doing HTTP authentication Auth;Authentication;mj;Methods for doing authentication Config;Configuration;alexmerz;Class for managing configuration data Crypt;Encryption;zyprexia;Several encryption classes HTTP;HTTP;ssb;Miscellaneous HTTP utilities HTTP_Uploader;HTTP;cox;Easy and secure managment of files submitted via HTML Forms IO_Async;Networking;ssb;Backgrounded asynchronous socket IO Log;Logging;jon;Logging utilities Net_CheckIP;Networking;mj;Check the syntax of IPv4 adresses Net_IPv6;Networking;alexmerz;Class to validate and to work with IPv6 Net_NNTP;Networking;kaltroft;Communicate with an NNTP server Net_Ping;Networking;mj;Execute ping Net_Whois;Networking;sn;The PEAR::Net_Whois class provides a tool for querying Whois Servers PEAR;PEAR;ssb;PEAR base classes Science_Chemistry;Science;jmcastagnetto;Classes to manipulated chemical objects: atoms, molecules, etc. XML_fo2pdf;XML;chregu;Convert a xsl-fo file to pdf with the help of apache-fop XML_RPC;XML;ssb;A PEAR-ified version of Useful inc\'s xmlrpc implementation for PHP. XML_sql2xml;XML;chregu;Represent DB results with XML XML_Tree;XML;sebastian;Represent XML data in a tree structure '; $catmap = $dbh->getAssoc("SELECT name,id FROM categories"); foreach (explode("\n", $packages) as $line) { if (trim($line) == '') { continue; } list($name,$category,$lead,$summary) = explode(";", trim($line)); if (empty($catmap[$category])) { print "Package: $name: skipped - unknown category `$category'\n"; continue; } else { $catid = $catmap[$category]; } add_package(array('name' => $name, 'license' => 'PEAR License', 'description' => '', 'summary' => $summary, 'category' => $catid)); print "Package: $name\n"; } ?> Index: pearweb/sql/addusers.php +++ pearweb/sql/addusers.php <?php print "Adding users...\n"; $users = ' alexmerz;*;Alexander Merz;;0 chregu;*;Christian Stocker;;0 cox;124854bf5ca680411fca8676e6014819;Tomas V.V.Cox;;1 jmcastagnetto;*;Jesus M. Castagnetto;;0 jon;*;Jon Parise;;0 kaltroft;*;Martin Kaltroft;;0 mj;4f5c2e35084da4469fb82cc494eeb847;Martin Jansen;;1 sebastian;*;Sebastian Bergmann;;0 sn;*;Sebastian Nohn;sebastian@nohn.net;0 ssb;aaXRbnur6Ub86;Stig S. Bakken;;1 zyprexia;*;Dave Mertens;dmertens@zyprexia.com;0 '; $sth = $dbh->prepare("INSERT INTO users ". "(handle,password,name,email,registered,showemail," . "created,createdby,admin)". " VALUES(?,?,?,?,1,1,?,?,?)"); $me = getenv("USER"); $now = gmdate("Y-m-d H:i:s"); foreach (explode("\n", $users) as $line) { if (trim($line) == '') { continue; } list($user,$pw,$name,$email,$admin) = explode(";", trim($line)); if (empty($email)) { $email = "{$user}@php.net"; } $dbh->execute($sth, array($user,$pw,$name,$email,$now,$me,$admin)); print "User: $user\n"; } ?>
Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.13 pearweb/include/pear-database.php:1.14 --- pearweb/include/pear-database.php:1.13 Sun Sep 2 21:58:27 2001 +++ pearweb/include/pear-database.php Tue Sep 4 01:10:30 2001 @@ -62,7 +62,7 @@ $tree[$node]['leftvisit'] = $visitno; $inc = 1; if (isset($cnt[$node])) { - $inc += $cnt[$node] * 2; + $inc += $cnt[$node]; } if ($debug) { var_dump($cnt[$node]); @@ -189,22 +189,22 @@ $license = "PEAR License"; } if (empty($category)) { - return PEAR::raiseError("no `category' field"); + return PEAR::raiseError("add_package: no `category' field"); } if (empty($name)) { - return PEAR::raiseError("no `name' field"); + return PEAR::raiseError("add_package: no `name' field"); } - $query = "INSERT INTO packages (id,name,category,license,summary,". - "description) VALUES(?,?,?,?,?,?)"; + $query = "INSERT INTO packages (id,name,category,license,summary,description) VALUES(?,?,?,?,?,?)"; $id = $dbh->nextId("packages"); - $sth = $dbh->prepare($query); - if (DB::isError($sth)) { + if (DB::isError($sth = $dbh->prepare($query))) { return $sth; } - $err = $dbh->execute($sth, array($id, $name, $category, $license, - $summary, $description)); + $err = $dbh->execute($sth, array($id, $name, $category, $license, $summary, $description)); if (DB::isError($err)) { return $err; + } + if (isset($lead) && DB::isError($err = add_maintainer($id, $lead, 'lead'))) { + return $err; } if (DB::isError($err = renumber_visitations())) { return $err; Index: pearweb/public_html/package-new.php diff -u pearweb/public_html/package-new.php:1.1 pearweb/public_html/package-new.php:1.2 --- pearweb/public_html/package-new.php:1.1 Sun Sep 2 00:39:16 2001 +++ pearweb/public_html/package-new.php Tue Sep 4 01:10:30 2001 @@ -38,6 +38,7 @@ 'license' => $license, 'summary' => $summary, 'description' => $desc, + 'lead' => $PHP_AUTH_USER, )); $dbh->popExpect(); if (DB::isError($pkg) && $pkg->getCode() == DB_ERROR_ALREADY_EXISTS) { @@ -45,7 +46,6 @@ "Package already exists"); exit; } - $err = add_maintainer($pkg, $PHP_AUTH_USER, 'lead'); $display_form = false; response_header("Package Registered"); print "The package `$name' has been registered in PEAR.<br />\n"; Index: pearweb/public_html/packages.php diff -u pearweb/public_html/packages.php:1.11 pearweb/public_html/packages.php:1.12 --- pearweb/public_html/packages.php:1.11 Sun Sep 2 23:38:48 2001 +++ pearweb/public_html/packages.php Tue Sep 4 01:10:30 2001 @@ -25,7 +25,9 @@ $nrow = 0; while ($sth->fetchInto($row)) { extract($row); - $npackages = ($rightvisit - $leftvisit - 1) / 2; + $npackages = $rightvisit - $leftvisit - 1; +// $d = $rightvisit - $leftvisit; +// if ($d > 0) $npackages = ($d + 1) / 2; if ($npackages == 0) { //continue; // XXXX Uncomment me to only show categories with packages } // XXXX change me with elseif (show table head only when there are values) Index: pearweb/sql/addcategories.php diff -u pearweb/sql/addcategories.php:1.2 pearweb/sql/addcategories.php:1.3 --- pearweb/sql/addcategories.php:1.2 Sat Sep 1 22:21:46 2001 +++ pearweb/sql/addcategories.php Tue Sep 4 01:10:31 2001 @@ -1,49 +1,44 @@ <?php -// Drops all categories and adds sample categories - -error_reporting(E_ALL); -require_once 'DB.php'; -require_once 'DB/storage.php'; -require_once '../include/pear-database.php'; - -if (empty($dbh)) { - $dbh = DB::connect('mysql://pear:pear@localhost/pear'); - $dbh->setErrorHandling(PEAR_ERROR_DIE); -} +print "Adding categories...\n"; +$dbh->expectError(DB_ERROR_NOSUCHTABLE); $dbh->query('DELETE FROM categories'); -$categories = array( - 'Benchmarking' => '', - 'Caching' => '', - 'Console' => '', - 'Encryption' => '', - 'Database' => '', - 'Date and Time' => '', - 'File System' => '', - 'HTML' => '', - 'HTTP' => '', - 'Images' => '', - 'Logging' => '', - 'Mail' => '', - 'Math' => '', - 'Networking' => '', - 'Numbers' => '', - 'Payment' => '', - 'Scheduling' => '', - 'XML' => '' -); +$dbh->dropSequence('categories'); +$dbh->popExpect(); + +$categories = ' +Authentication; +Benchmarking; +Caching; +Configuration; +Console; +Encryption; +Database; +Date and Time; +File System; +HTML; +HTTP; +Images; +Logging; +Mail; +Math; +Networking; +Numbers; +Payment; +PEAR;PEAR infrastructure +Scheduling; +Science; +XML; +'; -foreach($categories as $name => $desc) { +foreach (explode("\n", $categories) as $line) { + if (trim($line) == '') { + continue; + } + list($name, $desc) = explode(";", trim($line)); add_category(array('name' => $name, 'desc' => $desc)); + print "Category: $name\n"; } -/*$sql = 'select * from categories order by id'; -$res = $dbh->query($sql); -echo "-------------------\n"; -while($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { - foreach($row as $field => $value) { - echo "$field => $value\n"; - } - echo "-------------------\n"; -}*/ + ?> Index: pearweb/sql/data.php diff -u pearweb/sql/data.php:1.4 pearweb/sql/data.php:1.5 --- pearweb/sql/data.php:1.4 Sun Sep 2 00:15:44 2001 +++ pearweb/sql/data.php Tue Sep 4 01:10:31 2001 @@ -1,15 +1,14 @@ <?php require_once "DB.php"; +require_once "../include/pear-database.php"; PEAR::setErrorHandling(PEAR_ERROR_DIE); list($progname, $type, $user, $pass, $db) = $argv; $dbh = DB::connect("$type://$user:$pass@localhost/$db"); -$dbh->query("INSERT INTO users VALUES('ssb', '738aa8d3bc02eb8712acd0eb2cf6dfd5', 'Stig S. Bakken', 'stig@php.net', 'http://www.pvv.org/~ssb/', '2001-04-18', 'ssb', NULL, 1, 1, 1, NULL)"); -$dbh->query("INSERT INTO users VALUES('mj', '4f5c2e35084da4469fb82cc494eeb847', 'Martin Jansen', 'mj@php.net', 'http://martin-jansen.de/', '2001-05-24', 'mj', NULL, 1, 1, 1, NULL)"); -$dbh->query("INSERT INTO users VALUES('cox', '124854bf5ca680411fca8676e6014819', 'Tomas V.V.Cox', 'cox@php.net', 'http://vulcanonet.com', '2001-08-31', 'cox', NULL, 1, 1, 1, NULL)"); - +include "./addusers.php"; include "./addcategories.php"; +include "./addpackages.php"; ?> Index: pearweb/sql/addpackages.php +++ pearweb/sql/addpackages.php <?php print "Adding packages...\n"; // Drops all categories and adds sample categories $dbh->expectError(DB_ERROR_NOSUCHTABLE); $dbh->query('DELETE FROM packages'); $dbh->dropSequence('packages'); $dbh->popExpect(); $packages = ' Auth_HTTP;Authentication;mj;Methods for doing HTTP authentication Auth;Authentication;mj;Methods for doing authentication Config;Configuration;alexmerz;Class for managing configuration data Crypt;Encryption;zyprexia;Several encryption classes HTTP;HTTP;ssb;Miscellaneous HTTP utilities HTTP_Uploader;HTTP;cox;Easy and secure managment of files submitted via HTML Forms IO_Async;Networking;ssb;Backgrounded asynchronous socket IO Log;Logging;jon;Logging utilities Net_CheckIP;Networking;mj;Check the syntax of IPv4 adresses Net_IPv6;Networking;alexmerz;Class to validate and to work with IPv6 Net_NNTP;Networking;kaltroft;Communicate with an NNTP server Net_Ping;Networking;mj;Execute ping Net_Whois;Networking;sn;The PEAR::Net_Whois class provides a tool for querying Whois Servers PEAR;PEAR;ssb;PEAR base classes Science_Chemistry;Science;jmcastagnetto;Classes to manipulated chemical objects: atoms, molecules, etc. XML_fo2pdf;XML;chregu;Convert a xsl-fo file to pdf with the help of apache-fop XML_RPC;XML;ssb;A PEAR-ified version of Useful inc\'s xmlrpc implementation for PHP. XML_sql2xml;XML;chregu;Represent DB results with XML XML_Tree;XML;sebastian;Represent XML data in a tree structure '; $catmap = $dbh->getAssoc("SELECT name,id FROM categories"); foreach (explode("\n", $packages) as $line) { if (trim($line) == '') { continue; } list($name,$category,$lead,$summary) = explode(";", trim($line)); if (empty($catmap[$category])) { print "Package: $name: skipped - unknown category `$category'\n"; continue; } else { $catid = $catmap[$category]; } add_package(array('name' => $name, 'license' => 'PEAR License', 'description' => '', 'summary' => $summary, 'category' => $catid)); print "Package: $name\n"; } ?> Index: pearweb/sql/addusers.php +++ pearweb/sql/addusers.php <?php print "Adding users...\n"; $users = ' alexmerz;*;Alexander Merz;;0 chregu;*;Christian Stocker;;0 cox;124854bf5ca680411fca8676e6014819;Tomas V.V.Cox;;1 jmcastagnetto;*;Jesus M. Castagnetto;;0 jon;*;Jon Parise;;0 kaltroft;*;Martin Kaltroft;;0 mj;4f5c2e35084da4469fb82cc494eeb847;Martin Jansen;;1 sebastian;*;Sebastian Bergmann;;0 sn;*;Sebastian Nohn;sebastian@nohn.net;0 ssb;aaXRbnur6Ub86;Stig S. Bakken;;1 zyprexia;*;Dave Mertens;dmertens@zyprexia.com;0 '; $sth = $dbh->prepare("INSERT INTO users ". "(handle,password,name,email,registered,showemail," . "created,createdby,admin)". " VALUES(?,?,?,?,1,1,?,?,?)"); $me = getenv("USER"); $now = gmdate("Y-m-d H:i:s"); foreach (explode("\n", $users) as $line) { if (trim($line) == '') { continue; } list($user,$pw,$name,$email,$admin) = explode(";", trim($line)); if (empty($email)) { $email = "{$user}@php.net"; } $dbh->execute($sth, array($user,$pw,$name,$email,$now,$me,$admin)); print "User: $user\n"; } ?>