function _ultimate_cron_poorman_page_flush in Ultimate Cron 7.2
Output buffer callback for poormans cron early page flush.
Parameters
string $content: The content of the output buffer.
Return value
string The content of the output buffer.
1 string reference to '_ultimate_cron_poorman_page_flush'
- ultimate_cron.poorman.inc in ./
ultimate_cron.poorman.inc - Poormans cron functions.
File
- ./
ultimate_cron.poorman.inc, line 16 - Poormans cron functions.
Code
function _ultimate_cron_poorman_page_flush($content) {
if (empty($GLOBALS['ultimate_cron_page_flush'])) {
return $content;
}
// Check output buffer handlers to determine if we can safely
// set the content size in the http header.
$handlers = ob_list_handlers();
// Pop ourselves off...
array_pop($handlers);
// We can safe ignore default output handlers.
$default = array_keys($handlers, 'default output handler');
foreach ($default as $key) {
unset($handlers[$key]);
}
// We can also safely ignore zlib output handlers, if we remember to
// disable compression.
if ($zlib = array_keys($handlers, 'zlib output compression')) {
foreach ($zlib as $key) {
unset($handlers[$key]);
}
ini_set('zlib.output_compression', 'Off');
}
// If there are any unknown handlers left, we cannot safely set the
// Content-Length.
if (empty($handlers)) {
$size = strlen($content);
header("Content-Length: {$size}");
}
// In any case, we can always tell the client to close the connection.
header("Connection: close");
return $content;
}