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;
133 return (
bool) $this->config->simplecache_enabled;
142 $this->config->save(
'simplecache_enabled', 1);
155 $this->config->save(
'simplecache_enabled', 0);
164 return (
string) $this->config->assetroot;
184 $lastcache = (int) $this->config->lastcache;
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;
293 return is_dir($symlink_path) && realpath($simplecache_path) === realpath($symlink_path);
309 if (is_dir($symlink_path)) {
316 if (!is_dir($simplecache_path)) {
318 mkdir($simplecache_path, 0755,
true);
321 symlink($simplecache_path, $symlink_path);
327 if (is_dir($symlink_path)) {
328 unlink($symlink_path);
isCacheableView(string $view)
Is the view cacheable.
static project()
Get the project root (where composer is installed) path with "/".
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_get_root_path()
Get the project path (where composer is installed), ending with slash.
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)
createSymbolicLink()
Symlinks /cache directory to views simplecache directory.
isSymbolicLinked()
Checks if /cache directory has been symlinked to views simplecache directory.
if(!empty($title)&&!empty($icon_name)) if(!empty($title)) if(!empty($menu)) if(!empty($header)) if(!empty($body)) $contents
getCacheableViews()
Returns the cacheable views.