Updated page delete to handle inactive custom homepage correctly

Fixes #1447
This commit is contained in:
Dan Brown
2019-05-27 12:40:19 +01:00
parent 2b7362fa94
commit 3ad1b42a74
2 changed files with 27 additions and 3 deletions

View File

@ -852,10 +852,13 @@ class EntityRepo
*/
public function destroyPage(Page $page)
{
// Check if set as custom homepage
// Check if set as custom homepage & remove setting if not used or throw error if active
$customHome = setting('app-homepage', '0:');
if (intval($page->id) === intval(explode(':', $customHome)[0])) {
throw new NotifyException(trans('errors.page_custom_home_deletion'), $page->getUrl());
if (setting('app-homepage-type') === 'page') {
throw new NotifyException(trans('errors.page_custom_home_deletion'), $page->getUrl());
}
setting()->remove('app-homepage');
}
$this->destroyEntityCommonRelations($page);