forked from leftypol/leftypol
functions.php: tweak compressed page creation
This commit is contained in:
parent
a6d4772db0
commit
88bb079d45
1 changed files with 8 additions and 7 deletions
|
|
@ -647,13 +647,14 @@ function file_write($path, $data, $simple = false, $skip_purge = false) {
|
||||||
if ($config['gzip_static']) {
|
if ($config['gzip_static']) {
|
||||||
$gzpath = "$path.gz";
|
$gzpath = "$path.gz";
|
||||||
|
|
||||||
if ($bytes & ~0x3ff) { // if ($bytes >= 1024)
|
// 12KBs (2 left for headers etc) to stay within the 14 KBs of the standard initial TCP packet.
|
||||||
if (file_put_contents($gzpath, gzencode($data), $simple ? 0 : LOCK_EX) === false)
|
if ($bytes >= 12288) {
|
||||||
error("Unable to write to file: $gzpath");
|
if (\file_put_contents($gzpath, \gzencode($data), $simple ? 0 : LOCK_EX) === false) {
|
||||||
//if (!touch($gzpath, filemtime($path), fileatime($path)))
|
// Do not fail completely if the write fails.
|
||||||
// error("Unable to touch file: $gzpath");
|
\error_log("Unable to write to file: $gzpath");
|
||||||
}
|
@unlink($gzpath);
|
||||||
else {
|
}
|
||||||
|
} else {
|
||||||
@unlink($gzpath);
|
@unlink($gzpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue