Draftdel.php 746 B

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