Added first version of ConfigCacheSaver

This commit is contained in:
Philipp Holzer 2019-03-23 15:37:05 +01:00
commit 383a6715c3
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
14 changed files with 409 additions and 68 deletions

View file

@ -0,0 +1,39 @@
<?php
namespace Friendica\Util\Config;
abstract class ConfigCacheManager
{
/**
* The Sub directory of the config-files
* @var string
*/
const SUBDIRECTORY = 'config';
protected $baseDir;
protected $configDir;
public function __construct($baseDir)
{
$this->baseDir = $baseDir;
$this->configDir = $baseDir . DIRECTORY_SEPARATOR . self::SUBDIRECTORY;
}
protected function getConfigFullName($name)
{
$fullName = $this->configDir . DIRECTORY_SEPARATOR . $name . '.config.php';
return file_exists($fullName) ? $fullName : '';
}
protected function getIniFullName($name)
{
$fullName = $this->configDir . DIRECTORY_SEPARATOR . $name . '.ini.php';
return file_exists($fullName) ? $fullName : '';
}
protected function getHtConfigFullName($name)
{
$fullName = $this->baseDir . DIRECTORY_SEPARATOR . '.' . $name . '.php';
return file_exists($fullName) ? $fullName : '';
}
}