File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
app/code/Magento/Analytics Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 8
8
9
9
use Magento \Framework \App \Filesystem \DirectoryList ;
10
10
use Magento \Framework \Archive ;
11
+ use Magento \Framework \Exception \FileSystemException ;
11
12
use Magento \Framework \Exception \LocalizedException ;
12
13
use Magento \Framework \Filesystem ;
13
14
use Magento \Framework \Filesystem \Directory \WriteInterface ;
@@ -89,8 +90,7 @@ public function __construct(
89
90
public function prepareExportData ()
90
91
{
91
92
try {
92
- $ tmpDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::SYS_TMP );
93
-
93
+ $ tmpDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::TMP );
94
94
$ this ->prepareDirectory ($ tmpDirectory , $ this ->getTmpFilesDirRelativePath ());
95
95
$ this ->reportWriter ->write ($ tmpDirectory , $ this ->getTmpFilesDirRelativePath ());
96
96
@@ -106,8 +106,10 @@ public function prepareExportData()
106
106
$ this ->cryptographer ->encode ($ tmpDirectory ->readFile ($ this ->getArchiveRelativePath ()))
107
107
);
108
108
} finally {
109
- $ tmpDirectory ->delete ($ this ->getTmpFilesDirRelativePath ());
110
- $ tmpDirectory ->delete ($ this ->getArchiveRelativePath ());
109
+ if (isset ($ tmpDirectory )) {
110
+ $ tmpDirectory ->delete ($ this ->getTmpFilesDirRelativePath ());
111
+ $ tmpDirectory ->delete ($ this ->getArchiveRelativePath ());
112
+ }
111
113
}
112
114
113
115
return true ;
Original file line number Diff line number Diff line change 15
15
use Magento \Framework \Archive ;
16
16
use Magento \Framework \Filesystem ;
17
17
use Magento \Framework \Filesystem \Directory \WriteInterface ;
18
- use Magento \Framework \Filesystem \DirectoryList ;
18
+ use Magento \Framework \App \ Filesystem \DirectoryList ;
19
19
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
20
20
use PHPUnit \Framework \MockObject \MockObject ;
21
21
use PHPUnit \Framework \TestCase ;
@@ -127,7 +127,7 @@ public function testPrepareExportData($isArchiveSourceDirectory)
127
127
$ this ->filesystemMock
128
128
->expects ($ this ->once ())
129
129
->method ('getDirectoryWrite ' )
130
- ->with (DirectoryList::SYS_TMP )
130
+ ->with (DirectoryList::TMP )
131
131
->willReturn ($ this ->directoryMock );
132
132
$ this ->directoryMock
133
133
->expects ($ this ->exactly (4 ))
@@ -228,7 +228,7 @@ public function testPrepareExportDataWithLocalizedException()
228
228
$ this ->filesystemMock
229
229
->expects ($ this ->once ())
230
230
->method ('getDirectoryWrite ' )
231
- ->with (DirectoryList::SYS_TMP )
231
+ ->with (DirectoryList::TMP )
232
232
->willReturn ($ this ->directoryMock );
233
233
$ this ->reportWriterMock
234
234
->expects ($ this ->once ())
You can’t perform that action at this time.
0 commit comments