From 46b1d45ac3ca619788e0e553e6760b6be4c0e334 Mon Sep 17 00:00:00 2001 From: Attogram Project Date: Wed, 22 Apr 2020 21:21:37 +0200 Subject: [PATCH] rm FilesystemCache --- src/Base.php | 20 ++++++++------ src/FilesystemCache.php | 59 ----------------------------------------- 2 files changed, 12 insertions(+), 67 deletions(-) delete mode 100644 src/FilesystemCache.php diff --git a/src/Base.php b/src/Base.php index 9187d6b..d209b72 100644 --- a/src/Base.php +++ b/src/Base.php @@ -7,6 +7,10 @@ namespace Attogram\Justrefs; +use Illuminate\Cache\FileStore; +use Illuminate\Cache\Repository; +use Illuminate\Filesystem\Filesystem; + use function get_class; use function header; use function htmlentities; @@ -21,7 +25,10 @@ class Base { - const VERSION = '0.7.0'; + const VERSION = '0.8.0'; + + /** Cache Directory */ + const CACHE_DIRECTORY = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'cache'; /** Cache Time, in seconds. 4 days = 345600, 14 days = 1209600 */ const CACHE_TIME = 1209600; @@ -81,7 +88,7 @@ class Base public $template; /** - * @var Attogram\Justrefs\FilesystemCache + * @var Illuminate\Cache\Repository */ protected $filesystem; @@ -100,11 +107,6 @@ class Base */ protected $source = 'https://en.wikipedia.org/wiki/'; - /** - * @var string - path to cache directory - */ - protected $cacheDirectory = '..' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR; - /** * @var array - array of start times */ @@ -231,7 +233,9 @@ protected function setTopicFromUrl() protected function initFilesystem() { - $this->filesystem = (new FilesystemCache())->init(); + $this->filesystem = new Repository( + new FileStore(new Filesystem(), self::CACHE_DIRECTORY) + ); } protected function initMediawiki() diff --git a/src/FilesystemCache.php b/src/FilesystemCache.php deleted file mode 100644 index ddd2d38..0000000 --- a/src/FilesystemCache.php +++ /dev/null @@ -1,59 +0,0 @@ -