Skip to content

Commit

Permalink
Update for when staticpage is deleted
Browse files Browse the repository at this point in the history
Removed  staticpage id from prev, next, parent column of other pages if page is deleted
  • Loading branch information
eSilverStrike committed Nov 6, 2017
1 parent 669de67 commit 6bdf729
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/staticpages/services.inc.php
Expand Up @@ -675,6 +675,12 @@ function service_delete_staticpages($args, &$output, &$svc_msg)
}
}

// Remove deleted page from previous, next, or parent of other pages
DB_query("UPDATE {$_TABLES['staticpage']} SET sp_prev = '' WHERE sp_prev = '$sp_id'");
DB_query("UPDATE {$_TABLES['staticpage']} SET sp_next = '' WHERE sp_next = '$sp_id'");
DB_query("UPDATE {$_TABLES['staticpage']} SET sp_parent = '' WHERE sp_parent = '$sp_id'");

// Delete page
DB_delete($_TABLES['staticpage'], 'sp_id', $sp_id);
DB_delete($_TABLES['comments'], array('sid', 'type'),
array($sp_id, 'staticpages'));
Expand Down

0 comments on commit 6bdf729

Please sign in to comment.