aboutsummaryrefslogtreecommitdiff
path: root/bin/cache-prune
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2024-08-30 02:29:51 +0200
committerGravatar GitHub <noreply@github.com> 2024-08-30 02:29:51 +0200
commit3e1a8b29d95fe7fc0120e813ab623720ae056b8b (patch)
tree5b2ffa3210374942c756489d04799764e9c92278 /bin/cache-prune
parent9f48370eb0fd5aba832b9db9eb9b1bc8915f5417 (diff)
downloadrss-bridge-3e1a8b29d95fe7fc0120e813ab623720ae056b8b.tar.gz
rss-bridge-3e1a8b29d95fe7fc0120e813ab623720ae056b8b.tar.zst
rss-bridge-3e1a8b29d95fe7fc0120e813ab623720ae056b8b.zip
fix: extract duplicate config loading (#4242)
Also fix a problem with bin/cache-prune and FileCache and its enable_purge option
Diffstat (limited to 'bin/cache-prune')
-rwxr-xr-xbin/cache-prune20
1 files changed, 10 insertions, 10 deletions
diff --git a/bin/cache-prune b/bin/cache-prune
index 37696e14..755ed8d5 100755
--- a/bin/cache-prune
+++ b/bin/cache-prune
@@ -6,19 +6,19 @@
*/
require __DIR__ . '/../lib/bootstrap.php';
-
-$config = [];
-if (file_exists(__DIR__ . '/../config.ini.php')) {
- $config = parse_ini_file(__DIR__ . '/../config.ini.php', true, INI_SCANNER_TYPED);
- if (!$config) {
- http_response_code(500);
- exit("Error parsing config.ini.php\n");
- }
-}
-Configuration::loadConfiguration($config, getenv());
+require __DIR__ . '/../lib/config.php';
$container = require __DIR__ . '/../lib/dependencies.php';
+/** @var CacheInterface $cache */
$cache = $container['cache'];
+if (
+ Configuration::getConfig('cache', 'type') === 'file'
+ && !Configuration::getConfig('FileCache', 'enable_purge')
+) {
+ // Override enable_purge for this execution
+ Configuration::setConfig('FileCache', 'enable_purge', true);
+}
+
$cache->prune();