cvs: pearweb /include pear-database-category.php pear-database-channel.php pear-database-maintainer.php pear-database-note.php
pear-database-package.php pear-database-release.php pear-database-statistics.php pear-database-user.php
| From: | Greg Beaver | Date: | Mon, 23 Apr 2007 04:21:41 +0000 |
| Subject: | cvs: pearweb /include pear-database-category.php pear-database-channel.php pear-database-maintainer.php pear-database-note.php pear-database-package.php pear-database-release.php pear-database-statistics.php pear-database-user.php |
||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-46110@lists.php.net to get a copy of this message | ||
cellog Mon Apr 23 04:21:41 2007 UTC
Modified files:
/pearweb/include pear-database-category.php
pear-database-channel.php
pear-database-maintainer.php
pear-database-note.php pear-database-package.php
pear-database-release.php
pear-database-statistics.php
pear-database-user.php
Log:
mark all static methods as static, should speed things up
slightly (no more calls to error handler that are ignored)
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-category.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-category.php diff -u pearweb/include/pear-database-category.php:1.1 pearweb/include/pear-database-category.php:1.2 --- pearweb/include/pear-database-category.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-category.php Mon Apr 23 04:21:41 2007 @@ -18,7 +18,7 @@ | Martin Jansen <mj@php.net> | | Richard Heyes <richard@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-category.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-category.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ // These classes correspond to tables and methods define operations on @@ -51,7 +51,7 @@ * @param array * @return mixed ID of the category or PEAR error object */ - function add($data) + static function add($data) { global $dbh; $name = $data['name']; @@ -85,7 +85,7 @@ * @param string $desc Category Description * @return mixed True on success, pear_error otherwise */ - function update($id, $name, $desc = '') + static function update($id, $name, $desc = '') { return $GLOBALS['dbh']->query(sprintf('UPDATE categories SET name = %s, description = %s WHERE id = %d', $GLOBALS['dbh']->quote($name), @@ -98,7 +98,7 @@ * * @param integer $id Cateogry ID */ - function delete($id) + static function delete($id) { // if ($GLOBALS['dbh']->query('SELECT COUNT(*) FROM categories WHERE parent = ' . (int)$id) > 0) { @@ -142,7 +142,7 @@ * * @return array */ - function listAll() + static function listAll() { global $dbh; return $dbh->getAll("SELECT * FROM categories ORDER BY name", @@ -158,7 +158,7 @@ * @param string $category * @return array */ - function listPackages($category) + static function listPackages($category) { global $dbh; $query = 'SELECT @@ -182,7 +182,7 @@ * @param string Name of the category * @return array */ - function getRecent($n, $category) + static function getRecent($n, $category) { global $dbh; $recent = array(); @@ -217,7 +217,7 @@ * @param string Name of the category * @return boolean */ - function isValid($category) + static function isValid($category) { global $dbh; $query = "SELECT id FROM categories WHERE name = ?"; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-channel.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-channel.php diff -u pearweb/include/pear-database-channel.php:1.1 pearweb/include/pear-database-channel.php:1.2 --- pearweb/include/pear-database-channel.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-channel.php Mon Apr 23 04:21:41 2007 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: Gregory Beaver <cellog@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-channel.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-channel.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ class channel @@ -27,7 +27,7 @@ * - connect and retrieve the channel.xml * to verify that this is possible */ - function add($name, $server) + static function add($name, $server) { global $dbh; $query = 'INSERT INTO channels (name) VALUES (?)'; @@ -46,7 +46,7 @@ * List all registered channels * @return array Format: array(array(channel server), array(channel server),... ) */ - function listAll() + static function listAll() { global $dbh; $query = 'SELECT * FROM channels'; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-maintainer.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-maintainer.php diff -u pearweb/include/pear-database-maintainer.php:1.1 pearweb/include/pear-database-maintainer.php:1.2 --- pearweb/include/pear-database-maintainer.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-maintainer.php Mon Apr 23 04:21:41 2007 @@ -22,7 +22,7 @@ * @param integer Is the developer actively working on the project? * @return mixed True or PEAR error object */ - function add($package, $user, $role, $active = 1) + static function add($package, $user, $role, $active = 1) { global $dbh, $pear_rest; @@ -60,7 +60,7 @@ * of getting all maintainer if active is set to false. * @return array */ - function get($package, $lead = false, $active = false) + static function get($package, $lead = false, $active = false) { global $dbh; if (is_string($package)) { @@ -92,7 +92,7 @@ * @param string Handle of the user * @return array */ - function getByUser($user) + static function getByUser($user) { global $dbh; $query = 'SELECT p.name, m.role FROM packages p, maintains m WHERE p.package_type = ? AND p.approved = 1 AND m.package = p.id AND m.handle = ?'; @@ -109,7 +109,7 @@ * @param string Name of the role * @return boolean */ - function isValidRole($role) + static function isValidRole($role) { require_once "PEAR/Common.php"; @@ -131,7 +131,7 @@ * @param string Handle of the user * @return True or PEAR error object */ - function remove($package, $user) + static function remove($package, $user) { global $dbh, $auth_user; include_once 'pear-database-user.php'; @@ -159,7 +159,7 @@ * @param bool Whether to print the logging information to the screen * @return mixed PEAR_Error or true */ - function updateAll($pkgid, $users, $print = false) + static function updateAll($pkgid, $users, $print = false) { require_once "Damblan/Log.php"; @@ -249,7 +249,7 @@ * @param string Role * @param string Is the developer actively working on the package? */ - function update($package, $user, $role, $active) { + static function update($package, $user, $role, $active) { global $dbh; $query = "UPDATE maintains SET role = ?, active = ? " . @@ -266,7 +266,7 @@ * @param int ID of the package * @return boolean */ - function mayUpdate($package) { + static function mayUpdate($package) { global $auth_user; $admin = $auth_user->isAdmin(); http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-note.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-note.php diff -u pearweb/include/pear-database-note.php:1.1 pearweb/include/pear-database-note.php:1.2 --- pearweb/include/pear-database-note.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-note.php Mon Apr 23 04:21:41 2007 @@ -12,7 +12,7 @@ { // {{{ +proto bool note::add(string, int, string, string) API 1.0 - function add($key, $value, $note, $author = "") + static function add($key, $value, $note, $author = "") { global $dbh, $auth_user; if (empty($author)) { @@ -36,7 +36,7 @@ // }}} // {{{ +proto bool note::remove(int) API 1.0 - function remove($id) + static function remove($id) { global $dbh; $id = (int)$id; @@ -50,7 +50,7 @@ // }}} // {{{ +proto bool note::removeAll(string, int) API 1.0 - function removeAll($key, $value) + static function removeAll($key, $value) { global $dbh; $res = $dbh->query("DELETE FROM notes WHERE $key = ". $dbh->quote($value)); @@ -63,7 +63,7 @@ // }}} // {{{ - function getAll($user) + static function getAll($user) { global $dbh; return $dbh->getAll('SELECT id, nby, ntime, note FROM notes' http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-package.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-package.php diff -u pearweb/include/pear-database-package.php:1.1 pearweb/include/pear-database-package.php:1.2 --- pearweb/include/pear-database-package.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-package.php Mon Apr 23 04:21:41 2007 @@ -17,7 +17,7 @@ | Tomas V.V. Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-package.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-package.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ /** @@ -39,7 +39,7 @@ * @param array * @return mixed ID of new package or PEAR error object */ - function add($data) + static function add($data) { global $dbh, $auth_user; // name, category @@ -117,7 +117,7 @@ * @param string|false installed version of this package * @return bool|array */ - function getDownloadURL($packageinfo, $prefstate = 'stable', + static function getDownloadURL($packageinfo, $prefstate = 'stable', $installed = false) { if (!isset($packageinfo['package'])) { @@ -191,7 +191,7 @@ * @param string release version * @return string|PEAR_Error|null package.xml contents from this release */ - function getPackageFile($package, $version) + static function getPackageFile($package, $version) { global $dbh; $what = is_numeric($package) ? 'id' : 'name'; @@ -239,7 +239,7 @@ * @param string installed version of this dependency * @return bool|array */ - function getDepDownloadURL($xsdversion, $dependency, $deppackage, + static function getDepDownloadURL($xsdversion, $dependency, $deppackage, $prefstate = 'stable', $installed = false) { $info = package::info($dependency['name'], 'releases', true); @@ -483,7 +483,7 @@ /** * */ - function search($fragment, $summary = false, $released_only = true, $stable_only = true, + static function search($fragment, $summary = false, $released_only = true, $stable_only = true, $include_pecl = false) { $all = package::listAll($released_only, $stable_only, $include_pecl); @@ -517,7 +517,7 @@ * @static * @return array */ - function listAllNames() + static function listAllNames() { global $dbh; @@ -536,7 +536,7 @@ * @param boolean List also PECL packages * @return array */ - function listAll($released_only = true, $stable_only = true, $include_pecl = null) + static function listAll($released_only = true, $stable_only = true, $include_pecl = null) { global $dbh, $HTTP_RAW_POST_DATA; @@ -658,7 +658,7 @@ * @return array * @static */ - function listAllwithReleases() + static function listAllwithReleases() { global $dbh; @@ -695,7 +695,7 @@ * @param string Only list release with specific state (Optional) * @return array */ - function listLatestReleases($state = '') + static function listLatestReleases($state = '') { global $dbh; $query = @@ -745,7 +745,7 @@ * @param array Array containing the currently installed packages * @return array */ - function listUpgrades($currently_installed) + static function listUpgrades($currently_installed) { global $dbh; if (sizeof($currently_installed) == 0) { @@ -783,7 +783,7 @@ * @param array $data Assoc in the form 'field' => 'value'. * @return mixed True or PEAR_Error */ - function updateInfo($pkgid, $data) + static function updateInfo($pkgid, $data) { global $dbh, $auth_user; $package_id = package::info($pkgid, 'id'); @@ -827,7 +827,7 @@ * @param string Name of the package * @return array List of package that depend on $package */ - function getDependants($package) { + static function getDependants($package) { global $dbh; $query = 'SELECT p.name AS p_name, ' . ' MAX(r.version) AS max_dep, ' . @@ -851,7 +851,7 @@ * @param string Name of the package * @return array */ - function getRecent($n, $package) + static function getRecent($n, $package) { global $dbh; $recent = array(); @@ -886,7 +886,7 @@ * @param string Name of the package * @return boolean */ - function isValid($package) + static function isValid($package) { global $dbh; $query = "SELECT id FROM packages WHERE package_type = 'pear' AND approved = 1 AND name = ?"; @@ -904,7 +904,7 @@ * @param int ID of the package * @return array */ - function getNotes($package) + static function getNotes($package) { global $dbh; @@ -921,7 +921,7 @@ * @param int ID of the package * @return void */ - function allowTrackbacks($name, $allow) + static function allowTrackbacks($name, $allow) { global $dbh; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-release.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-release.php diff -u pearweb/include/pear-database-release.php:1.1 pearweb/include/pear-database-release.php:1.2 --- pearweb/include/pear-database-release.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-release.php Mon Apr 23 04:21:41 2007 @@ -17,7 +17,7 @@ | Tomas V.V. Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-release.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-release.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ /** @@ -40,7 +40,7 @@ * @param integer Number of releases to return * @return array */ - function getRecent($n = 5) + static function getRecent($n = 5) { global $dbh; $sth = $dbh->limitQuery("SELECT packages.id AS id, ". @@ -69,7 +69,7 @@ // }}} // {{{ proto array release::getPopular(int) API 1.0 - function getPopular($n = 5, $rss = false) + static function getPopular($n = 5, $rss = false) { global $dbh; if ($rss) { @@ -124,7 +124,7 @@ * @param integer Timestamp of end date * @return array */ - function getDateRange($start,$end) + static function getDateRange($start,$end) { global $dbh; @@ -172,7 +172,7 @@ * @param string Filename of the release tarball * @param string MD5 checksum of the tarball */ - function upload($package, $version, $state, $relnotes, $tarball, $md5sum, + static function upload($package, $version, $state, $relnotes, $tarball, $md5sum, $pkg_info = false, $packagexml = false, $compatible = false) { global $auth_user; @@ -204,7 +204,7 @@ * @param string MD5 checksum of the tarball * @return mixed */ - function validateUpload($package, $version, $state, $relnotes, $tarball, $md5sum) + static function validateUpload($package, $version, $state, $relnotes, $tarball, $md5sum) { global $dbh, $auth_user; @@ -283,7 +283,7 @@ * @static * @return string the file name of the upload or PEAR_Error object if problems */ - function confirmUpload($package, $version, $state, $relnotes, $md5sum, $package_id, $file, + static function confirmUpload($package, $version, $state, $relnotes, $md5sum, $package_id, $file, $pkg_info = false, $packagexml = false, $compatible = false) { require_once "PEAR/Common.php"; @@ -494,7 +494,7 @@ * @param string * @return boolean */ - function dismissUpload($upload_ref) + static function dismissUpload($upload_ref) { return (bool)@unlink($upload_ref); } @@ -514,7 +514,7 @@ * @return mixed * @static */ - function HTTPdownload($package, $version = null, $file = null, $uncompress = false) + static function HTTPdownload($package, $version = null, $file = null, $uncompress = false) { global $dbh; @@ -628,7 +628,7 @@ * @param string State * @return boolean */ - function isValidState($state) + static function isValidState($state) { static $states = array('devel', 'snapshot', 'alpha', 'beta', 'stable'); return in_array($state, $states); @@ -644,7 +644,7 @@ * @param boolean include the state in the array returned * @return boolean */ - function betterStates($state, $include = false) + static function betterStates($state, $include = false) { static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable'); $i = array_search($state, $states); @@ -667,7 +667,7 @@ * @param integer ID of the release * @param string Filename */ - function logDownload($package, $release_id, $file = null) + static function logDownload($package, $release_id, $file = null) { global $dbh; @@ -760,7 +760,7 @@ * @param string Filename of the new uploaded release * @return void */ - function promote($pkginfo, $upload) + static function promote($pkginfo, $upload) { if ($_SERVER['SERVER_NAME'] != PEAR_CHANNELNAME) { return; @@ -821,7 +821,7 @@ * @param string Filename of the new uploaded release * @return void */ - function promote_v2($pkginfo, $upload) + static function promote_v2($pkginfo, $upload) { if ($_SERVER['SERVER_NAME'] != PEAR_CHANNELNAME) { return; @@ -882,7 +882,7 @@ * @param integer ID of the release * @return boolean */ - function remove($package, $release) + static function remove($package, $release) { global $dbh, $auth_user; include_once 'pear-database-user.php'; @@ -945,7 +945,7 @@ * @param string Version string of the package * @return mixed PEAR_Error or Array */ - function getFAQ($package, $version) + static function getFAQ($package, $version) { global $dbh; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-statistics.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-statistics.php diff -u pearweb/include/pear-database-statistics.php:1.1 pearweb/include/pear-database-statistics.php:1.2 --- pearweb/include/pear-database-statistics.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-statistics.php Mon Apr 23 04:21:41 2007 @@ -18,7 +18,7 @@ | Martin Jansen <mj@php.net> | | Gregory Beaver <cellog@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-statistics.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-statistics.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ class statistics @@ -31,7 +31,7 @@ * @param integer ID of the package * @return array */ - function package($id) + static function package($id) { global $dbh; $query = "SELECT SUM(dl_number) FROM package_stats WHERE pid = " . (int)$id; @@ -41,7 +41,7 @@ // }}} // {{{ release() - function release($id, $rid = "") + static function release($id, $rid = "") { global $dbh; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-user.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-user.php diff -u pearweb/include/pear-database-user.php:1.1 pearweb/include/pear-database-user.php:1.2 --- pearweb/include/pear-database-user.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-user.php Mon Apr 23 04:21:41 2007 @@ -4,7 +4,7 @@ { // {{{ *proto bool user::remove(string) API 1.0 - function remove($uid) + static function remove($uid) { global $dbh; @@ -19,7 +19,7 @@ // }}} // {{{ *proto bool user::rejectRequest(string, string) API 1.0 - function rejectRequest($uid, $reason) + static function rejectRequest($uid, $reason) { global $dbh, $auth_user; list($email) = $dbh->getRow('SELECT email FROM users WHERE handle = ?', @@ -37,7 +37,7 @@ // }}} // {{{ *proto bool user::activate(string) API 1.0 - function activate($uid, $karmalevel = 'pear.dev') + static function activate($uid, $karmalevel = 'pear.dev') { require_once "Damblan/Karma.php"; @@ -80,7 +80,7 @@ // }}} // {{{ +proto bool user::isAdmin(string) API 1.0 - function isAdmin($handle) + static function isAdmin($handle) { require_once "Damblan/Karma.php"; @@ -93,7 +93,7 @@ // }}} // {{{ +proto bool user::isQA(string) API post 1.0 - function isQA($handle) + static function isQA($handle) { require_once 'Damblan/Karma.php'; @@ -106,7 +106,7 @@ // }}} // {{{ proto bool user::listAdmins() API 1.0 - function listAdmins() + static function listAdmins() { require_once "Damblan/Karma.php"; @@ -119,7 +119,7 @@ // }}} // {{{ +proto bool user::exists(string) API 1.0 - function exists($handle) + static function exists($handle) { global $dbh; $sql = "SELECT handle FROM users WHERE handle=?"; @@ -130,7 +130,7 @@ // }}} // {{{ +proto string user::maintains(string|int, [string]) API 1.0 - function maintains($user, $pkgid, $role = 'any') + static function maintains($user, $pkgid, $role = 'any') { global $dbh; include_once 'pear-database-package.php'; @@ -150,7 +150,7 @@ // }}} // {{{ - function getPackages($user) + static function getPackages($user) { global $dbh; $query = 'SELECT p.id, p.name, m.role, m.active' @@ -164,7 +164,7 @@ // }}} // {{{ proto string user::info(string, [string]) API 1.0 - function info($user, $field = null) + static function info($user, $field = null) { global $dbh; if ($field === null) { @@ -184,7 +184,7 @@ // }}} // {{{ listAll() - function listAll($registered_only = true) + static function listAll($registered_only = true) { global $dbh; $query = "SELECT * FROM users"; @@ -217,7 +217,7 @@ * * @access public */ - function add(&$data, $md5ed = false) + static function add(&$data, $md5ed = false) { global $dbh; @@ -380,7 +380,7 @@ * @param array User information * @return object Instance of PEAR_User */ - function update($data) { + static function update($data) { global $dbh; $fields = array('name', @@ -417,7 +417,7 @@ * @param int Number of releases (default is 10) * @return array */ - function getRecentReleases($handle, $n = 10) + static function getRecentReleases($handle, $n = 10) { global $dbh; $recent = array(); @@ -456,7 +456,7 @@ * @access public * @return array */ - function getWhoIsWho() { + static function getWhoIsWho() { global $dbh; // IP whitelist
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-category.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-category.php diff -u pearweb/include/pear-database-category.php:1.1 pearweb/include/pear-database-category.php:1.2 --- pearweb/include/pear-database-category.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-category.php Mon Apr 23 04:21:41 2007 @@ -18,7 +18,7 @@ | Martin Jansen <mj@php.net> | | Richard Heyes <richard@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-category.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-category.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ // These classes correspond to tables and methods define operations on @@ -51,7 +51,7 @@ * @param array * @return mixed ID of the category or PEAR error object */ - function add($data) + static function add($data) { global $dbh; $name = $data['name']; @@ -85,7 +85,7 @@ * @param string $desc Category Description * @return mixed True on success, pear_error otherwise */ - function update($id, $name, $desc = '') + static function update($id, $name, $desc = '') { return $GLOBALS['dbh']->query(sprintf('UPDATE categories SET name = %s, description = %s WHERE id = %d', $GLOBALS['dbh']->quote($name), @@ -98,7 +98,7 @@ * * @param integer $id Cateogry ID */ - function delete($id) + static function delete($id) { // if ($GLOBALS['dbh']->query('SELECT COUNT(*) FROM categories WHERE parent = ' . (int)$id) > 0) { @@ -142,7 +142,7 @@ * * @return array */ - function listAll() + static function listAll() { global $dbh; return $dbh->getAll("SELECT * FROM categories ORDER BY name", @@ -158,7 +158,7 @@ * @param string $category * @return array */ - function listPackages($category) + static function listPackages($category) { global $dbh; $query = 'SELECT @@ -182,7 +182,7 @@ * @param string Name of the category * @return array */ - function getRecent($n, $category) + static function getRecent($n, $category) { global $dbh; $recent = array(); @@ -217,7 +217,7 @@ * @param string Name of the category * @return boolean */ - function isValid($category) + static function isValid($category) { global $dbh; $query = "SELECT id FROM categories WHERE name = ?"; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-channel.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-channel.php diff -u pearweb/include/pear-database-channel.php:1.1 pearweb/include/pear-database-channel.php:1.2 --- pearweb/include/pear-database-channel.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-channel.php Mon Apr 23 04:21:41 2007 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: Gregory Beaver <cellog@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-channel.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-channel.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ class channel @@ -27,7 +27,7 @@ * - connect and retrieve the channel.xml * to verify that this is possible */ - function add($name, $server) + static function add($name, $server) { global $dbh; $query = 'INSERT INTO channels (name) VALUES (?)'; @@ -46,7 +46,7 @@ * List all registered channels * @return array Format: array(array(channel server), array(channel server),... ) */ - function listAll() + static function listAll() { global $dbh; $query = 'SELECT * FROM channels'; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-maintainer.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-maintainer.php diff -u pearweb/include/pear-database-maintainer.php:1.1 pearweb/include/pear-database-maintainer.php:1.2 --- pearweb/include/pear-database-maintainer.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-maintainer.php Mon Apr 23 04:21:41 2007 @@ -22,7 +22,7 @@ * @param integer Is the developer actively working on the project? * @return mixed True or PEAR error object */ - function add($package, $user, $role, $active = 1) + static function add($package, $user, $role, $active = 1) { global $dbh, $pear_rest; @@ -60,7 +60,7 @@ * of getting all maintainer if active is set to false. * @return array */ - function get($package, $lead = false, $active = false) + static function get($package, $lead = false, $active = false) { global $dbh; if (is_string($package)) { @@ -92,7 +92,7 @@ * @param string Handle of the user * @return array */ - function getByUser($user) + static function getByUser($user) { global $dbh; $query = 'SELECT p.name, m.role FROM packages p, maintains m WHERE p.package_type = ? AND p.approved = 1 AND m.package = p.id AND m.handle = ?'; @@ -109,7 +109,7 @@ * @param string Name of the role * @return boolean */ - function isValidRole($role) + static function isValidRole($role) { require_once "PEAR/Common.php"; @@ -131,7 +131,7 @@ * @param string Handle of the user * @return True or PEAR error object */ - function remove($package, $user) + static function remove($package, $user) { global $dbh, $auth_user; include_once 'pear-database-user.php'; @@ -159,7 +159,7 @@ * @param bool Whether to print the logging information to the screen * @return mixed PEAR_Error or true */ - function updateAll($pkgid, $users, $print = false) + static function updateAll($pkgid, $users, $print = false) { require_once "Damblan/Log.php"; @@ -249,7 +249,7 @@ * @param string Role * @param string Is the developer actively working on the package? */ - function update($package, $user, $role, $active) { + static function update($package, $user, $role, $active) { global $dbh; $query = "UPDATE maintains SET role = ?, active = ? " . @@ -266,7 +266,7 @@ * @param int ID of the package * @return boolean */ - function mayUpdate($package) { + static function mayUpdate($package) { global $auth_user; $admin = $auth_user->isAdmin(); http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-note.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-note.php diff -u pearweb/include/pear-database-note.php:1.1 pearweb/include/pear-database-note.php:1.2 --- pearweb/include/pear-database-note.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-note.php Mon Apr 23 04:21:41 2007 @@ -12,7 +12,7 @@ { // {{{ +proto bool note::add(string, int, string, string) API 1.0 - function add($key, $value, $note, $author = "") + static function add($key, $value, $note, $author = "") { global $dbh, $auth_user; if (empty($author)) { @@ -36,7 +36,7 @@ // }}} // {{{ +proto bool note::remove(int) API 1.0 - function remove($id) + static function remove($id) { global $dbh; $id = (int)$id; @@ -50,7 +50,7 @@ // }}} // {{{ +proto bool note::removeAll(string, int) API 1.0 - function removeAll($key, $value) + static function removeAll($key, $value) { global $dbh; $res = $dbh->query("DELETE FROM notes WHERE $key = ". $dbh->quote($value)); @@ -63,7 +63,7 @@ // }}} // {{{ - function getAll($user) + static function getAll($user) { global $dbh; return $dbh->getAll('SELECT id, nby, ntime, note FROM notes' http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-package.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-package.php diff -u pearweb/include/pear-database-package.php:1.1 pearweb/include/pear-database-package.php:1.2 --- pearweb/include/pear-database-package.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-package.php Mon Apr 23 04:21:41 2007 @@ -17,7 +17,7 @@ | Tomas V.V. Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-package.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-package.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ /** @@ -39,7 +39,7 @@ * @param array * @return mixed ID of new package or PEAR error object */ - function add($data) + static function add($data) { global $dbh, $auth_user; // name, category @@ -117,7 +117,7 @@ * @param string|false installed version of this package * @return bool|array */ - function getDownloadURL($packageinfo, $prefstate = 'stable', + static function getDownloadURL($packageinfo, $prefstate = 'stable', $installed = false) { if (!isset($packageinfo['package'])) { @@ -191,7 +191,7 @@ * @param string release version * @return string|PEAR_Error|null package.xml contents from this release */ - function getPackageFile($package, $version) + static function getPackageFile($package, $version) { global $dbh; $what = is_numeric($package) ? 'id' : 'name'; @@ -239,7 +239,7 @@ * @param string installed version of this dependency * @return bool|array */ - function getDepDownloadURL($xsdversion, $dependency, $deppackage, + static function getDepDownloadURL($xsdversion, $dependency, $deppackage, $prefstate = 'stable', $installed = false) { $info = package::info($dependency['name'], 'releases', true); @@ -483,7 +483,7 @@ /** * */ - function search($fragment, $summary = false, $released_only = true, $stable_only = true, + static function search($fragment, $summary = false, $released_only = true, $stable_only = true, $include_pecl = false) { $all = package::listAll($released_only, $stable_only, $include_pecl); @@ -517,7 +517,7 @@ * @static * @return array */ - function listAllNames() + static function listAllNames() { global $dbh; @@ -536,7 +536,7 @@ * @param boolean List also PECL packages * @return array */ - function listAll($released_only = true, $stable_only = true, $include_pecl = null) + static function listAll($released_only = true, $stable_only = true, $include_pecl = null) { global $dbh, $HTTP_RAW_POST_DATA; @@ -658,7 +658,7 @@ * @return array * @static */ - function listAllwithReleases() + static function listAllwithReleases() { global $dbh; @@ -695,7 +695,7 @@ * @param string Only list release with specific state (Optional) * @return array */ - function listLatestReleases($state = '') + static function listLatestReleases($state = '') { global $dbh; $query = @@ -745,7 +745,7 @@ * @param array Array containing the currently installed packages * @return array */ - function listUpgrades($currently_installed) + static function listUpgrades($currently_installed) { global $dbh; if (sizeof($currently_installed) == 0) { @@ -783,7 +783,7 @@ * @param array $data Assoc in the form 'field' => 'value'. * @return mixed True or PEAR_Error */ - function updateInfo($pkgid, $data) + static function updateInfo($pkgid, $data) { global $dbh, $auth_user; $package_id = package::info($pkgid, 'id'); @@ -827,7 +827,7 @@ * @param string Name of the package * @return array List of package that depend on $package */ - function getDependants($package) { + static function getDependants($package) { global $dbh; $query = 'SELECT p.name AS p_name, ' . ' MAX(r.version) AS max_dep, ' . @@ -851,7 +851,7 @@ * @param string Name of the package * @return array */ - function getRecent($n, $package) + static function getRecent($n, $package) { global $dbh; $recent = array(); @@ -886,7 +886,7 @@ * @param string Name of the package * @return boolean */ - function isValid($package) + static function isValid($package) { global $dbh; $query = "SELECT id FROM packages WHERE package_type = 'pear' AND approved = 1 AND name = ?"; @@ -904,7 +904,7 @@ * @param int ID of the package * @return array */ - function getNotes($package) + static function getNotes($package) { global $dbh; @@ -921,7 +921,7 @@ * @param int ID of the package * @return void */ - function allowTrackbacks($name, $allow) + static function allowTrackbacks($name, $allow) { global $dbh; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-release.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-release.php diff -u pearweb/include/pear-database-release.php:1.1 pearweb/include/pear-database-release.php:1.2 --- pearweb/include/pear-database-release.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-release.php Mon Apr 23 04:21:41 2007 @@ -17,7 +17,7 @@ | Tomas V.V. Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-release.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-release.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ /** @@ -40,7 +40,7 @@ * @param integer Number of releases to return * @return array */ - function getRecent($n = 5) + static function getRecent($n = 5) { global $dbh; $sth = $dbh->limitQuery("SELECT packages.id AS id, ". @@ -69,7 +69,7 @@ // }}} // {{{ proto array release::getPopular(int) API 1.0 - function getPopular($n = 5, $rss = false) + static function getPopular($n = 5, $rss = false) { global $dbh; if ($rss) { @@ -124,7 +124,7 @@ * @param integer Timestamp of end date * @return array */ - function getDateRange($start,$end) + static function getDateRange($start,$end) { global $dbh; @@ -172,7 +172,7 @@ * @param string Filename of the release tarball * @param string MD5 checksum of the tarball */ - function upload($package, $version, $state, $relnotes, $tarball, $md5sum, + static function upload($package, $version, $state, $relnotes, $tarball, $md5sum, $pkg_info = false, $packagexml = false, $compatible = false) { global $auth_user; @@ -204,7 +204,7 @@ * @param string MD5 checksum of the tarball * @return mixed */ - function validateUpload($package, $version, $state, $relnotes, $tarball, $md5sum) + static function validateUpload($package, $version, $state, $relnotes, $tarball, $md5sum) { global $dbh, $auth_user; @@ -283,7 +283,7 @@ * @static * @return string the file name of the upload or PEAR_Error object if problems */ - function confirmUpload($package, $version, $state, $relnotes, $md5sum, $package_id, $file, + static function confirmUpload($package, $version, $state, $relnotes, $md5sum, $package_id, $file, $pkg_info = false, $packagexml = false, $compatible = false) { require_once "PEAR/Common.php"; @@ -494,7 +494,7 @@ * @param string * @return boolean */ - function dismissUpload($upload_ref) + static function dismissUpload($upload_ref) { return (bool)@unlink($upload_ref); } @@ -514,7 +514,7 @@ * @return mixed * @static */ - function HTTPdownload($package, $version = null, $file = null, $uncompress = false) + static function HTTPdownload($package, $version = null, $file = null, $uncompress = false) { global $dbh; @@ -628,7 +628,7 @@ * @param string State * @return boolean */ - function isValidState($state) + static function isValidState($state) { static $states = array('devel', 'snapshot', 'alpha', 'beta', 'stable'); return in_array($state, $states); @@ -644,7 +644,7 @@ * @param boolean include the state in the array returned * @return boolean */ - function betterStates($state, $include = false) + static function betterStates($state, $include = false) { static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable'); $i = array_search($state, $states); @@ -667,7 +667,7 @@ * @param integer ID of the release * @param string Filename */ - function logDownload($package, $release_id, $file = null) + static function logDownload($package, $release_id, $file = null) { global $dbh; @@ -760,7 +760,7 @@ * @param string Filename of the new uploaded release * @return void */ - function promote($pkginfo, $upload) + static function promote($pkginfo, $upload) { if ($_SERVER['SERVER_NAME'] != PEAR_CHANNELNAME) { return; @@ -821,7 +821,7 @@ * @param string Filename of the new uploaded release * @return void */ - function promote_v2($pkginfo, $upload) + static function promote_v2($pkginfo, $upload) { if ($_SERVER['SERVER_NAME'] != PEAR_CHANNELNAME) { return; @@ -882,7 +882,7 @@ * @param integer ID of the release * @return boolean */ - function remove($package, $release) + static function remove($package, $release) { global $dbh, $auth_user; include_once 'pear-database-user.php'; @@ -945,7 +945,7 @@ * @param string Version string of the package * @return mixed PEAR_Error or Array */ - function getFAQ($package, $version) + static function getFAQ($package, $version) { global $dbh; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-statistics.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-statistics.php diff -u pearweb/include/pear-database-statistics.php:1.1 pearweb/include/pear-database-statistics.php:1.2 --- pearweb/include/pear-database-statistics.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-statistics.php Mon Apr 23 04:21:41 2007 @@ -18,7 +18,7 @@ | Martin Jansen <mj@php.net> | | Gregory Beaver <cellog@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database-statistics.php,v 1.1 2007/04/22 01:51:35 dufuz Exp $ + $Id: pear-database-statistics.php,v 1.2 2007/04/23 04:21:41 cellog Exp $ */ class statistics @@ -31,7 +31,7 @@ * @param integer ID of the package * @return array */ - function package($id) + static function package($id) { global $dbh; $query = "SELECT SUM(dl_number) FROM package_stats WHERE pid = " . (int)$id; @@ -41,7 +41,7 @@ // }}} // {{{ release() - function release($id, $rid = "") + static function release($id, $rid = "") { global $dbh; http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-user.php?r1=1.1&r2=1.2&diff_format=u Index: pearweb/include/pear-database-user.php diff -u pearweb/include/pear-database-user.php:1.1 pearweb/include/pear-database-user.php:1.2 --- pearweb/include/pear-database-user.php:1.1 Sun Apr 22 01:51:35 2007 +++ pearweb/include/pear-database-user.php Mon Apr 23 04:21:41 2007 @@ -4,7 +4,7 @@ { // {{{ *proto bool user::remove(string) API 1.0 - function remove($uid) + static function remove($uid) { global $dbh; @@ -19,7 +19,7 @@ // }}} // {{{ *proto bool user::rejectRequest(string, string) API 1.0 - function rejectRequest($uid, $reason) + static function rejectRequest($uid, $reason) { global $dbh, $auth_user; list($email) = $dbh->getRow('SELECT email FROM users WHERE handle = ?', @@ -37,7 +37,7 @@ // }}} // {{{ *proto bool user::activate(string) API 1.0 - function activate($uid, $karmalevel = 'pear.dev') + static function activate($uid, $karmalevel = 'pear.dev') { require_once "Damblan/Karma.php"; @@ -80,7 +80,7 @@ // }}} // {{{ +proto bool user::isAdmin(string) API 1.0 - function isAdmin($handle) + static function isAdmin($handle) { require_once "Damblan/Karma.php"; @@ -93,7 +93,7 @@ // }}} // {{{ +proto bool user::isQA(string) API post 1.0 - function isQA($handle) + static function isQA($handle) { require_once 'Damblan/Karma.php'; @@ -106,7 +106,7 @@ // }}} // {{{ proto bool user::listAdmins() API 1.0 - function listAdmins() + static function listAdmins() { require_once "Damblan/Karma.php"; @@ -119,7 +119,7 @@ // }}} // {{{ +proto bool user::exists(string) API 1.0 - function exists($handle) + static function exists($handle) { global $dbh; $sql = "SELECT handle FROM users WHERE handle=?"; @@ -130,7 +130,7 @@ // }}} // {{{ +proto string user::maintains(string|int, [string]) API 1.0 - function maintains($user, $pkgid, $role = 'any') + static function maintains($user, $pkgid, $role = 'any') { global $dbh; include_once 'pear-database-package.php'; @@ -150,7 +150,7 @@ // }}} // {{{ - function getPackages($user) + static function getPackages($user) { global $dbh; $query = 'SELECT p.id, p.name, m.role, m.active' @@ -164,7 +164,7 @@ // }}} // {{{ proto string user::info(string, [string]) API 1.0 - function info($user, $field = null) + static function info($user, $field = null) { global $dbh; if ($field === null) { @@ -184,7 +184,7 @@ // }}} // {{{ listAll() - function listAll($registered_only = true) + static function listAll($registered_only = true) { global $dbh; $query = "SELECT * FROM users"; @@ -217,7 +217,7 @@ * * @access public */ - function add(&$data, $md5ed = false) + static function add(&$data, $md5ed = false) { global $dbh; @@ -380,7 +380,7 @@ * @param array User information * @return object Instance of PEAR_User */ - function update($data) { + static function update($data) { global $dbh; $fields = array('name', @@ -417,7 +417,7 @@ * @param int Number of releases (default is 10) * @return array */ - function getRecentReleases($handle, $n = 10) + static function getRecentReleases($handle, $n = 10) { global $dbh; $recent = array(); @@ -456,7 +456,7 @@ * @access public * @return array */ - function getWhoIsWho() { + static function getWhoIsWho() { global $dbh; // IP whitelist