File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Webman \Console \Commands ;
4+
5+ use Symfony \Component \Console \Command \Command ;
6+ use Symfony \Component \Console \Input \InputArgument ;
7+ use Symfony \Component \Console \Input \InputInterface ;
8+ use Symfony \Component \Console \Output \OutputInterface ;
9+ use Symfony \Component \Console \Input \InputOption ;
10+ use Webman \Console \Util ;
11+
12+ class AppPluginUninstallCommand extends Command
13+ {
14+ protected static $ defaultName = 'app-plugin:uninstall ' ;
15+ protected static $ defaultDescription = 'App Plugin Uninstall ' ;
16+
17+ /**
18+ * @return void
19+ */
20+ protected function configure ()
21+ {
22+ $ this ->addArgument ('name ' , InputArgument::REQUIRED , 'App plugin name ' );
23+ }
24+
25+ /**
26+ * @param InputInterface $input
27+ * @param OutputInterface $output
28+ * @return int
29+ */
30+ protected function execute (InputInterface $ input , OutputInterface $ output ): int
31+ {
32+ $ name = $ input ->getArgument ('name ' );
33+ $ output ->writeln ("Uninstall App Plugin $ name " );
34+ $ class = "\\plugin \\$ name \\api \\Install " ;
35+ if (!method_exists ($ class , 'uninstall ' )) {
36+ throw new \RuntimeException ("Method $ class::uninstall not exists " );
37+ }
38+ call_user_func ([$ class , 'uninstall ' ], config ("plugin. $ name.app.version " ));
39+ return self ::SUCCESS ;
40+ }
41+
42+ }
You can’t perform that action at this time.
0 commit comments