summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/classes/Cache.php15
-rwxr-xr-xpublic/admin/subscriptions.php6
2 files changed, 21 insertions, 0 deletions
diff --git a/app/classes/Cache.php b/app/classes/Cache.php
index 474c560..6a5b7e7 100644
--- a/app/classes/Cache.php
+++ b/app/classes/Cache.php
@@ -115,6 +115,21 @@ class Cache
return false;
}
+
+ public static function prune(string $group, ?string $id = null) : void
+ {
+ if (is_null($id)) {
+ $filenames = glob(self::$store . self::$prefix . "{$group}_*");
+ } else {
+ $filenames = [self::getFilename($group, $id)];
+ }
+
+ foreach ($filenames as $filename) {
+ if (is_file($filename)) {
+ unlink($filename);
+ }
+ }
+ }
/**
* Builds a filename/path from group, id and
diff --git a/public/admin/subscriptions.php b/public/admin/subscriptions.php
index 418e354..236ac46 100755
--- a/public/admin/subscriptions.php
+++ b/public/admin/subscriptions.php
@@ -22,6 +22,9 @@ if (isset($_POST['upload']) &&
$newOpml = new Opml();
$newOpml->parse(file_get_contents($_FILES['opml']['tmp_name']));
OpmlManager::save($newOpml, $opmlFile);
+
+ Cache::setStore($PlanetConfig->getCacheDir() . '/');
+ Cache::prune("html");
} elseif (isset($_POST['opml']) || isset($_POST['add'])) {
// Load old OPML
$oldOpml = OpmlManager::load($opmlFile);
@@ -79,6 +82,9 @@ if (isset($_POST['upload']) &&
// Save new OPML
OpmlManager::save($newOpml, $opmlFile);
+
+ Cache::setStore($PlanetConfig->getCacheDir() . '/');
+ Cache::prune("html");
}
header("Location: index.php");
die();