27 const DEFAULT_BOOT_CACHE_TTL = 0;
36 set_error_handler(
'_elgg_php_error_handler');
37 set_exception_handler(
'_elgg_php_exception_handler');
44 $db->setupConnections();
45 $db->assertInstalled();
48 $local_path = Local::root()->getPath();
52 $CONFIG->plugins_path =
"{$local_path}mod/";
53 $CONFIG->pluginspath =
"{$local_path}mod/";
54 $CONFIG->entity_types = [
'group',
'object',
'site',
'user'];
61 $rows = $db->getData(
" 63 FROM {$db->prefix}datalists 64 WHERE `name` IN ('__site_secret__', 'default_site', 'dataroot') 68 $datalists[$row->name] = $row->value;
72 if (empty($datalists[
'dataroot'])) {
73 $datalists[
'dataroot'] =
'';
79 if (!$GLOBALS[
'_ELGG']->dataroot_in_settings) {
80 $CONFIG->dataroot = rtrim($datalists[
'dataroot'],
'/\\') . DIRECTORY_SEPARATOR;
82 $CONFIG->site_guid = (int)$datalists[
'default_site'];
83 $CONFIG->site_id = (int)$datalists[
'default_site'];
84 if (!isset(
$CONFIG->boot_cache_ttl)) {
85 $CONFIG->boot_cache_ttl = self::DEFAULT_BOOT_CACHE_TTL;
89 $this->timer->begin([__CLASS__ .
'::getBootData']);
96 $this->timer->begin([__CLASS__ .
'::getBootData']);
100 $datalist_cache =
$data->getDatalistCache();
101 foreach ([
'__site_secret__',
'default_site',
'dataroot'] as
$key) {
102 $datalist_cache->put($key, $datalists[$key]);
114 foreach (
$data->getConfigValues() as $key =>
$value) {
122 if (!$GLOBALS[
'_ELGG']->simplecache_enabled_in_settings) {
123 $simplecache_enabled = $datalist_cache->get(
'simplecache_enabled');
124 $CONFIG->simplecache_enabled = ($simplecache_enabled ===
false) ? 1 : $simplecache_enabled;
127 $system_cache_enabled = $datalist_cache->get(
'system_cache_enabled');
128 $CONFIG->system_cache_enabled = ($system_cache_enabled ===
false) ? 1 : $system_cache_enabled;
131 $CONFIG->lastcache = (int)$datalist_cache->get(
"simplecache_lastupdate");
133 $GLOBALS[
'_ELGG']->i18n_loaded_from_cache =
false;
144 if (
$CONFIG->system_cache_enabled) {
150 $preload_md_guids = [
$CONFIG->site_guid];
155 _elgg_services()->metadataCache->populateFromEntities($preload_md_guids);
161 $CONFIG->site_config_loaded =
true;
165 if (0 === strpos(
$action,
'admin/' ||
$action ===
'plugins/settings/save')) {
166 $this->invalidateCache();
181 $site_guid =
$CONFIG->site_guid;
185 static $cleared = [];
186 if (empty($cleared[$site_guid])) {
187 $this->getStashItem(
$CONFIG, $site_guid)->clear();
188 $cleared[$site_guid] =
true;
203 $CONFIG->_boot_cache_hit =
false;
205 if (!$CONFIG->boot_cache_ttl) {
211 $item = $this->getStashItem($CONFIG, $CONFIG->site_guid);
212 $item->setInvalidationMethod(Invalidation::NONE);
214 if (
$item->isMiss()) {
218 $item->expiresAfter($CONFIG->boot_cache_ttl);
221 $CONFIG->_boot_cache_hit =
true;
235 private function getStashItem(\
stdClass $CONFIG, $site_guid) {
236 if (!empty($CONFIG->memcache) && Memcache::isAvailable()) {
238 if (!empty($CONFIG->memcache_servers)) {
239 $options[
'servers'] = $CONFIG->memcache_servers;
243 if (!$CONFIG->dataroot) {
245 $driver =
new BlackHole();
247 $driver =
new FileSystem([
248 'path' => $CONFIG->dataroot,
252 return (
new Pool($driver))->getItem(
"boot_data_{$site_guid}");
invalidateCache($site_guid=0)
Invalidate the cache item.
trait Profilable
Make an object accept a timer.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
Boots Elgg and manages a cache of data needed during boot.
Serializable collection of data used to boot Elgg.
static elggDir()
Returns a directory that points to the root of Elgg, but not necessarily the install root...
_elgg_session_boot()
Initializes the session and checks for the remember me cookie.
$user_guid
Avatar remove action.
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use