fixed another deprecation issue

This commit is contained in:
Andy Miller
2023-05-09 13:01:39 -06:00
parent 0cd96bde67
commit 462d0121cb
2 changed files with 11 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
# v1.10.41.1
## mm/dd/2023
1. [](#improved)
* Fixed another Toolbox deprecation error for `lastBackup()`
# v1.10.41 # v1.10.41
## 05/09/2023 ## 05/09/2023

View File

@@ -1438,15 +1438,17 @@ class Admin
*/ */
public function lastBackup() public function lastBackup()
{ {
$file = JsonFile::instance($this->grav['locator']->findResource('log://backup.log')); $backup_file = $this->grav['locator']->findResource('log://backup.log');
$content = $file->content();
if (empty($content)) { if (!file_exists($backup_file)) {
return [ return [
'days' => '∞', 'days' => '∞',
'chart_fill' => 100, 'chart_fill' => 100,
'chart_empty' => 0 'chart_empty' => 0
]; ];
} }
$file = JsonFile::instance($backup_file);
$content = $file->content();
$backup = new \DateTime(); $backup = new \DateTime();
$backup->setTimestamp($content['time']); $backup->setTimestamp($content['time']);