From 9f3951437623e23e1ac68607a0aa13cd4fcb9121 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 10 Nov 2022 10:40:53 -0500 Subject: [PATCH] Attempt fix for processwire/processwire-issues#1610 --- wire/core/PagesEditor.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wire/core/PagesEditor.php b/wire/core/PagesEditor.php index 3a048733..847365b0 100644 --- a/wire/core/PagesEditor.php +++ b/wire/core/PagesEditor.php @@ -1698,7 +1698,13 @@ class PagesEditor extends Wire { $error = "Error clearing files for page $page"; try { if(PagefilesManager::hasPath($page)) { - if(!$page->filesManager->emptyAllPaths()) { + $filesManager = $page->filesManager(); + if(!$filesManager) { + // $filesManager will be null if page has deleted status + // so create our own instance + $filesManager = new PagefilesManager($page); + } + if(!$filesManager->emptyAllPaths()) { $errors[] = $error; $halt = $options['haltOnError']; }