/** * Set up config appropriately on engine boot. * * @return void */ function init() { $lastcache = $this->config->get('lastcache'); if (!defined('UPGRADING') && empty($lastcache)) { $this->config->set('lastcache', (int) $this->datalist->get('simplecache_lastupdate')); } }
/** * Render a view for caching. Language views are handled specially. * * @param string $view The view name * @param string $viewtype The viewtype * @return string */ protected function renderView($view, $viewtype) { elgg_set_viewtype($viewtype); if ($viewtype === 'default' && preg_match("#^languages/(.*?)\\.js\$#", $view, $matches)) { $view = "languages.js"; $vars = ['language' => $matches[1]]; } else { $vars = []; } if (!elgg_view_exists($view)) { $this->send403(); } // disable error reporting so we don't cache problems $this->config->set('debug', null); return elgg_view($view, $vars); }
/** * Render a view for caching * * @param string $view The view name * @param string $viewtype The viewtype * @return string */ protected function renderView($view, $viewtype) { elgg_set_viewtype($viewtype); if (!elgg_view_exists($view)) { $this->send403(); } // disable error reporting so we don't cache problems $this->config->set('debug', null); // @todo elgg_view() checks if the page set is done (isset($GLOBALS['_ELGG']->pagesetupdone)) and // triggers an event if it's not. Calling elgg_view() here breaks submenus // (at least) because the page setup hook is called before any // contexts can be correctly set (since this is called before page_handler()). // To avoid this, lie about $CONFIG->pagehandlerdone to force // the trigger correctly when the first view is actually being output. $GLOBALS['_ELGG']->pagesetupdone = true; return elgg_view($view); }
/** * Loads the system cache during engine boot * * @see elgg_reset_system_cache() * @access private */ function loadAll() { if ($this->timer) { $this->timer->begin([__METHOD__]); } $this->config->set('system_cache_loaded', false); if (!_elgg_services()->views->configureFromCache($this)) { return; } $data = $this->load('view_types'); if (!is_string($data)) { return; } $GLOBALS['_ELGG']->view_types = unserialize($data); // Note: We don't need view_overrides for operation. Inspector can pull this from the cache $this->config->set('system_cache_loaded', true); if ($this->timer) { $this->timer->end([__METHOD__]); } }