Re: cvs: php4(PHP_4_0_6) /pear/Cache OutputCompression.php

From: Date: Tue, 15 May 2001 02:29:02 +0000
Subject: Re: cvs: php4(PHP_4_0_6) /pear/Cache OutputCompression.php
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-379@lists.php.net to get a copy of this message
On Mon, May 14, 2001 at 08:58:43AM -0000, Christian Stocker wrote: > Log: > do not compress if $this->no_cache is True (otherwise we get some "Headers > already sent"-errors) [snip] > + if ($this->compression && !$this->no_cache) { I'd just like to make a suggestion (more semantic than anything): In instances like this, I generally prefer to resort to the language rule of avoiding double-negatives. In the above case, we're looking at "if not no_cache" when it could more plainly be written as "if cache" (if the inverse being "if not cache", as opposed to "if no_cache"). In my opinion, this is much clearer when read in context. I would therefore like to propose the attached changes. Would anyone object to my committing them? I don't want to overstep any implicit maintainership. -- Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology http://www.csh.rit.edu/~jon/ : Computer Science House Member

Index: Output.php =================================================================== RCS file: /repository/php4/pear/Cache/Output.php,v retrieving revision 1.15 diff -u -r1.15 Output.php --- Output.php 2001/03/17 16:06:31 1.15 +++ Output.php 2001/05/15 02:25:04 @@ -130,7 +130,7 @@ * @access public */ function start($id, $group = "default") { - if ($this->no_cache) + if (!$this->caching) return ""; // this is already cached return it from the cache so that the user @@ -163,7 +163,7 @@ ob_end_clean(); // store in the cache - if (!$this->no_cache) + if ($this->caching) $this->container->save($this->output_id, $content, $expire, $this->output_group, $userdata); return $content; Index: OutputCompression.php =================================================================== RCS file: /repository/php4/pear/Cache/OutputCompression.php,v retrieving revision 1.2 diff -u -r1.2 OutputCompression.php --- OutputCompression.php 2001/05/14 09:01:03 1.2 +++ OutputCompression.php 2001/05/15 02:25:04 @@ -84,7 +84,7 @@ function get($id, $group) { $this->content = ""; - if ($this->no_cache) + if (!$this->caching) return ""; if ($this->isCached($id, $group) && !$this->isExpired($id, $group)) @@ -105,7 +105,7 @@ ob_end_clean(); // store in the cache - if (!$this->no_cache) { + if ($this->caching) { $this->extSave($this->output_id, $content, $userdata, $expire, $this->output_group); return $this->content; } @@ -124,7 +124,7 @@ * */ function extSave($id, $cachedata, $userdata, $expires = 0, $group = "default") { - if ($this->no_cache) + if (!$this->caching) return true; if ($this->compression) { @@ -155,7 +155,7 @@ if ("" == $content) $content = &$this->content; - if ($this->compression && !$this->no_cache) { + if ($this->compression && $this->caching) { $etag = 'PEAR-Cache-' . md5(substr($content, -40)); header("ETag: $etag");
« previous php.pear.dev (#379) next »