/** * Удаление файла * * @param $clusterFileSrc * @return bool * @throws Exception */ public function delete($clusterFileUniqSrc) { $file = new File($this->getRootSrc($clusterFileUniqSrc)); if ($file->isExist()) { $file->remove(); } return true; }
public function actionRemoveEnvGlobalFile() { $file = new File(APP_ENV_GLOBAL_FILE); if ($file->remove()) { \Yii::$app->session->setFlash('success', \Yii::t('app', 'File deleted successfully')); } else { \Yii::$app->session->setFlash('error', \Yii::t('app', 'Could not delete the file')); } return $this->redirect(\Yii::$app->request->getReferrer()); }