From 462d0121cb6fda30a2996fee55abcf3d48bfab3d Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 9 May 2023 13:01:39 -0600 Subject: [PATCH] fixed another deprecation issue --- CHANGELOG.md | 6 ++++++ classes/plugin/Admin.php | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 856e6dc4..bb4d6a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.10.41.1 +## mm/dd/2023 + +1. [](#improved) + * Fixed another Toolbox deprecation error for `lastBackup()` + # v1.10.41 ## 05/09/2023 diff --git a/classes/plugin/Admin.php b/classes/plugin/Admin.php index 3d489dde..25a3fec8 100644 --- a/classes/plugin/Admin.php +++ b/classes/plugin/Admin.php @@ -1438,15 +1438,17 @@ class Admin */ public function lastBackup() { - $file = JsonFile::instance($this->grav['locator']->findResource('log://backup.log')); - $content = $file->content(); - if (empty($content)) { + $backup_file = $this->grav['locator']->findResource('log://backup.log'); + + if (!file_exists($backup_file)) { return [ 'days' => '∞', 'chart_fill' => 100, 'chart_empty' => 0 ]; } + $file = JsonFile::instance($backup_file); + $content = $file->content(); $backup = new \DateTime(); $backup->setTimestamp($content['time']);