[pLog-svn] r2931 - plog/trunk/class/cache/Cache_Lite

Mark Wu markplace at gmail.com
Thu Feb 9 13:40:00 GMT 2006


Hi Jon:

Can you test the fix again? I already test it under windows and dreamhost,
it seems work.

If it still has bugs in your linux box, I think I will follow Oscar's idea
to revert it back to old version.

Thanks for your testing!

Mark 

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> mark at devel.lifetype.net
> Sent: Thursday, February 09, 2006 9:24 PM
> To: plog-svn at devel.lifetype.net
> Subject: [pLog-svn] r2931 - plog/trunk/class/cache/Cache_Lite
> 
> Author: mark
> Date: 2006-02-09 13:23:29 +0000 (Thu, 09 Feb 2006) New Revision: 2931
> 
> Modified:
>    plog/trunk/class/cache/Cache_Lite/Lite.php
> Log:
> I just rewrite the _write()function in lite.php, it seems 
> fixed the bug of the cache_list version 1.6 in linux.
> 
> I also submit a bug report to the cache_lite author, hope he 
> can include the bug fix in coming verion 1.7
> 
> Modified: plog/trunk/class/cache/Cache_Lite/Lite.php
> ===================================================================
> --- plog/trunk/class/cache/Cache_Lite/Lite.php	
> 2006-02-07 14:27:14 UTC (rev 2930)
> +++ plog/trunk/class/cache/Cache_Lite/Lite.php	
> 2006-02-09 13:23:29 UTC (rev 2931)
> @@ -577,7 +577,7 @@
>                                      }
>                                  }
>                                  break;
> -                            case 'notingrou':
> +                            case 'notingroup':
>                                  if (!strpos($file2, $motif, 0)) {
>                                      $result = ($result and 
> ($this->_unlink($file2)));
>                                  }
> @@ -701,33 +701,27 @@
>      */
>      function _write($data)
>      {
> -        $try = 1;
> -        while ($try<=2) {
> -            $fp = @fopen($this->_file, "wb");
> -            if ($fp) {
> -                if ($this->_fileLocking) @flock($fp, LOCK_EX);
> -                if ($this->_readControl) {
> -                    @fwrite($fp, $this->_hash($data, 
> $this->_readControlType), 32);
> -                }
> -                $len = strlen($data);
> -                @fwrite($fp, $data, $len);
> -                if ($this->_fileLocking) @flock($fp, LOCK_UN);
> -                @fclose($fp);
> -                return true;
> -            } else {
> -                if (($try==1) and ($this->_hashedDirectoryLevel>0)) {
> -                    $hash = md5($this->_fileName);
> -                    $root = $this->_cacheDir;
> -                    for ($i=0 ; 
> $i<$this->_hashedDirectoryLevel ; $i++) {
> -                        $root = $root . 'cache_' . 
> substr($hash, 0, $i + 1) . '/';
> -                        @mkdir($root, $this->_hashedDirectoryUmask);
> -                    }
> -                    $try = 2;
> -                } else {
> -                    $try = 999;
> -                }
> -            }
> +       	if(!is_dir(dirname($this->_file)) && 
> ($this->_hashedDirectoryLevel>0)) {
> +            $hash = md5($this->_fileName);
> +            $root = $this->_cacheDir;
> +            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
> +                $root = $root . 'cache_' . substr($hash, 0, 
> $i + 1) . '/';
> +                if(!is_dir($root)) @mkdir($root, 
> $this->_hashedDirectoryUmask);
> +            }        	
>          }
> +        
> +        $fp = @fopen($this->_file, "wb");
> +        if ($fp) {
> +            if ($this->_fileLocking) @flock($fp, LOCK_EX);
> +            if ($this->_readControl) {
> +                @fwrite($fp, $this->_hash($data, 
> $this->_readControlType), 32);
> +            }
> +            $len = strlen($data);
> +            @fwrite($fp, $data, $len);
> +            if ($this->_fileLocking) @flock($fp, LOCK_UN);
> +            @fclose($fp);
> +            return true;
> +        }
>          $this->log->log('Unable to write cache file : 
> '.$this->_file, LOGGER_PRIO_ERROR );
>          return false;
>      }
> 
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list