]> git.mxchange.org Git - friendica.git/blob - src/Util/Config/ConfigCacheManager.php
Added first version of ConfigCacheSaver
[friendica.git] / src / Util / Config / ConfigCacheManager.php
1 <?php
2
3 namespace Friendica\Util\Config;
4
5 abstract class ConfigCacheManager
6 {
7         /**
8          * The Sub directory of the config-files
9          * @var string
10          */
11         const SUBDIRECTORY = 'config';
12
13         protected $baseDir;
14         protected $configDir;
15
16         public function __construct($baseDir)
17         {
18                 $this->baseDir = $baseDir;
19                 $this->configDir = $baseDir . DIRECTORY_SEPARATOR . self::SUBDIRECTORY;
20         }
21
22         protected function getConfigFullName($name)
23         {
24                 $fullName = $this->configDir . DIRECTORY_SEPARATOR . $name . '.config.php';
25                 return file_exists($fullName) ? $fullName : '';
26         }
27
28         protected function getIniFullName($name)
29         {
30                 $fullName = $this->configDir . DIRECTORY_SEPARATOR . $name . '.ini.php';
31                 return file_exists($fullName) ? $fullName : '';
32         }
33
34         protected function getHtConfigFullName($name)
35         {
36                 $fullName = $this->baseDir  . DIRECTORY_SEPARATOR . '.' . $name . '.php';
37                 return file_exists($fullName) ? $fullName : '';
38         }
39 }