Author: kn
Date: Sat Jan 5 13:30:47 2008
New Revision: 7079
Log:
- Added patch for cache serialize handler
Added:
trunk/cache_serialize.patch
Added: trunk/cache_serialize.patch
==============================================================================
--- trunk/cache_serialize.patch (added)
+++ trunk/cache_serialize.patch [iso-8859-1] Sat Jan 5 13:30:47 2008
@@ -1,0 +1,107 @@
+Index: Cache/src/cache_autoload.php
+===================================================================
+--- Cache/src/cache_autoload.php (revision 7072)
++++ Cache/src/cache_autoload.php (working copy)
+@@ -9,7 +9,7 @@
+ * @package Cache
+ */
+
+-return array(
++return array (
+ 'ezcCacheException' =>
'Cache/exceptions/exception.php',
+ 'ezcCacheApcException' =>
'Cache/exceptions/apc_exception.php',
+ 'ezcCacheInvalidDataException' =>
'Cache/exceptions/invalid_data.php',
+@@ -29,6 +29,7 @@
+ 'ezcCacheMemcacheBackend' =>
'Cache/backends/memcache/memcache_backend.php',
+ 'ezcCacheMemoryVarStruct' => 'Cache/structs/memory_var.php',
+ 'ezcCacheStorageApcPlain' => 'Cache/storage/apc/plain.php',
++ 'ezcCacheStorageFileSerialize' =>
'Cache/storage/file/serialize.php',
+ 'ezcCacheStorageFileApcArray' =>
'Cache/storage/apc/apc_array.php',
+ 'ezcCacheStorageFileApcArrayDataStruct' =>
'Cache/structs/file_apc_array_data.php',
+ 'ezcCacheStorageFileApcArrayOptions' =>
'Cache/options/storage_apc_array.php',
+Index: Cache/src/storage/file/serialize.php
+===================================================================
+--- Cache/src/storage/file/serialize.php (revision 0)
++++ Cache/src/storage/file/serialize.php (revision 0)
+@@ -0,0 +1,75 @@
++<?php
++/**
++ * File containing the ezcCacheStorageSerialize class.
++ *
++ * @package Cache
++ * @version //autogentag//
++ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
++ * @license http://ez.no/licenses/new_bsd New BSD License
++ * @filesource
++ */
++
++/**
++ * This class implements a simple storage to cache plain text
++ * on the filesystem. It takes it's base methods from the extended
++ * storage base class [EMAIL PROTECTED] ezcCacheStorageFile}.
++ *
++ * In contrast to other [EMAIL PROTECTED] ezcCacheStorageFile}
implementations, the stored
++ * cache data is restored using PHP's file_get_contents() class. This cache
++ * is not capable to store array values. If numeric values are stored the
++ * restored values will be of type string. The same applies to values of the
++ * simple type bool. It is highly recommended that you cast the resulting
++ * value to it's correct type, also PHP will automatically perform this cast
++ * when necessary. An explicit cast ensures, that type consistant comparisons
++ * (using the === or !== operators) will not fail on restored cache data.
++ *
++ * An even better solution, if you want to store non-string values, are the
++ * usage of [EMAIL PROTECTED] ezcCacheStorageFileArray} and
++ * [EMAIL PROTECTED] ezcCacheStorageFileEvalArray} storage classes, since
those keep the
++ * variable types of you cached data consistant.
++ *
++ * For example code of using a cache storage, see [EMAIL PROTECTED]
ezcCacheManager}.
++ *
++ * The Cache package contains several other implementations of
++ * [EMAIL PROTECTED] ezcCacheStorageFile}. As there are:
++ *
++ * - ezcCacheStorageFileArray
++ * - ezcCacheStorageFileSerialize
++ *
++ * @package Cache
++ */
++class ezcCacheStorageFileSerialize extends ezcCacheStorageFile
++{
++ /**
++ * Fetch data from the cache.
++ * This method does the fetching of the data itself. In this case, the
++ * method simply includes the file and returns the value returned by the
++ * include (or false on failure).
++ *
++ * @param string $filename The file to fetch data from.
++ * @return mixed The fetched data or false on failure.
++ */
++ protected function fetchData( $filename )
++ {
++ return unserialize( file_get_contents( $filename ) );
++ }
++
++ /**
++ * Serialize the data for storing.
++ * Serializes a PHP variable (except type resource and object) to a
++ * executable PHP code representation string.
++ *
++ * @param mixed $data Simple type or array
++ * @return string The serialized data
++ *
++ * @throws ezcCacheInvalidDataException
++ * If the data submitted is an array,object or a resource, since
++ * this implementation of [EMAIL PROTECTED] ezcCacheStorageFile}
can only deal
++ * with scalar values.
++ */
++ protected function prepareData( $data )
++ {
++ return serialize( $data );
++ }
++}
++?>
+
+Property changes on: Cache/src/storage/file/serialize.php
+___________________________________________________________________
+Name: svn:eol-style
+ + native
+
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components