diff --git a/inc/Action/Cancel.php b/inc/Action/Cancel.php index c726446070f1643d078b9abe67dee8cb42c7178c..c3e185534d94f97ad7e75e9138b135a7f75cacfe 100644 --- a/inc/Action/Cancel.php +++ b/inc/Action/Cancel.php @@ -14,6 +14,7 @@ use dokuwiki\Action\Exception\ActionAbort; class Cancel extends AbstractAliasAction { public function preProcess() { + // continue with draftdel -> redirect -> show throw new ActionAbort('draftdel'); } diff --git a/inc/Action/Draftdel.php b/inc/Action/Draftdel.php index d7707b30dd1330fc0d016635bfd0505ff8708c31..77378f7cb8086ee0e5c65508585bc70326e2f698 100644 --- a/inc/Action/Draftdel.php +++ b/inc/Action/Draftdel.php @@ -18,8 +18,18 @@ class Draftdel extends AbstractAction { return AUTH_EDIT; } + /** + * Delete an existing draft if any + * + * Reads draft information from $INFO. Redirects to show, afterwards. + * + * @throws ActionAbort + */ public function preProcess() { - act_draftdel('fixme'); // FIXME replace this utility function + global $INFO; + @unlink($INFO['draft']); + $INFO['draft'] = null; + throw new ActionAbort('redirect'); } diff --git a/inc/Action/Revert.php b/inc/Action/Revert.php index 4fd9d622fdcceebcc6da5088073e2def0b32001e..ca35374f251858ae3e7148f4b8cefecafd403034 100644 --- a/inc/Action/Revert.php +++ b/inc/Action/Revert.php @@ -56,14 +56,10 @@ class Revert extends AbstractAction { saveWikiText($ID, $text, $sum, false); msg($sum, 1); - - //delete any draft - act_draftdel('fixme'); // FIXME replace this utility function - //session_write_close(); // FIXME sessions should be close somewhere higher up, maybe ActionRouter - - // when done, show current page $REV = ''; - throw new ActionAbort('redirect'); + + // continue with draftdel -> redirect -> show + throw new ActionAbort('draftdel'); } } diff --git a/inc/Action/Save.php b/inc/Action/Save.php index 419108e1a35d6e2891bbdc7dc8d41b4907f76db5..0b247298303e67d422914458b3dabd929113d7cc 100644 --- a/inc/Action/Save.php +++ b/inc/Action/Save.php @@ -53,12 +53,8 @@ class Save extends AbstractAction { //unlock it unlock($ID); - //delete draft - act_draftdel('fixme'); // FIXME replace this utility function - //session_write_close(); // FIXME close session higher up - - // when done, show page - throw new ActionAbort('redirect'); + // continue with draftdel -> redirect -> show + throw new ActionAbort('draftdel'); } } diff --git a/inc/actions.php b/inc/actions.php index cde6915957cd94821b64715448653da79c47e47f..22954ae7a227fed107b8845ce92ff96a07a36e9f 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -59,18 +59,3 @@ function act_clean($act){ if($act === '') $act = 'show'; return $act; } - -/** - * Handle 'draftdel' - * - * Deletes the draft for the current page and user - * - * @param string $act action command - * @return string action command - */ -function act_draftdel($act){ - global $INFO; - @unlink($INFO['draft']); - $INFO['draft'] = null; - return 'show'; -}