From 42531e0e1843b3b97b0ebf8309361e736fb27734 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 21 Apr 2020 08:21:22 +1200 Subject: [PATCH] FIX: Use ReadOnlyCacheService --- code/GraphQL/ReadFileQueryCreator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/GraphQL/ReadFileQueryCreator.php b/code/GraphQL/ReadFileQueryCreator.php index fcc8cfeca..dfc0b6c0b 100644 --- a/code/GraphQL/ReadFileQueryCreator.php +++ b/code/GraphQL/ReadFileQueryCreator.php @@ -4,6 +4,7 @@ use SilverStripe\Assets\File; use SilverStripe\Assets\Folder; use GraphQL\Type\Definition\UnionType; +use SilverStripe\Assets\Services\ReadOnlyCacheService; use SilverStripe\GraphQL\Pagination\PaginatedQueryCreator; use SilverStripe\GraphQL\Pagination\Connection; use SilverStripe\Versioned\Versioned; @@ -23,6 +24,10 @@ public function attributes() public function createConnection() { + // class_exists check can be removed when assets 1.6 is released and required by framework 4.6 + if (class_exists(ReadOnlyCacheService::class)) { + ReadOnlyCacheService::singleton()->setEnabled(true); + } return Connection::create('readFiles') ->setConnectionType(function () { return new UnionType([