From 3942e7a3c9f4cdba108e2640b80f01278f8f96d3 Mon Sep 17 00:00:00 2001 From: Mihail Date: Mon, 9 Nov 2015 11:09:20 +0200 Subject: [PATCH] fixed issue with deleting parsed files --- backend/models/UploadFileCrossingForm.php | 5 ++--- backend/models/UploadFileParsingForm.php | 3 +-- backend/models/UploadFileRgForm.php | 8 ++------ vendor/yiisoft/yii2/UPGRADE.md | 4 ++-- vendor/yiisoft/yii2/web/Response.php | 8 ++++---- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/backend/models/UploadFileCrossingForm.php b/backend/models/UploadFileCrossingForm.php index b2077e5..91bc7af 100644 --- a/backend/models/UploadFileCrossingForm.php +++ b/backend/models/UploadFileCrossingForm.php @@ -48,9 +48,8 @@ class UploadFileCrossingForm extends Model if( !is_array( $data ) ){ throw new ErrorException("Ошибка чтения из файла кроссов {$this->file_path}"); } - // файл больше не нужен - данные прочитаны и сохранены в кеш -// if( file_exists($this->file_path) ) -// unlink($this->file_path); + if( file_exists($this->file_path) ) + unlink($this->file_path); return $data; } diff --git a/backend/models/UploadFileParsingForm.php b/backend/models/UploadFileParsingForm.php index e433ef0..3ebdcaa 100644 --- a/backend/models/UploadFileParsingForm.php +++ b/backend/models/UploadFileParsingForm.php @@ -77,8 +77,7 @@ class UploadFileParsingForm extends Model } // файл больше не нужен - данные прочитаны и сохранены в кеш if( file_exists($this->file_path) ) - //@ todo - перестало работать - нет доступа на удалениев этом сеансе, в следующем - файл удаляется - разобраться - // unlink( $this->file_path ); + unlink( $this->file_path ); return $data; diff --git a/backend/models/UploadFileRgForm.php b/backend/models/UploadFileRgForm.php index 3d75918..6cabfee 100644 --- a/backend/models/UploadFileRgForm.php +++ b/backend/models/UploadFileRgForm.php @@ -46,16 +46,12 @@ class UploadFileRgForm extends Model throw new ErrorException("Ошибка чтения из файла RG групп {$this->file_path}"); } + if( file_exists($this->file_path) ) + unlink($this->file_path); return $data; } - function __destruct() - { - // файл больше не нужен - данные прочитаны и сохранены в кеш - // if( file_exists($this->file_path) ) - // unlink($this->file_path); - } } \ No newline at end of file diff --git a/vendor/yiisoft/yii2/UPGRADE.md b/vendor/yiisoft/yii2/UPGRADE.md index 34d56cc..5b91462 100644 --- a/vendor/yiisoft/yii2/UPGRADE.md +++ b/vendor/yiisoft/yii2/UPGRADE.md @@ -303,10 +303,10 @@ new ones save the following code as `convert.php` that should be placed in the s `apps/advanced/common/tests/templates/fixtures/user.php`. * The signature of all file downloading methods in `yii\web\Response` is changed, as summarized below: - - `sendFile($filePath, $attachmentName = null, $options = [])` + - `sendFile($file_path, $attachmentName = null, $options = [])` - `sendContentAsFile($content, $attachmentName, $options = [])` - `sendStreamAsFile($handle, $attachmentName, $options = [])` - - `xSendFile($filePath, $attachmentName = null, $options = [])` + - `xSendFile($file_path, $attachmentName = null, $options = [])` * The signature of callbacks used in `yii\base\ArrayableTrait::fields()` is changed from `function ($field, $model) {` to `function ($model, $field) {`. diff --git a/vendor/yiisoft/yii2/web/Response.php b/vendor/yiisoft/yii2/web/Response.php index 5a3ec91..ab895e9 100644 --- a/vendor/yiisoft/yii2/web/Response.php +++ b/vendor/yiisoft/yii2/web/Response.php @@ -420,10 +420,10 @@ class Response extends \yii\base\Response * until [[send()]] is called explicitly or implicitly. The latter is done after you return from a controller action. * * @param string $filePath the path of the file to be sent. - * @param string $attachmentName the file name shown to the user. If null, it will be determined from `$filePath`. + * @param string $attachmentName the file name shown to the user. If null, it will be determined from `$file_path`. * @param array $options additional options for sending the file. The following options are supported: * - * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$filePath` + * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$file_path` * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, * meaning a download dialog will pop up. * @@ -654,10 +654,10 @@ class Response extends \yii\base\Response * ~~~ * * @param string $filePath file name with full path - * @param string $attachmentName file name shown to the user. If null, it will be determined from `$filePath`. + * @param string $attachmentName file name shown to the user. If null, it will be determined from `$file_path`. * @param array $options additional options for sending the file. The following options are supported: * - * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$filePath` + * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$file_path` * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, * meaning a download dialog will pop up. * - xHeader: string, the name of the x-sendfile header. Defaults to "X-Sendfile". -- libgit2 0.21.4