[pmwiki-users] Re: Re: Questions on release 2.0.0 (PageStore class)

Karl Loncarek dh2mll at web.de
Sun Sep 4 13:13:28 CDT 2005


"Patrick R. Michaud" <pmichaud at pobox.com> wrote in
news:20050904155336.GD25153 at host.pmichaud.com: 

> On Sat, Sep 03, 2005 at 09:37:53PM +0000, Karl Loncarek wrote:
>> > So it seems to me that in order for gzpagestore to provide this 
>> > level of reliability, it would have to re-read and uncompress the
>> > file that was just written to check its contents and length.  That
>> > sort of check could probably be provided by default, or as an
>> > option. 
>> 
>> That sound reasonable to me, but how to do this? I would integrate
>> this, but I'm no expert in PHP and especially in OOP.
>> 
>> Can I call the read function from within the write function?
>> How would this have to look like?
> 
> Instead of the $s = $s && (filesize("$pagefile,new") > $sz * 0.95)
> line, try something like:
> 
>    $fp = gzopen("$pagefile,new", 'r');
>    $len = $sz * 0.95;
>    while ($len > 0 && !gzeof($fp)) 
>      { $x = gzread($fp, 4096); $len -= strlen($x); }
>    gzclose($fp);
>    $s = $s && ($len <= 0);
> 
> which reads back the file just written, returning success if at least
> 95% of the original length is recovered.
> 
> Pm
> 
Looks good I'll include that. Thanks.


-- 
Bye
Karl (aka Klonk)





More information about the pmwiki-users mailing list