if ($core->layout < 2) { $PAGE .= $core->errorControl->dumpUnexpectedOutput($error); } else { $PAGE .= $error; } } # -- performance monitor $totalTime = scriptTime() * 1000; if (CONS_CACHE) { $core->cacheControl->updateCacheControl($totalTime); } if ($totalTime > CONS_PM_TIME) { $fd = fopen(CONS_PATH_LOGS . $_SESSION['CODE'] . "/pm.log", "a"); if ($fd) { fwrite($fd, date("Y-m-d H:i:s") . " took " . number_format($totalTime, 2) . "ms :" . $core->context_str . $core->original_action . " (caller IP: " . CONS_IP . ")\n"); fclose($fd); } } # -- we are done here, close up whatever is no longer necessary and prepare to echo $core->close(false); # -- outputs gzip if on normal layout and browser supports gzip if (CONS_GZIP_OK && $core->layout < 2 && strlen($PAGE) > CONS_GZIP_MINSIZE) { header("Content-Encoding: gzip"); echo gzencode($PAGE); } else { echo $PAGE; } # -- clean up, we are so neat unset($PAGE); unset($core); # ab -n50 total mean: 673ms 74ms (47 with cache enabled)
} } # ab -n50 total mean: 417ms 76ms 50ms 47ms # -- build headers $core->headerControl->showHeaders(); } else { // when serving a file directly, these were not set because checkAction was never loaded $_SESSION[CONS_SESSION_ACCESS_LEVEL] = CONS_SESSION_ACCESS_LEVEL_GUEST; $core->currentAuth = CONS_AUTH_SESSION_GUEST; } # -- any script want to check the raw text/HTML output? foreach ($core->onEcho as $scriptName) { $core->loadedPlugins[$scriptName]->onEcho($PAGE); } if ($core->servingFile) { $core->close(true); } // end here if we were serving a file (we got here because the file were on statistics list) # -- collect and serve $error = ob_get_contents(); ob_end_clean(); # unexpected error? dump after the page if ($error != "") { if ($core->layout < 2) { $PAGE .= $core->errorControl->dumpUnexpectedOutput($error); } else { $PAGE .= $error; } } # -- performance monitor for cache throttle and overload warning $totalTime = scriptTime() * 1000;