Commit: b264c5f6d5db758e2f8ec345e8799560293a3c40 Author: Peter Cowburn <[email protected]> Fri, 25 Jul 2014 11:32:46 +0100 Parents: 20c935bfc6cd6f472c003fd9ebd79acf60324624 Branches: master
Link: http://git.php.net/?p=web/people.git;a=commitdiff;h=b264c5f6d5db758e2f8ec345e8799560293a3c40 Log: fix karma for people with both php and pear karma Changed paths: M include/karma.php Diff: diff --git a/include/karma.php b/include/karma.php index 09a0fe2..5e6d8e4 100644 --- a/include/karma.php +++ b/include/karma.php @@ -9,8 +9,8 @@ function findKarma($username) $mykarma = $karma[$username]; $retval = array( - "avail" => explode(PATH_SEPARATOR, $mykarma["avail"]), - "unavail" => explode(PATH_SEPARATOR, $mykarma["unavail"]), + "avail" => $mykarma["avail"], + "unavail" => $mykarma["unavail"], ); return $retval; } @@ -20,10 +20,23 @@ function fetchKarma() $ctx = stream_context_create(array("http" => array("ignore_errors" => true))); $content = cached("https://svn.php.net/repository/SVNROOT/global_avail", false, $ctx); $phpKarma = parseKarma(explode("\n", $content)); + $ctx = stream_context_create(array("http" => array("ignore_errors" => true))); $content = cached("https://svn.php.net/repository/SVNROOT/pear_avail", false, $ctx); $pearKarma = parseKarma(explode("\n", $content)); - return array_merge($phpKarma, $pearKarma); + + $allKarma = $phpKarma; + foreach ($pearKarma as $user => $userKarma) { + if (!array_key_exists($user, $allKarma)) { + $allKarma[$user] = $userKarma; + } else { + foreach (array('avail', 'unavail') as $type) { + $allKarma[$user][$type] = array_merge($allKarma[$user][$type], $userKarma[$type]); + } + } + } + + return $allKarma; } function parseKarma(array $avail_lines) @@ -81,14 +94,6 @@ function parseKarma(array $avail_lines) } } - // Stringify paths to save space in APC - foreach ($users as $user => $avails) { - foreach ($avails as $avail => $paths) { - natcasesort($users[$user][$avail]); - $users[$user][$avail] = implode(PATH_SEPARATOR, $paths); - } - } - // Sort by username, ascending ksort($users); -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
