mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-02 19:27:52 +02:00
Pages Plugin: Fix delete() action
This commit is contained in:
@@ -505,10 +505,13 @@
|
|||||||
// Delete page and update <parent> fields
|
// Delete page and update <parent> fields
|
||||||
if ($pages->deleteWhere('[slug="'.$page['slug'].'" ]')) {
|
if ($pages->deleteWhere('[slug="'.$page['slug'].'" ]')) {
|
||||||
|
|
||||||
$_pages = $pages->select('[parent="'.$page['slug'].'"]', 'all');
|
$_pages = $pages->select('[parent="'.$page['slug'].'"]');
|
||||||
|
|
||||||
|
if(!empty($_pages)) {
|
||||||
foreach($_pages as $_page) {
|
foreach($_pages as $_page) {
|
||||||
$pages->updateWhere('[slug="'.$_page['slug'].'"]', array('parent' => ''));
|
$pages->updateWhere('[slug="'.$_page['slug'].'"]', array('parent' => ''));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File::delete(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt');
|
File::delete(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt');
|
||||||
Notification::set('success', __('Page <i>:page</i> deleted', 'pages', array(':page' => Html::toText($page['title']))));
|
Notification::set('success', __('Page <i>:page</i> deleted', 'pages', array(':page' => Html::toText($page['title']))));
|
||||||
|
Reference in New Issue
Block a user