Пример #1
0
# -- actions and cron run regardless of cache restrictions
$core->checkActions();
$core->cronCheck();
# ab -n50 total mean: 624ms 46ms (41ms with cache enabled)
# -- cache test
if (CONS_CACHE && !isset($_REQUEST['nocache'])) {
    $core->cacheControl->cachepath = CONS_PATH_CACHE . $_SESSION['CODE'] . "/caches/";
    $core->cacheControl->cacheseed = '';
    // language and user id are automatic
    if ($core->cacheControl->canUseCache($core->offlineMode)) {
        # we can use the cache, load it up
        $usedCache = true;
        $PAGE = $core->cacheControl->renderCache();
    } else {
        # can't use cache, build page normally (same as on the next ELSE)
        $core->renderPage();
        $core->template->constants['ACTION'] = $core->action;
        // yes, render could change it
        $core->template->constants['CONTEXT'] = $core->context_str;
        $PAGE = $core->showTemplate();
        unset($core->template);
        // free memory
        if ($core->layout < 2) {
            $core->cacheControl->setCache($PAGE);
        }
    }
} else {
    # cache disabled or can't use cache, build page normaly (same as on the ELSE above)
    // note: core::loadMetadata already run a dumpTemplateCaches if that was required
    $core->renderPage();
    $core->template->constants['ACTION'] = $core->action;