/** * Delete media and its files based on media primary key. * * @param $id * * @return array * @throws ForbiddenHttpException * @throws NotFoundHttpException */ public function actionAjaxDelete($id) { if (!Yii::$app->user->can('editor') && $this->findModel($id)->media_author !== Yii::$app->user->id) { throw new ForbiddenHttpException(Yii::t('writesdown', 'You are not allowed to perform this action.')); } $uploadHandler = new MediaUploadHandler(null, false); $uploadHandler->delete($id); }
/** * Delete media and its files based on media primary key. * * @param $id * * @return array */ public function actionAjaxDelete($id) { $uploadHandler = new MediaUploadHandler(null, false); $uploadHandler->delete($id); }
/** * Delete Media model and its files based on media primary key. * * @param $id * @return array * @throws ForbiddenHttpException * @throws NotFoundHttpException */ public function actionAjaxDelete($id) { $this->getPermission($this->findModel($id)); $uploadHandler = new MediaUploadHandler(null, MediaUploadHandler::NOT_PRINT_RESPONSE); $uploadHandler->delete($id); }