Skip to content
Snippets Groups Projects
Commit 231f749d authored by Andreas Gohr's avatar Andreas Gohr
Browse files

handle draftdeletion in draftdel action only

This was the last remaining function in inc/action.php that could be
moved to the actions.

We now have quite the elegant cascade in the action handling.
parent 272271fc
No related branches found
No related tags found
No related merge requests found
......@@ -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');
}
......
......@@ -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');
}
......
......@@ -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');
}
}
......@@ -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');
}
}
......@@ -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';
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment