From 69741e6c08c86e24fd4d90efc34c9d269a458201 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 19 Aug 2013 20:00:16 +1000 Subject: [PATCH] deleting boards: cache purging, delete directory after sql queries (in case we have permission errors, etc.) --- inc/mod/pages.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 887be16b..63e7266e 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -359,10 +359,12 @@ function mod_edit_board($boardName) { $query->bindValue(':uri', $board['uri']); $query->execute() or error(db_error($query)); - modLog('Deleted board: ' . sprintf($config['board_abbreviation'], $board['uri']), false); + if ($config['cache']['enabled']) { + cache::delete('board_' . $board['uri']); + cache::delete('all_boards'); + } - // Delete entire board directory - rrmdir($board['uri'] . '/'); + modLog('Deleted board: ' . sprintf($config['board_abbreviation'], $board['uri']), false); // Delete posting table $query = query(sprintf('DROP TABLE IF EXISTS ``posts_%s``', $board['uri'])) or error(db_error()); @@ -409,6 +411,9 @@ function mod_edit_board($boardName) { $_query->execute() or error(db_error($_query)); } } + + // Delete entire board directory + rrmdir($board['uri'] . '/'); } else { $query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle WHERE `uri` = :uri'); $query->bindValue(':uri', $board['uri']);