You are here

public function ActionUploadCancel::run in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Runs action.

Overrides AAction::run

File

src/Flmngr/FileUploaderServer/lib/action/ActionUploadCancel.php, line 26

Class

ActionUploadCancel
Action for processing upload cancel request.

Namespace

Drupal\n1ed\Flmngr\FileUploaderServer\lib\action

Code

public function run($req) {
  $this
    ->validateUploadId($req);
  if (!$this->config
    ->doKeepUploads()) {
    try {
      UtilsPHP::delete($this->config
        ->getTmpDir() . DIRECTORY_SEPARATOR . $req->uploadId);
    } catch (Exception $e) {
      error_log($e);
      throw new MessageException(Message::createMessage(Message::UNABLE_TO_DELETE_UPLOAD_DIR));
    }
  }
  return new RespOk();
}