mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-22 11:44:39 +02:00
refactor: use static values for cache scope
This fixes a future problem when code is placed under a namespace because `get_class($bridge)` will then return e.g. `RssBridge\Bridge\TwitterBridge` instead of the the current value `TwitterBridge`. Also a bit refactoring of `Configuration.php`.
This commit is contained in:
parent
a0a0d5235b
commit
ecb486794b
11 changed files with 42 additions and 41 deletions
|
@ -24,16 +24,17 @@ class SQLiteCache implements CacheInterface
|
|||
);
|
||||
}
|
||||
|
||||
$file = Configuration::getConfig(get_called_class(), 'file');
|
||||
$section = 'SQLiteCache';
|
||||
$file = Configuration::getConfig($section, 'file');
|
||||
if (empty($file)) {
|
||||
$message = sprintf('Configuration for %s missing. Please check your %s', get_called_class(), FILE_CONFIG);
|
||||
$message = sprintf('Configuration for %s missing. Please check your %s', $section, FILE_CONFIG);
|
||||
print render('error.html.php', ['message' => $message]);
|
||||
exit;
|
||||
}
|
||||
if (dirname($file) == '.') {
|
||||
$file = PATH_CACHE . $file;
|
||||
} elseif (!is_dir(dirname($file))) {
|
||||
$message = sprintf('Invalid configuration for %s. Please check your %s', get_called_class(), FILE_CONFIG);
|
||||
$message = sprintf('Invalid configuration for %s. Please check your %s', $section, FILE_CONFIG);
|
||||
print render('error.html.php', ['message' => $message]);
|
||||
exit;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue