On Jan 16, 2004, at 09:22, Erik Zachte wrote:
Brion has recently added code to store articles in 'old' SQL table in compressed format, so I will need to adjust the scripts for the international stats.
I spent several hours on it, and despite some useful tips from Brion I can't get those article data inflated, all I get is a Z_DATA_ERROR (-3)
Ok, couple of problems: Using chomp on the lines corrupts the input data. Taking the chomp out fixes that.
The same inflation stream gets reused for every file. That doesn't look right to me.
inflate() returns Z_STREAM_END when it gets to the end, not Z_OK. If you get Z_OK, you have to ask it to run more data, or something...? Not entirely sure how to handle that.
And the real hard one to figure out: PHP's gzdeflate(), gzinflate() set the window size to -MAX_WSIZE which disables the checksum. Unless you pass the same parameter to inflateInit(), the perl-side functions will expect those extra bytes and fail without explanation.
Attached is a version that mostly works, except it doesn't handle the Z_OK case right.
-- brion vibber (brion @ pobox.com)