Hello community, here is the log from the commit of package php5-pear-Horde_Memcache for openSUSE:Factory checked in at 2012-10-24 17:14:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/php5-pear-Horde_Memcache (Old) and /work/SRC/openSUSE:Factory/.php5-pear-Horde_Memcache.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "php5-pear-Horde_Memcache", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/php5-pear-Horde_Memcache/php5-pear-Horde_Memcache.changes 2011-09-23 12:40:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.php5-pear-Horde_Memcache.new/php5-pear-Horde_Memcache.changes 2012-10-24 17:14:38.000000000 +0200 @@ -1,0 +2,18 @@ +Tue Oct 16 11:17:03 UTC 2012 - jweberhofer@weberhofer.at + +- Shipping HTML-only format of license, as the original link + changes depending on the gnu.org's border + +------------------------------------------------------------------- +Tue Jan 17 12:57:07 UTC 2012 - lang@b1-systems.de + +- version 1.0.4 +- added external license file until version with shipped license file +- [mms] Silence undefined errors when a search key is not found on the server. + +------------------------------------------------------------------- +Thu Jun 9 13:45:33 UTC 2011 - lang@b1-systems.de + +- add upgrade path (obsoletes/provides) + +------------------------------------------------------------------- Old: ---- Horde_Memcache-1.0.3.tgz New: ---- Horde_Memcache-1.0.4.tgz lgpl-2.1-standalone.html ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php5-pear-Horde_Memcache.spec ++++++ --- /var/tmp/diff_new_pack.v92wBZ/_old 2012-10-24 17:14:40.000000000 +0200 +++ /var/tmp/diff_new_pack.v92wBZ/_new 2012-10-24 17:14:40.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package php5-pear-Horde_Memcache # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,21 +20,32 @@ %define xmldir /var/lib/pear Summary: PEAR: Horde Memcache API +License: LGPL-2.1 +Group: Development/Libraries/PHP Name: php5-pear-Horde_Memcache -Version: 1.0.3 -Release: 1 -License: LGPLv3 -Group: Development/Libraries/PHP +Version: 1.0.4 +Release: 0 Source0: http://pear.horde.org/get/Horde_Memcache-%{version}.tgz +Source1: http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://pear.horde.org/package/Horde_Memcache BuildRequires: php5-pear >= 1.4.7 -Requires: php5-pear-Horde_Exception < 2.0.0, php5-pear >= 1.7.0 +Requires: php5-pear >= 1.7.0 +Requires: php5-pear-Horde_Exception < 2.0.0 Conflicts: php5-pear-Horde_Exception = 2.0.0 BuildRequires: php5-pear-channel-horde Requires: php5-pear-channel-horde BuildArch: noarch +%define pear_name Horde_Memcache +%define pear_sname horde_memcache +# Fix for renaming (package convention) +Provides: pear-%{pear_sname} = %{version} +Provides: php-pear-%{pear_sname} = %{version} +Provides: php5-pear-%{pear_sname} = %{version} +Obsoletes: pear-%{pear_sname} < %{version} +Obsoletes: php-pear-%{pear_sname} < %{version} +Obsoletes: php5-pear-%{pear_sname} < %{version} %description The Horde_Memcache library provides an API to access a memcache @@ -44,7 +55,7 @@ %setup -c -T pear -v -c pearrc \ -d php_dir=%{peardir} \ - -d doc_dir=%{_docdir}%{name} \ + -d doc_dir=%{_docdir}/%{name} \ -d bin_dir=%{_bindir} \ -d data_dir=%{peardir}/data \ -d test_dir=%{peardir}/tests \ @@ -62,6 +73,11 @@ # Install XML package description mkdir -p %{buildroot}%{xmldir} + +#temporary solution until updated package with license file ships +mkdir -p %{buildroot}%{_docdir}/%{name} +cp -ar %{SOURCE1} %{buildroot}%{_docdir}/%{name} + tar -xzf %{SOURCE0} package.xml cp -p package.xml %{buildroot}%{xmldir}/Horde_Memcache.xml @@ -81,5 +97,6 @@ %{peardir}/* %{xmldir}/Horde_Memcache.xml +%doc %{_docdir}/%{name} %changelog ++++++ Horde_Memcache-1.0.3.tgz -> Horde_Memcache-1.0.4.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Memcache-1.0.3/lib/Horde/Memcache/Exception.php new/Horde_Memcache-1.0.3/lib/Horde/Memcache/Exception.php --- old/Horde_Memcache-1.0.3/lib/Horde/Memcache/Exception.php 2011-06-04 21:39:13.000000000 +0200 +++ new/Horde_Memcache-1.0.3/lib/Horde/Memcache/Exception.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -<?php -/** - * Exception handler for the Horde_Memcache package. - * - * Copyright 2011 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @author Michael Slusarz <slusarz@horde.org> - * @category Horde - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @package Memcache - */ -class Horde_Memcache_Exception extends Horde_Exception_Wrapped -{ -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Memcache-1.0.3/lib/Horde/Memcache.php new/Horde_Memcache-1.0.3/lib/Horde/Memcache.php --- old/Horde_Memcache-1.0.3/lib/Horde/Memcache.php 2011-06-04 21:39:13.000000000 +0200 +++ new/Horde_Memcache-1.0.3/lib/Horde/Memcache.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,458 +0,0 @@ -<?php -/** - * This class provides an API or Horde code to interact with a centrally - * configured memcache installation. - * - * memcached website: http://www.danga.com/memcached/ - * - * Copyright 2007-2011 The Horde Project (http://www.horde.org/) - * - * See the enclosed file COPYING for license information (LGPL). If you - * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. - * - * @author Michael Slusarz <slusarz@horde.org> - * @author Didi Rieder <adrieder@sbox.tugraz.at> - * @category Horde - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @package Memcache - */ -class Horde_Memcache implements Serializable -{ - /** - * The number of bits reserved by PHP's memcache layer for internal flag - * use. - */ - const FLAGS_RESERVED = 16; - - /** - * The max storage size of the memcache server. This should be slightly - * smaller than the actual value due to overhead. By default, the max - * slab size of memcached (as of 1.1.2) is 1 MB. - */ - const MAX_SIZE = 1000000; - - /** - * Serializable version. - */ - const VERSION = 1; - - /** - * Memcache object. - * - * @var Memcache - */ - protected $_memcache; - - /** - * Memcache defaults. - * - * @var array - */ - protected $_params = array( - 'compression' => false, - 'hostspec' => array('localhost'), - 'large_items' => true, - 'persistent' => false, - 'port' => array(11211), - 'prefix' => 'horde' - ); - - /** - * A list of items known not to exist. - * - * @var array - */ - protected $_noexist = array(); - - /** - * Logger instance. - * - * @var Horde_Log_Logger - */ - protected $_logger; - - /** - * Constructor. - * - * @param array $params Configuration parameters: - * - compression: (boolean) Compress data inside memcache? - * DEFAULT: false - * - c_threshold: (integer) The minimum value length before attempting - * to compress. - * DEFAULT: none - * - hostspec: (array) The memcached host(s) to connect to. - * DEFAULT: 'localhost' - * - large_items: (boolean) Allow storing large data items (larger than - * Horde_Memcache::MAX_SIZE)? - * DEFAULT: true - * - persistent: (boolean) Use persistent DB connections? - * DEFAULT: false - * - prefix: (string) The prefix to use for the memcache keys. - * DEFAULT: 'horde' - * - port: (array) The port(s) memcache is listening on. Leave empty - * if using UNIX sockets. - * DEFAULT: 11211 - * - weight: (array) The weight(s) to use for each memcached host. - * DEFAULT: none (equal weight to all servers) - * - * @throws Horde_Memcache_Exception - */ - public function __construct(array $params = array()) - { - $this->_params = array_merge($this->_params, $params); - - if (isset($params['logger'])) { - $this->_logger = $params['logger']; - } - - $this->_init(); - } - - /** - * Do initialization. - * - * @throws Horde_Memcache_Exception - */ - public function _init() - { - $this->_memcache = new Memcache(); - - $servers = array(); - for ($i = 0, $n = count($this->_params['hostspec']); $i < $n; ++$i) { - if ($this->_memcache->addServer($this->_params['hostspec'][$i], empty($this->_params['port'][$i]) ? 0 : $this->_params['port'][$i], !empty($this->_params['persistent']), !empty($this->_params['weight'][$i]) ? $this->_params['weight'][$i] : 1)) { - $servers[] = $this->_params['hostspec'][$i] . (!empty($this->_params['port'][$i]) ? ':' . $this->_params['port'][$i] : ''); - } - } - - /* Check if any of the connections worked. */ - if (empty($servers)) { - throw new Horde_Memcache_Exception('Could not connect to any defined memcache servers.'); - } - - if (!empty($this->_params['c_threshold'])) { - $this->_memcache->setCompressThreshold($this->_params['c_threshold']); - } - - // Force consistent hashing - ini_set('memcache.hash_strategy', 'consistent'); - - if ($this->_logger) { - $this->_logger->log('Connected to the following memcache servers:' . implode($servers, ', '), 'DEBUG'); - } - } - - /** - * Delete a key. - * - * @see Memcache::delete() - * - * @param string $key The key. - * @param integer $timeout Expiration time in seconds. - * - * @return boolean True on success. - */ - public function delete($key, $timeout = 0) - { - return isset($this->_noexist[$key]) - ? false - : $this->_memcache->delete($this->_key($key), $timeout); - } - - /** - * Get data associated with a key. - * - * @see Memcache::get() - * - * @param mixed $keys The key or an array of keys. - * - * @return mixed The string/array on success (return type is the type of - * $keys), false on failure. - */ - public function get($keys) - { - $flags = null; - $key_map = $missing_parts = $os = $out_array = array(); - $ret_array = true; - - if (!is_array($keys)) { - $keys = array($keys); - $ret_array = false; - } - $search_keys = $keys; - - foreach ($search_keys as $v) { - $key_map[$v] = $this->_key($v); - } - - if (($res = $this->_memcache->get(array_values($key_map), $flags)) === false) { - return false; - } - - /* Check to see if we have any oversize items we need to get. */ - if (!empty($this->_params['large_items'])) { - foreach ($key_map as $key => $val) { - $part_count = ($flags[$val] >> self::FLAGS_RESERVED) - 1; - - switch ($part_count) { - case -1: - /* Ignore. */ - unset($res[$val]); - break; - - case 0: - /* Not an oversize part. */ - break; - - default: - $os[$key] = $this->_getOSKeyArray($key, $part_count); - foreach ($os[$key] as $val2) { - $missing_parts[] = $key_map[$val2] = $this->_key[$val2]; - } - break; - } - } - - if (!empty($missing_parts)) { - if (($res2 = $this->_memcache->get($missing_parts)) === false) { - return false; - } - - /* $res should now contain the same results as if we had - * run a single get request with all keys above. */ - $res = array_merge($res, $res2); - } - } - - foreach ($key_map as $k => $v) { - if (!isset($res[$v])) { - $this->_noexist[$k] = true; - } - } - - foreach ($keys as $k) { - $out_array[$k] = false; - if (isset($res[$key_map[$k]])) { - $data = $res[$key_map[$k]]; - if (isset($os[$k])) { - foreach ($os[$k] as $v) { - if (isset($res[$key_map[$v]])) { - $data .= $res[$key_map[$v]]; - } else { - $this->delete($k); - continue 2; - } - } - } - $out_array[$k] = @unserialize($data); - } elseif (isset($os[$k]) && !isset($res[$key_map[$k]])) { - $this->delete($k); - } - } - - return $ret_array - ? $out_array - : reset($out_array); - } - - /** - * Set the value of a key. - * - * @see Memcache::set() - * - * @param string $key The key. - * @param string $var The data to store. - * @param integer $timeout Expiration time in seconds. - * - * @return boolean True on success. - */ - public function set($key, $var, $expire = 0) - { - return $this->_set($key, @serialize($var), $expire); - } - - /** - * Set the value of a key. - * - * @param string $key The key. - * @param string $var The data to store (serialized). - * @param integer $timeout Expiration time in seconds. - * @param integer $lent String length of $len. - * - * @return boolean True on success. - */ - protected function _set($key, $var, $expire = 0, $len = null) - { - if (is_null($len)) { - $len = strlen($var); - } - - if (empty($this->_params['large_items']) && ($len > self::MAX_SIZE)) { - return false; - } - - for ($i = 0; ($i * self::MAX_SIZE) < $len; ++$i) { - $curr_key = $i ? ($key . '_s' . $i) : $key; - - $flags = $this->_getFlags($i ? 0 : ceil($len / self::MAX_SIZE)); - $res = $this->_memcache->set($this->_key($curr_key), substr($var, $i * self::MAX_SIZE, self::MAX_SIZE), $flags, $expire); - if ($res === false) { - $this->delete($key); - break; - } - unset($this->_noexist[$curr_key]); - } - - return $res; - } - - /** - * Replace the value of a key. - * - * @see Memcache::replace() - * - * @param string $key The key. - * @param string $var The data to store. - * @param integer $timeout Expiration time in seconds. - * - * @return boolean True on success, false if key doesn't exist. - */ - public function replace($key, $var, $expire = 0) - { - $var = @serialize($var); - $len = strlen($var); - - if ($len > self::MAX_SIZE) { - if (!empty($this->_params['large_items']) && - $this->_memcache->get($this->_key($key))) { - return $this->_set($key, $var, $expire, $len); - } - return false; - } - - return $this->_memcache->replace($this->_key($key), $var, $this->_getFlags(1), $expire); - } - - /** - * Obtain lock on a key. - * - * @param string $key The key to lock. - */ - public function lock($key) - { - /* Lock will automatically expire after 10 seconds. */ - while ($this->_memcache->add($this->_key($key . '_l'), 1, 0, 10) === false) { - /* Wait 0.005 secs before attempting again. */ - usleep(5000); - } - } - - /** - * Release lock on a key. - * - * @param string $key The key to lock. - */ - public function unlock($key) - { - $this->_memcache->delete($this->_key($key . '_l'), 0); - } - - /** - * Mark all entries on a memcache installation as expired. - */ - public function flush() - { - $this->_memcache->flush(); - } - - /** - * Get the statistics output from the current memcache pool. - * - * @return array The output from Memcache::getExtendedStats() using the - * current configuration values. - */ - public function stats() - { - return $this->_memcache->getExtendedStats(); - } - - /** - * Obtains the md5 sum for a key. - * - * @param string $key The key. - * - * @return string The corresponding memcache key. - */ - protected function _key($key) - { - return hash('md5', $this->_params['prefix'] . $key); - } - - /** - * Returns the key listing of all key IDs for an oversized item. - * - * @return array The array of key IDs. - */ - protected function _getOSKeyArray($key, $length) - { - $ret = array(); - for ($i = 0; $i < $length; ++$i) { - $ret[] = $key . '_s' . ($i + 1); - } - return $ret; - } - - /** - * Get flags for memcache call. - * - * @param integer $count - * - * @return integer - */ - protected function _getFlags($count) - { - $flags = empty($this->_params['compression']) - ? 0 - : MEMCACHE_COMPRESSED; - return ($flags | $count << self::FLAGS_RESERVED); - } - - /* Serializable methods. */ - - /** - * Serialize. - * - * @return string Serialized representation of this object. - */ - public function serialize() - { - return serialize(array( - self::VERSION, - $this->_params, - $this->_logger - )); - } - - /** - * Unserialize. - * - * @param string $data Serialized data. - * - * @throws Exception - * @throws Horde_Memcache_Exception - */ - public function unserialize($data) - { - $data = @unserialize($data); - if (!is_array($data) || - !isset($data[0]) || - ($data[0] != self::VERSION)) { - throw new Exception('Cache version change'); - } - - $this->_params = $data[1]; - $this->_logger = $data[2]; - - $this->_init(); - } - -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Memcache-1.0.4/lib/Horde/Memcache/Exception.php new/Horde_Memcache-1.0.4/lib/Horde/Memcache/Exception.php --- old/Horde_Memcache-1.0.4/lib/Horde/Memcache/Exception.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Memcache-1.0.4/lib/Horde/Memcache/Exception.php 2011-09-20 14:31:16.000000000 +0200 @@ -0,0 +1,17 @@ +<?php +/** + * Exception handler for the Horde_Memcache package. + * + * Copyright 2011 Horde LLC (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.horde.org/licenses/lgpl21. + * + * @author Michael Slusarz <slusarz@horde.org> + * @category Horde + * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 + * @package Memcache + */ +class Horde_Memcache_Exception extends Horde_Exception_Wrapped +{ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Horde_Memcache-1.0.4/lib/Horde/Memcache.php new/Horde_Memcache-1.0.4/lib/Horde/Memcache.php --- old/Horde_Memcache-1.0.4/lib/Horde/Memcache.php 1970-01-01 01:00:00.000000000 +0100 +++ new/Horde_Memcache-1.0.4/lib/Horde/Memcache.php 2011-09-20 14:31:16.000000000 +0200 @@ -0,0 +1,460 @@ +<?php +/** + * This class provides an API or Horde code to interact with a centrally + * configured memcache installation. + * + * memcached website: http://www.danga.com/memcached/ + * + * Copyright 2007-2011 Horde LLC (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.horde.org/licenses/lgpl21. + * + * @author Michael Slusarz <slusarz@horde.org> + * @author Didi Rieder <adrieder@sbox.tugraz.at> + * @category Horde + * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 + * @package Memcache + */ +class Horde_Memcache implements Serializable +{ + /** + * The number of bits reserved by PHP's memcache layer for internal flag + * use. + */ + const FLAGS_RESERVED = 16; + + /** + * The max storage size of the memcache server. This should be slightly + * smaller than the actual value due to overhead. By default, the max + * slab size of memcached (as of 1.1.2) is 1 MB. + */ + const MAX_SIZE = 1000000; + + /** + * Serializable version. + */ + const VERSION = 1; + + /** + * Memcache object. + * + * @var Memcache + */ + protected $_memcache; + + /** + * Memcache defaults. + * + * @var array + */ + protected $_params = array( + 'compression' => false, + 'hostspec' => array('localhost'), + 'large_items' => true, + 'persistent' => false, + 'port' => array(11211), + 'prefix' => 'horde' + ); + + /** + * A list of items known not to exist. + * + * @var array + */ + protected $_noexist = array(); + + /** + * Logger instance. + * + * @var Horde_Log_Logger + */ + protected $_logger; + + /** + * Constructor. + * + * @param array $params Configuration parameters: + * - compression: (boolean) Compress data inside memcache? + * DEFAULT: false + * - c_threshold: (integer) The minimum value length before attempting + * to compress. + * DEFAULT: none + * - hostspec: (array) The memcached host(s) to connect to. + * DEFAULT: 'localhost' + * - large_items: (boolean) Allow storing large data items (larger than + * Horde_Memcache::MAX_SIZE)? + * DEFAULT: true + * - persistent: (boolean) Use persistent DB connections? + * DEFAULT: false + * - prefix: (string) The prefix to use for the memcache keys. + * DEFAULT: 'horde' + * - port: (array) The port(s) memcache is listening on. Leave empty + * if using UNIX sockets. + * DEFAULT: 11211 + * - weight: (array) The weight(s) to use for each memcached host. + * DEFAULT: none (equal weight to all servers) + * + * @throws Horde_Memcache_Exception + */ + public function __construct(array $params = array()) + { + $this->_params = array_merge($this->_params, $params); + + if (isset($params['logger'])) { + $this->_logger = $params['logger']; + } + + $this->_init(); + } + + /** + * Do initialization. + * + * @throws Horde_Memcache_Exception + */ + public function _init() + { + $this->_memcache = new Memcache(); + + $servers = array(); + for ($i = 0, $n = count($this->_params['hostspec']); $i < $n; ++$i) { + if ($this->_memcache->addServer($this->_params['hostspec'][$i], empty($this->_params['port'][$i]) ? 0 : $this->_params['port'][$i], !empty($this->_params['persistent']), !empty($this->_params['weight'][$i]) ? $this->_params['weight'][$i] : 1)) { + $servers[] = $this->_params['hostspec'][$i] . (!empty($this->_params['port'][$i]) ? ':' . $this->_params['port'][$i] : ''); + } + } + + /* Check if any of the connections worked. */ + if (empty($servers)) { + throw new Horde_Memcache_Exception('Could not connect to any defined memcache servers.'); + } + + if (!empty($this->_params['c_threshold'])) { + $this->_memcache->setCompressThreshold($this->_params['c_threshold']); + } + + // Force consistent hashing + ini_set('memcache.hash_strategy', 'consistent'); + + if ($this->_logger) { + $this->_logger->log('Connected to the following memcache servers:' . implode($servers, ', '), 'DEBUG'); + } + } + + /** + * Delete a key. + * + * @see Memcache::delete() + * + * @param string $key The key. + * @param integer $timeout Expiration time in seconds. + * + * @return boolean True on success. + */ + public function delete($key, $timeout = 0) + { + return isset($this->_noexist[$key]) + ? false + : $this->_memcache->delete($this->_key($key), $timeout); + } + + /** + * Get data associated with a key. + * + * @see Memcache::get() + * + * @param mixed $keys The key or an array of keys. + * + * @return mixed The string/array on success (return type is the type of + * $keys), false on failure. + */ + public function get($keys) + { + $flags = null; + $key_map = $missing_parts = $os = $out_array = array(); + $ret_array = true; + + if (!is_array($keys)) { + $keys = array($keys); + $ret_array = false; + } + $search_keys = $keys; + + foreach ($search_keys as $v) { + $key_map[$v] = $this->_key($v); + } + + if (($res = $this->_memcache->get(array_values($key_map), $flags)) === false) { + return false; + } + + /* Check to see if we have any oversize items we need to get. */ + if (!empty($this->_params['large_items'])) { + foreach ($key_map as $key => $val) { + $part_count = isset($flags[$val]) + ? ($flags[$val] >> self::FLAGS_RESERVED) - 1 + : -1; + + switch ($part_count) { + case -1: + /* Ignore. */ + unset($res[$val]); + break; + + case 0: + /* Not an oversize part. */ + break; + + default: + $os[$key] = $this->_getOSKeyArray($key, $part_count); + foreach ($os[$key] as $val2) { + $missing_parts[] = $key_map[$val2] = $this->_key[$val2]; + } + break; + } + } + + if (!empty($missing_parts)) { + if (($res2 = $this->_memcache->get($missing_parts)) === false) { + return false; + } + + /* $res should now contain the same results as if we had + * run a single get request with all keys above. */ + $res = array_merge($res, $res2); + } + } + + foreach ($key_map as $k => $v) { + if (!isset($res[$v])) { + $this->_noexist[$k] = true; + } + } + + foreach ($keys as $k) { + $out_array[$k] = false; + if (isset($res[$key_map[$k]])) { + $data = $res[$key_map[$k]]; + if (isset($os[$k])) { + foreach ($os[$k] as $v) { + if (isset($res[$key_map[$v]])) { + $data .= $res[$key_map[$v]]; + } else { + $this->delete($k); + continue 2; + } + } + } + $out_array[$k] = @unserialize($data); + } elseif (isset($os[$k]) && !isset($res[$key_map[$k]])) { + $this->delete($k); + } + } + + return $ret_array + ? $out_array + : reset($out_array); + } + + /** + * Set the value of a key. + * + * @see Memcache::set() + * + * @param string $key The key. + * @param string $var The data to store. + * @param integer $timeout Expiration time in seconds. + * + * @return boolean True on success. + */ + public function set($key, $var, $expire = 0) + { + return $this->_set($key, @serialize($var), $expire); + } + + /** + * Set the value of a key. + * + * @param string $key The key. + * @param string $var The data to store (serialized). + * @param integer $timeout Expiration time in seconds. + * @param integer $lent String length of $len. + * + * @return boolean True on success. + */ + protected function _set($key, $var, $expire = 0, $len = null) + { + if (is_null($len)) { + $len = strlen($var); + } + + if (empty($this->_params['large_items']) && ($len > self::MAX_SIZE)) { + return false; + } + + for ($i = 0; ($i * self::MAX_SIZE) < $len; ++$i) { + $curr_key = $i ? ($key . '_s' . $i) : $key; + + $flags = $this->_getFlags($i ? 0 : ceil($len / self::MAX_SIZE)); + $res = $this->_memcache->set($this->_key($curr_key), substr($var, $i * self::MAX_SIZE, self::MAX_SIZE), $flags, $expire); + if ($res === false) { + $this->delete($key); + break; + } + unset($this->_noexist[$curr_key]); + } + + return $res; + } + + /** + * Replace the value of a key. + * + * @see Memcache::replace() + * + * @param string $key The key. + * @param string $var The data to store. + * @param integer $timeout Expiration time in seconds. + * + * @return boolean True on success, false if key doesn't exist. + */ + public function replace($key, $var, $expire = 0) + { + $var = @serialize($var); + $len = strlen($var); + + if ($len > self::MAX_SIZE) { + if (!empty($this->_params['large_items']) && + $this->_memcache->get($this->_key($key))) { + return $this->_set($key, $var, $expire, $len); + } + return false; + } + + return $this->_memcache->replace($this->_key($key), $var, $this->_getFlags(1), $expire); + } + + /** + * Obtain lock on a key. + * + * @param string $key The key to lock. + */ + public function lock($key) + { + /* Lock will automatically expire after 10 seconds. */ + while ($this->_memcache->add($this->_key($key . '_l'), 1, 0, 10) === false) { + /* Wait 0.005 secs before attempting again. */ + usleep(5000); + } + } + + /** + * Release lock on a key. + * + * @param string $key The key to lock. + */ + public function unlock($key) + { + $this->_memcache->delete($this->_key($key . '_l'), 0); + } + + /** + * Mark all entries on a memcache installation as expired. + */ + public function flush() + { + $this->_memcache->flush(); + } + + /** + * Get the statistics output from the current memcache pool. + * + * @return array The output from Memcache::getExtendedStats() using the + * current configuration values. + */ + public function stats() + { + return $this->_memcache->getExtendedStats(); + } + + /** + * Obtains the md5 sum for a key. + * + * @param string $key The key. + * + * @return string The corresponding memcache key. + */ + protected function _key($key) + { + return hash('md5', $this->_params['prefix'] . $key); + } + + /** + * Returns the key listing of all key IDs for an oversized item. + * + * @return array The array of key IDs. + */ + protected function _getOSKeyArray($key, $length) + { + $ret = array(); + for ($i = 0; $i < $length; ++$i) { + $ret[] = $key . '_s' . ($i + 1); + } + return $ret; + } + + /** + * Get flags for memcache call. + * + * @param integer $count + * + * @return integer + */ + protected function _getFlags($count) + { + $flags = empty($this->_params['compression']) + ? 0 + : MEMCACHE_COMPRESSED; + return ($flags | $count << self::FLAGS_RESERVED); + } + + /* Serializable methods. */ + + /** + * Serialize. + * + * @return string Serialized representation of this object. + */ + public function serialize() + { + return serialize(array( + self::VERSION, + $this->_params, + $this->_logger + )); + } + + /** + * Unserialize. + * + * @param string $data Serialized data. + * + * @throws Exception + * @throws Horde_Memcache_Exception + */ + public function unserialize($data) + { + $data = @unserialize($data); + if (!is_array($data) || + !isset($data[0]) || + ($data[0] != self::VERSION)) { + throw new Exception('Cache version change'); + } + + $this->_params = $data[1]; + $this->_logger = $data[2]; + + $this->_init(); + } + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package.xml new/package.xml --- old/package.xml 2011-06-04 21:39:13.000000000 +0200 +++ new/package.xml 2011-09-20 14:31:16.000000000 +0200 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.9.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> +<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>Horde_Memcache</name> <channel>pear.horde.org</channel> <summary>Horde Memcache API</summary> @@ -10,24 +10,24 @@ <email>slusarz@horde.org</email> <active>yes</active> </lead> - <date>2011-06-04</date> - <time>13:39:13</time> + <date>2011-09-20</date> + <time>14:31:16</time> <version> - <release>1.0.3</release> + <release>1.0.4</release> <api>1.0.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> -* [mms] pecl/Memcache version 3.0.3 upwards started to reserve the first 16 bits for internal flag use (Ticket #10123; goncalo.queiros@portugalmail.net). +* [mms] Silence undefined errors when a search key is not found on the server. </notes> <contents> <dir baseinstalldir="/" name="/"> - <file baseinstalldir="/" md5sum="f4d53d5eaa2857a34e0c1f9695759ce0" name="lib/Horde/Memcache/Exception.php" role="php" /> - <file baseinstalldir="/" md5sum="480271e35a18cd4e6d8e7035b103d9ee" name="lib/Horde/Memcache.php" role="php" /> + <file baseinstalldir="/" md5sum="4365aaa1a13f3c73f4f60d550d74e8cf" name="lib/Horde/Memcache/Exception.php" role="php" /> + <file baseinstalldir="/" md5sum="e711bd07c11cd86ed4964a98e325e06d" name="lib/Horde/Memcache.php" role="php" /> </dir> </contents> <dependencies> @@ -71,7 +71,7 @@ <api>alpha</api> </stability> <date>2011-03-08</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * First alpha release for Horde 4. * Remove Horde_Core dependency. @@ -87,7 +87,7 @@ <api>beta</api> </stability> <date>2011-03-16</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * First beta release for Horde 4. </notes> @@ -102,7 +102,7 @@ <api>beta</api> </stability> <date>2011-03-22</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * First release candidate for Horde 4. </notes> @@ -117,7 +117,7 @@ <api>beta</api> </stability> <date>2011-03-29</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * Second release candidate for Horde 4. </notes> @@ -132,7 +132,7 @@ <api>stable</api> </stability> <date>2011-04-06</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * First stable release for Horde 4. </notes> @@ -147,7 +147,7 @@ <api>stable</api> </stability> <date>2011-05-03</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * [jan] Fix dependency. </notes> @@ -162,7 +162,7 @@ <api>stable</api> </stability> <date>2011-06-01</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * [mms] Use memcache flags to keep track of large objects (goncalo.queiros@portugalmail.net, Request #10123). </notes> @@ -177,10 +177,25 @@ <api>stable</api> </stability> <date>2011-06-04</date> - <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> <notes> * [mms] pecl/Memcache version 3.0.3 upwards started to reserve the first 16 bits for internal flag use (Ticket #10123; goncalo.queiros@portugalmail.net). </notes> </release> + <release> + <version> + <release>1.0.4</release> + <api>1.0.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2011-09-20</date> + <license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license> + <notes> +* [mms] Silence undefined errors when a search key is not found on the server. + </notes> + </release> </changelog> </package> ++++++ lgpl-2.1-standalone.html ++++++ ++++ 620 lines (skipped) -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org