@@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
101
101
102
102
$ output ->write ($ indexer ->getTitle () . ' index ' );
103
103
104
- $ startTime = microtime ( true );
104
+ $ startTime = new \ DateTimeImmutable ( );
105
105
$ indexerConfig = $ this ->getConfig ()->getIndexer ($ indexer ->getId ());
106
106
$ sharedIndex = $ indexerConfig ['shared_index ' ] ?? null ;
107
107
@@ -112,10 +112,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
112
112
$ this ->sharedIndexesComplete [] = $ sharedIndex ;
113
113
}
114
114
}
115
- $ resultTime = microtime (true ) - $ startTime ;
115
+ $ endTime = new \DateTimeImmutable ();
116
+ $ interval = $ startTime ->diff ($ endTime );
117
+ $ days = $ interval ->format ('%d ' );
118
+ $ hours = $ days > 0 ? $ days * 24 + $ interval ->format ('%H ' ) : $ interval ->format ('%H ' );
119
+ $ minutes = $ interval ->format ('%I ' );
120
+ $ seconds = $ interval ->format ('%S ' );
116
121
117
122
$ output ->writeln (
118
- __ ('has been rebuilt successfully in %time ' , [ ' time ' => gmdate ( ' H:i:s ' , ( int ) $ resultTime )] )
123
+ __ ('has been rebuilt successfully in %1:%2:%3 ' , $ hours , $ minutes , $ seconds )
119
124
);
120
125
} catch (\Throwable $ e ) {
121
126
$ output ->writeln ('process error during indexation process: ' );
@@ -238,7 +243,9 @@ private function validateIndexerStatus(IndexerInterface $indexer)
238
243
* Get config
239
244
*
240
245
* @return ConfigInterface
241
- * @deprecated 100.1.0
246
+ * @deprecated 100.1.0 We don't recommend this approach anymore
247
+ * @see Add a new optional parameter to the constructor at the end of the arguments list instead
248
+ * and fetch the dependency using Magento\Framework\App\ObjectManager::getInstance() in the constructor body
242
249
*/
243
250
private function getConfig ()
244
251
{
@@ -252,7 +259,9 @@ private function getConfig()
252
259
* Get dependency info provider
253
260
*
254
261
* @return DependencyInfoProvider
255
- * @deprecated 100.2.0
262
+ * @deprecated 100.2.0 We don't recommend this approach anymore
263
+ * @see Add a new optional parameter to the constructor at the end of the arguments list instead
264
+ * and fetch the dependency using Magento\Framework\App\ObjectManager::getInstance() in the constructor body
256
265
*/
257
266
private function getDependencyInfoProvider ()
258
267
{
0 commit comments