1 <?php
2
3 /*
4 * This file is part of the Icybee package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee\Modules\Cache;
13
14 /**
15 * Catalogs cache manager.
16 */
17 class CatalogsCacheManager extends CacheManager
18 {
19 public $title = "Traductions";
20 public $description = "Traductions par langue pour l'ensemble du framework.";
21 public $group = 'system';
22
23 public function __construct()
24 {
25 global $core;
26
27 $this->state = $core->config['cache catalogs'];
28 }
29
30 /**
31 * Clears the cache.
32 */
33 public function clear()
34 {
35 global $core;
36
37 $files = glob(\ICanBoogie\REPOSITORY . 'cache/core/i18n_*');
38
39 foreach ($files as $file)
40 {
41 unlink($file);
42 }
43
44 return count($files);
45 }
46
47 /**
48 * Disables the cache.
49 *
50 * Unsets the `enable_catalogs_cache` var.
51 */
52 public function disable()
53 {
54 global $core;
55
56 unset($core->vars['enable_catalogs_cache']);
57
58 return true;
59 }
60
61 /**
62 * Enables the cache.
63 *
64 * Sets the `enable_catalogs_cache` var.
65 */
66 public function enable()
67 {
68 global $core;
69
70 $core->vars['enable_catalogs_cache'] = true;
71
72 return true;
73 }
74
75 /**
76 * Return stats about the cache.
77 */
78 public function stat()
79 {
80 return Module::get_files_stat(\ICanBoogie\REPOSITORY . 'cache/core', '#^i18n_#');
81 }
82 }