RE: [pear-webmaster] I should maybe point out here..

From: Date: Thu, 09 Sep 2004 17:39:15 +0000
Subject: RE: [pear-webmaster] I should maybe point out here..
References: 1  Groups: php.pear.webmaster 
Request: Send a blank email to pear-webmaster+get-3103@lists.php.net to get a copy of this message
Following a discussion with Pierre on irc, it seems there's no consensus at the PEAR end about the extra info fields anyway <sigh /> In which case I'd better drop the idea until there _is_ some sort of consensus there. Can I ask you please to just fix the current function for the time being so I can at least get this much live? We'll figure a way to do the rest when the way ahead is clearer. Thanks.. patch attached. - Steph > -----Original Message----- > From: Martin Jansen [mailto:mj@php.net] > Sent: 09 September 2004 18:20 > To: Steph > Cc: PEAR Webmasters > Subject: Re: [pear-webmaster] I should maybe point out here.. > > > On Wed Sep 08, 2004 at 06:5539PM +0100, Steph wrote: > > The way I have things set up at present, if you click on a > package link and > > that package doesn't have an owner in the database, the package will > > magically cease to exist. So yes, it _does_ affect our end > too; I based my > > design around the initial discussions we had, not things that are coming > > along as I complete it (or try to), and it already sounds as if > I'm going to > > have to rewrite a fairly chunk of it due to the table business. > Thankfully > > it's not the logic that needs rewriting in that case, just > stuff like the > > number of array elements going into the db and being pulled > out. Missing > > developers will mean that part of the logic at our end has to > be rewritten > > too. It means I have to allow for the possibility of 'anon' - i.e. the > > information would still need to be in our db, but there'd need > to be a bool > > 'public' or 'private', which I'd need to access all over the > shop. Is it > > actually worth it? given that if you click on anon's packages you'll be > > faced with anon's name on the package page at pear.php.net? > > Ok, ok, you've convinced me. Let's drop this "feature". > > -- > - Martin Martin Jansen > http://martinjansen.com/

--- pear-database_orig.php Thu Sep 09 18:31:20 2004 +++ pear-database_new.php Thu Sep 09 18:32:54 2004 @@ -2314,7 +2314,7 @@ } // }}} - // {{{ * proto array user::getZendWhoIsWho([bool]) API 1.0 + // {{{ * proto array user::getZendWhoIsWho() API 1.0 /** * Get list of current developers and the packages they maintain. @@ -2325,42 +2325,27 @@ * of IP addresses. * * @access public - * @param bool Whether to return PECL developers (true) or PEAR - * developers (false) * @return array */ - function getZendWhoIsWho($pecl_only = false) { + function getZendWhoIsWho() { global $dbh; // IP whitelist - if (!in_array($_SERVER['REMOTE_ADDR'], array("127.0.0.1", "64.49.209.152", "209.61.191.11"))) { + if (!in_array($_SERVER['REMOTE_ADDR'], array("127.0.0.1", "209.61.191.11"))) { return array(); } - if ($pecl_only) { - $query_maintainers = "SELECT p.name, m.role, p.package_type " + $query_maintainers = "SELECT p.name, m.role, p.package_type " . "FROM maintains m, packages p " - . "WHERE m.package = p.id AND p.package_type='pecl' AND m.handle = ?"; - } else { - $query_maintainers = "SELECT p.name, m.role, p.package_type " - . "FROM maintains m, packages p " - . "WHERE m.package = p.id AND p.package_type='pear' AND m.handle = ?"; - } + . "WHERE m.package = p.id AND m.handle = ?"; $maintainers = $dbh->prepare($query_maintainers); + $group = $dbh->prepare("SELECT COUNT(id) FROM karma WHERE level = 'pear.group' AND user = ?"); + + /* Some pecl devs don't have pear.dev karma. Need to check every registered user. */ + $query = "SELECT handle, name, homepage, userinfo FROM users WHERE registered = 1"; - $group = $dbh->prepare("SELECT COUNT(id) " - . "FROM karma " - . "WHERE level = 'pear.group' AND user = ?"); - - // This fetches all users with pear.dev karma - $query = "SELECT u.handle, u.name, u.homepage, u.userinfo " - . "FROM users u, karma k " - . "WHERE k.user = u.handle AND k.level = 'pear.dev' AND u.registered = 1"; - - $query_group = "SELECT user " - . "FROM karma " - . "WHERE level = 'pear.group'"; + $query_group = "SELECT user FROM karma WHERE level = 'pear.group'"; $group_ids = $dbh->getCol($query_group); $group_ids = array_flip($group_ids); @@ -2377,12 +2362,36 @@ continue; } + // Get dev type - pear, pecl or both + $users[$id]['type'] = 0; + while ($row =& $sth->fetchRow(DB_FETCHMODE_ASSOC)) { $users[$id]['maintains'][] = $row; - if ($pecl_only && !isset($users[$id]['pecl']) && $row['package_type'] == 'pecl') { - $users[$id]['pecl'] = 1; + + switch ($users[$id]['type']) { + case '3': + break; + case '2': + if ($row['package_type'] == 'pear') { + $users[$id]['type'] = 3; + } + break; + case '1': + if ($row['package_type'] == 'pecl') { + $users[$id]['type'] = 3; + } + break; + default: + if ($row['package_type'] == 'pecl') { + $users[$id]['type'] = 2; + } + else { + $users[$id]['type'] = 1; + } + break; } } + if (isset($group_ids[$user['handle']])) { $users[$id]['group'] = 1; } else { @@ -2392,6 +2401,7 @@ return $users; } + // }}} } class channel
« previous php.pear.webmaster (#3103) next »