diff --git a/code/GraphQL/ReadFileQueryCreator.php b/code/GraphQL/ReadFileQueryCreator.php index fcc8cfeca..1614c7916 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 + if (class_exists('SilverStripe\Assets\Services\ReadOnlyCacheService')) { + ReadOnlyCacheService::singleton()->setEnabled(true); + } return Connection::create('readFiles') ->setConnectionType(function () { return new UnionType([