3
3
namespace Jh \Import \Command ;
4
4
5
5
use Jh \Import \Config \Data ;
6
+ use Jh \Import \Locker \Locker ;
6
7
use Magento \Cron \Model \Config ;
7
8
use Symfony \Component \Console \Command \Command ;
8
9
use Symfony \Component \Console \Helper \Table ;
@@ -24,10 +25,16 @@ class ListImportsCommand extends Command
24
25
*/
25
26
private $ cronConfig ;
26
27
27
- public function __construct (Data $ importConfig , Config $ cronConfig )
28
+ /**
29
+ * @var Locker
30
+ */
31
+ private $ locker ;
32
+
33
+ public function __construct (Data $ importConfig , Config $ cronConfig , Locker $ locker )
28
34
{
29
35
$ this ->importConfig = $ importConfig ;
30
36
$ this ->cronConfig = $ cronConfig ;
37
+ $ this ->locker = $ locker ;
31
38
parent ::__construct ();
32
39
}
33
40
@@ -49,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
49
56
$ jobs = $ this ->cronConfig ->getJobs ();
50
57
51
58
(new Table ($ output ))
52
- ->setHeaders (['Name ' , 'Type ' , 'Match Files ' , 'Incoming Directory ' , 'Cron Expr ' ])
59
+ ->setHeaders (['Name ' , 'Type ' , 'Match Files ' , 'Incoming Directory ' , 'Cron Expr ' , ' Locked? ' ])
53
60
->setRows (array_map (function ($ import ) use ($ jobs ) {
54
61
$ config = $ this ->importConfig ->getImportConfigByName ($ import );
55
62
@@ -65,6 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
65
72
$ config ->get ('match_files ' ),
66
73
$ config ->get ('incoming_directory ' ),
67
74
$ cron ,
75
+ $ this ->locker ->locked ($ import ) ? '<error>Yes</error> ' : 'No '
68
76
];
69
77
}, $ this ->importConfig ->getAllImportNames ()))
70
78
->render ();
0 commit comments