[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Action/ -> Draftdel.php (source)

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