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';
105 $file = $this->views->findViewFile($view, $viewtype);
107 if ($file && pathinfo($file, PATHINFO_EXTENSION) !==
'php') {
108 $this->simplecache_views[
$view] =
true;
135 return (
bool) $this->config->simplecache_enabled;
145 $this->config->save(
'simplecache_enabled', 1);
159 $this->config->save(
'simplecache_enabled', 0);
168 return (
string) $this->config->assetroot;
188 $lastcache = (int) $this->config->lastcache;
194 $di = new \DirectoryIterator($this->
getPath());
197 foreach ($di as $file_info) {
198 if (!$file_info->isDir() || $file_info->isDot()) {
202 if ((
int) $file_info->getBasename() === $lastcache) {
260 mkdir($dir, 0775,
true);
279 if (!isset($cache_time)) {
280 $cache_time = $this->config->lastcache;
isCacheableView(string $view)
Is the view cacheable.
getCacheFilename(string $viewtype, string $view, int $cache_time=null)
Get the cache file location.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH)!== '/') if(file_exists(elgg_get_root_path(). 'robots.txt'))
Set robots.txt.
getUrl(string $view)
Get the URL for the cached view.
cachedAssetExists(int $cache_time, string $viewtype, string $view)
Check if a asset exists in the cache.
clear()
Deletes all cached views in the simplecache.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
purge()
Purge old/stale cache content.
__construct(protected Config $config, protected ViewsService $views)
Constructor.
isEnabled()
Is simple cache enabled.
disable()
Disables the simple cache.
getRoot()
Get the base url for simple cache requests.
$config
Advanced site settings, debugging section.
enable()
Enables the simple cache.
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
getCachedAssetLocation(int $cache_time, string $viewtype, string $view)
Get the cache location of an existing cached asset.
registerCacheableView(string $view)
Register a view as cacheable.
cacheAsset(string $viewtype, string $view, string $contents)
Store an asset for caching.
elgg_delete_directory(string $directory, bool $leave_base_directory=false)
Delete a directory and all its contents.
getPath()
Returns the path to where views are simplecached.
static sanitize($path, $append_slash=true)
Sanitize file paths ensuring that they begin and end with slashes etc.
elgg_normalize_url(string $url)
if(!empty($title)&&!empty($icon_name)) if(!empty($title)) if(!empty($menu)) if(!empty($header)) if(!empty($body)) $contents
getCacheableViews()
Returns the cacheable views.