Commit 3942e7a3c9f4cdba108e2640b80f01278f8f96d3

Authored by Mihail
1 parent 3661312a

fixed issue with deleting parsed files

backend/models/UploadFileCrossingForm.php
@@ -48,9 +48,8 @@ class UploadFileCrossingForm extends Model @@ -48,9 +48,8 @@ class UploadFileCrossingForm extends Model
48 if( !is_array( $data ) ){ 48 if( !is_array( $data ) ){
49 throw new ErrorException("Ошибка чтения из файла кроссов {$this->file_path}"); 49 throw new ErrorException("Ошибка чтения из файла кроссов {$this->file_path}");
50 } 50 }
51 - // файл больше не нужен - данные прочитаны и сохранены в кеш  
52 -// if( file_exists($this->file_path) )  
53 -// unlink($this->file_path); 51 + if( file_exists($this->file_path) )
  52 + unlink($this->file_path);
54 53
55 return $data; 54 return $data;
56 } 55 }
backend/models/UploadFileParsingForm.php
@@ -77,8 +77,7 @@ class UploadFileParsingForm extends Model @@ -77,8 +77,7 @@ class UploadFileParsingForm extends Model
77 } 77 }
78 // файл больше не нужен - данные прочитаны и сохранены в кеш 78 // файл больше не нужен - данные прочитаны и сохранены в кеш
79 if( file_exists($this->file_path) ) 79 if( file_exists($this->file_path) )
80 - //@ todo - перестало работать - нет доступа на удалениев этом сеансе, в следующем - файл удаляется - разобраться  
81 - // unlink( $this->file_path ); 80 + unlink( $this->file_path );
82 81
83 82
84 return $data; 83 return $data;
backend/models/UploadFileRgForm.php
@@ -46,16 +46,12 @@ class UploadFileRgForm extends Model @@ -46,16 +46,12 @@ class UploadFileRgForm extends Model
46 throw new ErrorException("Ошибка чтения из файла RG групп {$this->file_path}"); 46 throw new ErrorException("Ошибка чтения из файла RG групп {$this->file_path}");
47 } 47 }
48 48
  49 + if( file_exists($this->file_path) )
  50 + unlink($this->file_path);
49 51
50 return $data; 52 return $data;
51 } 53 }
52 54
53 - function __destruct()  
54 - {  
55 - // файл больше не нужен - данные прочитаны и сохранены в кеш  
56 - // if( file_exists($this->file_path) )  
57 - // unlink($this->file_path);  
58 - }  
59 55
60 56
61 } 57 }
62 \ No newline at end of file 58 \ No newline at end of file
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 @@ -303,10 +303,10 @@ new ones save the following code as `convert.php` that should be placed in the s
303 `apps/advanced/common/tests/templates/fixtures/user.php`. 303 `apps/advanced/common/tests/templates/fixtures/user.php`.
304 304
305 * The signature of all file downloading methods in `yii\web\Response` is changed, as summarized below: 305 * The signature of all file downloading methods in `yii\web\Response` is changed, as summarized below:
306 - - `sendFile($filePath, $attachmentName = null, $options = [])` 306 + - `sendFile($file_path, $attachmentName = null, $options = [])`
307 - `sendContentAsFile($content, $attachmentName, $options = [])` 307 - `sendContentAsFile($content, $attachmentName, $options = [])`
308 - `sendStreamAsFile($handle, $attachmentName, $options = [])` 308 - `sendStreamAsFile($handle, $attachmentName, $options = [])`
309 - - `xSendFile($filePath, $attachmentName = null, $options = [])` 309 + - `xSendFile($file_path, $attachmentName = null, $options = [])`
310 310
311 * The signature of callbacks used in `yii\base\ArrayableTrait::fields()` is changed from `function ($field, $model) {` 311 * The signature of callbacks used in `yii\base\ArrayableTrait::fields()` is changed from `function ($field, $model) {`
312 to `function ($model, $field) {`. 312 to `function ($model, $field) {`.
vendor/yiisoft/yii2/web/Response.php
@@ -420,10 +420,10 @@ class Response extends \yii\base\Response @@ -420,10 +420,10 @@ class Response extends \yii\base\Response
420 * until [[send()]] is called explicitly or implicitly. The latter is done after you return from a controller action. 420 * until [[send()]] is called explicitly or implicitly. The latter is done after you return from a controller action.
421 * 421 *
422 * @param string $filePath the path of the file to be sent. 422 * @param string $filePath the path of the file to be sent.
423 - * @param string $attachmentName the file name shown to the user. If null, it will be determined from `$filePath`. 423 + * @param string $attachmentName the file name shown to the user. If null, it will be determined from `$file_path`.
424 * @param array $options additional options for sending the file. The following options are supported: 424 * @param array $options additional options for sending the file. The following options are supported:
425 * 425 *
426 - * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$filePath` 426 + * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$file_path`
427 * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, 427 * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false,
428 * meaning a download dialog will pop up. 428 * meaning a download dialog will pop up.
429 * 429 *
@@ -654,10 +654,10 @@ class Response extends \yii\base\Response @@ -654,10 +654,10 @@ class Response extends \yii\base\Response
654 * ~~~ 654 * ~~~
655 * 655 *
656 * @param string $filePath file name with full path 656 * @param string $filePath file name with full path
657 - * @param string $attachmentName file name shown to the user. If null, it will be determined from `$filePath`. 657 + * @param string $attachmentName file name shown to the user. If null, it will be determined from `$file_path`.
658 * @param array $options additional options for sending the file. The following options are supported: 658 * @param array $options additional options for sending the file. The following options are supported:
659 * 659 *
660 - * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$filePath` 660 + * - `mimeType`: the MIME type of the content. If not set, it will be guessed based on `$file_path`
661 * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false, 661 * - `inline`: boolean, whether the browser should open the file within the browser window. Defaults to false,
662 * meaning a download dialog will pop up. 662 * meaning a download dialog will pop up.
663 * - xHeader: string, the name of the x-sendfile header. Defaults to "X-Sendfile". 663 * - xHeader: string, the name of the x-sendfile header. Defaults to "X-Sendfile".