function advagg_missing_async_opp in Advanced CSS/JS Aggregation 6
Same name and namespace in other branches
- 7 includes/missing.inc \advagg_missing_async_opp()
Output text & set php in async mode.
Parameters
$output: string - Text to output to open connection.
$wait: bool - Wait 1 second?
$content_type: string - Content type header.
$length: int - Content length.
1 call to advagg_missing_async_opp()
- advagg_missing_regenerate in ./
advagg.missing.inc - regenerates a missing css file.
File
- ./
advagg.missing.inc, line 223 - Advanced aggregation module; 404 handler.
Code
function advagg_missing_async_opp($output, $wait = TRUE, $content_type = "text/html; charset=utf-8", $length = 0) {
if (headers_sent()) {
return FALSE;
}
// Calculate Content Length
if ($length == 0) {
$output .= "\n";
$length = advagg_missing_strlen($output) - 1;
}
// Prime php for background operations
$loop = 0;
while (ob_get_level() && $loop < 25) {
ob_end_clean();
$loop++;
}
header("Connection: close");
ignore_user_abort();
// Output headers & data
ob_start();
header("Content-type: " . $content_type);
header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Cache-Control: must-revalidate");
header("Content-Length: " . $length);
header("Connection: close");
print $output;
ob_end_flush();
flush();
// wait for 1 second
if ($wait) {
sleep(1);
}
// text returned and connection closed.
// Do background processing. Time taken after should not effect page load times.
return TRUE;
}