]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - application/feed/Cache.php
7 * Purges all cached pages
9 * @param string $pageCacheDir page cache directory
11 * @return mixed an error string if the directory is missing
13 function purgeCachedPages($pageCacheDir)
15 if (! is_dir($pageCacheDir)) {
16 $error = sprintf(t('Cannot purge %s: no directory'), $pageCacheDir);
21 array_map('unlink', glob($pageCacheDir.'/*.cache'));
25 * Invalidates caches when the database is changed or the user logs out.
27 * @param string $pageCacheDir page cache directory
29 function invalidateCaches($pageCacheDir)
31 // Purge cache attached to session.
32 if (isset($_SESSION['tags'])) {
33 unset($_SESSION['tags']);
36 // Purge page cache shared by sessions.
37 purgeCachedPages($pageCacheDir);