63 if ($this->isEnabled()) {
64 $lastcache = (int) $this->config->lastcache;
80 $this->simplecache_views[
$view] = true;
91 if (isset($this->simplecache_views[
$view])) {
96 $current_viewtype = $this->views->getViewtype();
97 $viewtypes = [$current_viewtype];
99 if ($this->views->doesViewtypeFallback($current_viewtype) && $current_viewtype !=
'default') {
100 $viewtypes[] =
'default';
107 if ($file && pathinfo($file, PATHINFO_EXTENSION) !==
'php') {
108 $this->simplecache_views[
$view] =
true;
124 return $this->simplecache_views;
133 return (bool) $this->config->simplecache_enabled;
142 $this->config->save(
'simplecache_enabled', 1);
151 if (!$this->isEnabled()) {
155 $this->config->save(
'simplecache_enabled', 0);
164 return (string) $this->config->assetroot;
184 $lastcache = (int) $this->config->lastcache;
186 if (!is_dir($this->getPath())) {
190 $di = new \DirectoryIterator($this->getPath());
193 foreach ($di as $file_info) {
194 if (!$file_info->isDir() || $file_info->isDot()) {
198 if ((
int) $file_info->getBasename() === $lastcache) {
256 mkdir($dir, 0775,
true);
275 if (!isset($cache_time)) {
276 $cache_time = $this->config->lastcache;
279 $filename = $this->getPath() .
"{$cache_time}/{$viewtype}/{$view}";
280 return Paths::sanitize(
$filename,
false);
290 $simplecache_path = rtrim($this->getPath(),
'/');
293 return is_dir($symlink_path) && realpath($simplecache_path) === realpath($symlink_path);
303 if ($this->isSymbolicLinked()) {
309 if (is_dir($symlink_path)) {
315 $simplecache_path = rtrim($this->getPath(),
'/');
316 if (!is_dir($simplecache_path)) {
318 mkdir($simplecache_path, 0755,
true);
321 symlink($simplecache_path, $symlink_path);
323 if ($this->isSymbolicLinked()) {
327 if (is_dir($symlink_path)) {
328 unlink($symlink_path);
if(!empty($avatar) &&! $avatar->isValid()) elseif(empty($avatar)) if(! $owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
enable()
Enables the simple cache.
getUrl(string $view)
Get the URL for the cached view.
getPath()
Returns the path to where views are simplecached.
getCacheableViews()
Returns the cacheable views.
purge()
Purge old/stale cache content.
cachedAssetExists(int $cache_time, string $viewtype, string $view)
Check if a asset exists in the cache.
clear()
Deletes all cached views in the simplecache.
registerCacheableView(string $view)
Register a view as cacheable.
isSymbolicLinked()
Checks if /cache directory has been symlinked to views simplecache directory.
getRoot()
Get the base url for simple cache requests.
createSymbolicLink()
Symlinks /cache directory to views simplecache directory.
disable()
Disables the simple cache.
cacheAsset(string $viewtype, string $view, string $contents)
Store an asset for caching.
getCachedAssetLocation(int $cache_time, string $viewtype, string $view)
Get the cache location of an existing cached asset.
isEnabled()
Is simple cache enabled.
getCacheFilename(string $viewtype, string $view, ?int $cache_time=null)
Get the cache file location.
__construct(protected Config $config, protected ViewsService $views)
Constructor.
isCacheableView(string $view)
Is the view cacheable.
Find Elgg and project paths.
elgg_get_root_path()
Get the project path (where composer is installed), ending with slash.
$config
Advanced site settings, debugging section.
elgg_delete_directory(string $directory, bool $leave_base_directory=false)
Delete a directory and all its contents.
if(!empty($title) &&!empty($icon_name)) if(!empty($title)) if(!empty($menu)) if(!empty($header)) if(!empty($body)) $contents
elgg_normalize_url(string $url)
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.