You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

41 lines
762 B

  1. <?php
  2. namespace dokuwiki\Action;
  3. use dokuwiki\Draft;
  4. use dokuwiki\Action\Exception\ActionAbort;
  5. /**
  6. * Class Draftdel
  7. *
  8. * Delete a draft
  9. *
  10. * @package dokuwiki\Action
  11. */
  12. class Draftdel extends AbstractAction
  13. {
  14. /** @inheritdoc */
  15. public function minimumPermission()
  16. {
  17. return AUTH_EDIT;
  18. }
  19. /**
  20. * Delete an existing draft for the current page and user if any
  21. *
  22. * Redirects to show, afterwards.
  23. *
  24. * @throws ActionAbort
  25. */
  26. public function preProcess()
  27. {
  28. global $INFO, $ID;
  29. $draft = new Draft($ID, $INFO['client']);
  30. if ($draft->isDraftAvailable() && checkSecurityToken()) {
  31. $draft->deleteDraft();
  32. }
  33. throw new ActionAbort('redirect');
  34. }
  35. }