12
12
use Magento \Framework \Filesystem ;
13
13
use Magento \Framework \Filesystem \Directory \ReadInterface ;
14
14
use Magento \Framework \Filesystem \Driver \File ;
15
- use Magento \Framework \Stdlib \DateTime \DateTime ;
15
+ use Magento \Framework \Stdlib \DateTime \DateTimeFactory ;
16
16
use Magento \MediaGalleryApi \Api \GetAssetsByPathsInterface ;
17
17
use Magento \MediaGallerySynchronizationApi \Model \ImportFilesInterface ;
18
18
use Magento \MediaGallerySynchronizationApi \Api \SynchronizeFilesInterface ;
@@ -60,14 +60,14 @@ class SynchronizeFiles implements SynchronizeFilesInterface
60
60
private $ importFiles ;
61
61
62
62
/**
63
- * @var DateTime
63
+ * @var DateTimeFactory
64
64
*/
65
- private $ date ;
65
+ private $ dateFactory ;
66
66
67
67
/**
68
68
* @param File $driver
69
69
* @param Filesystem $filesystem
70
- * @param DateTime $date
70
+ * @param DateTime $dateFactory
71
71
* @param LoggerInterface $log
72
72
* @param GetFileInfo $getFileInfo
73
73
* @param GetAssetsByPathsInterface $getAssetsByPaths
@@ -76,15 +76,15 @@ class SynchronizeFiles implements SynchronizeFilesInterface
76
76
public function __construct (
77
77
File $ driver ,
78
78
Filesystem $ filesystem ,
79
- DateTime $ date ,
79
+ DateTimeFactory $ dateFactory ,
80
80
LoggerInterface $ log ,
81
81
GetFileInfo $ getFileInfo ,
82
82
GetAssetsByPathsInterface $ getAssetsByPaths ,
83
83
ImportFilesInterface $ importFiles
84
84
) {
85
85
$ this ->driver = $ driver ;
86
86
$ this ->filesystem = $ filesystem ;
87
- $ this ->date = $ date ;
87
+ $ this ->dateFactory = $ dateFactory ;
88
88
$ this ->log = $ log ;
89
89
$ this ->getFileInfo = $ getFileInfo ;
90
90
$ this ->getAssetsByPaths = $ getAssetsByPaths ;
@@ -148,7 +148,7 @@ private function getPathsToUpdate(array $paths): array
148
148
*/
149
149
private function getFileModificationTime (string $ path ): string
150
150
{
151
- return $ this ->date ->gmtDate (
151
+ return $ this ->dateFactory -> create () ->gmtDate (
152
152
self ::DATE_FORMAT ,
153
153
$ this ->getFileInfo ->execute ($ this ->getMediaDirectory ()->getAbsolutePath ($ path ))->getMTime ()
154
154
);
0 commit comments