diff options
author | 2022-08-02 15:03:54 +0200 | |
---|---|---|
committer | 2022-08-02 15:03:54 +0200 | |
commit | ecb486794b622a9ea9f563abdf8a7fa41038d4e9 (patch) | |
tree | b00c81512809400d140cf10ae37db6345ce8e7ce /caches/SQLiteCache.php | |
parent | a0a0d5235bb6f149886457d28e7b00c439992154 (diff) | |
download | rss-bridge-ecb486794b622a9ea9f563abdf8a7fa41038d4e9.tar.gz rss-bridge-ecb486794b622a9ea9f563abdf8a7fa41038d4e9.tar.zst rss-bridge-ecb486794b622a9ea9f563abdf8a7fa41038d4e9.zip |
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`.
Diffstat (limited to 'caches/SQLiteCache.php')
-rw-r--r-- | caches/SQLiteCache.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/caches/SQLiteCache.php b/caches/SQLiteCache.php index 6a2273e9..2f798714 100644 --- a/caches/SQLiteCache.php +++ b/caches/SQLiteCache.php @@ -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; } |