summaryrefslogtreecommitdiffstats
path: root/system/core/Output.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-15 16:51:58 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-15 16:51:58 +0100
commit60f71be48a6b91cc314908c3c0007f13e9cb2f0a (patch)
treec7eb0d43c976984303886503781e0fcae0f0949a /system/core/Output.php
parent9916bfc126b0d6efa337740b263f123c5367fc55 (diff)
parentd8b1ad31cf7ee205ddf3cf396b1d1bfa45af49fa (diff)
Merge changes from develop
Diffstat (limited to 'system/core/Output.php')
-rw-r--r--system/core/Output.php27
1 files changed, 22 insertions, 5 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index cdb92b3c6..2ad8e90fa 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -591,7 +591,16 @@ class CI_Output {
'headers' => $this->headers
));
- fwrite($fp, $cache_info.'ENDCI--->'.$output);
+ $output = $cache_info.'ENDCI--->'.$output;
+
+ for ($written = 0, $length = strlen($output); $written < $length; $written += $result)
+ {
+ if (($result = fwrite($fp, substr($output, $written))) === FALSE)
+ {
+ break;
+ }
+ }
+
flock($fp, LOCK_UN);
}
else
@@ -601,12 +610,20 @@ class CI_Output {
}
fclose($fp);
- @chmod($cache_path, FILE_WRITE_MODE);
- log_message('debug', 'Cache file written: '.$cache_path);
+ if (is_int($result))
+ {
+ @chmod($cache_path, FILE_WRITE_MODE);
+ log_message('debug', 'Cache file written: '.$cache_path);
- // Send HTTP cache-control headers to browser to match file cache settings.
- $this->set_cache_header($_SERVER['REQUEST_TIME'], $expire);
+ // Send HTTP cache-control headers to browser to match file cache settings.
+ $this->set_cache_header($_SERVER['REQUEST_TIME'], $expire);
+ }
+ else
+ {
+ @unlink($cache_path);
+ log_message('error', 'Unable to write the complete cache content at: '.$cache_path);
+ }
}
// --------------------------------------------------------------------