1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Plugins Management |
4
|
|
|
* @author Joe Huss <[email protected]> |
5
|
|
|
* @copyright 2017 |
6
|
|
|
* @package MyAdmin |
7
|
|
|
* @category Plugins |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace MyAdmin\Plugins\Command; |
11
|
|
|
|
12
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
13
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
14
|
|
|
use Composer\Command\BaseCommand; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class SetPermissions |
18
|
|
|
* |
19
|
|
|
* @package MyAdmin\Plugins\Command |
20
|
|
|
*/ |
21
|
|
|
class SetPermissions extends BaseCommand { |
22
|
|
|
protected function configure() { |
23
|
|
|
$this |
24
|
|
|
->setName('myadmin:set-permissions') // the name of the command (the part after "bin/console") |
25
|
|
|
->setDescription('Creates and Sets Writable Permissions on Required Dirs') // the short description shown while running "php bin/console list" |
26
|
|
|
->setHelp('Creates and Sets Writable Permissions on Required Directories specified in the writable-dirs composer extra options section.'); // the full command description shown when running the command with the "--help" option |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** (optional) |
30
|
|
|
* This method is executed before the interact() and the execute() methods. |
31
|
|
|
* Its main purpose is to initialize variables used in the rest of the command methods. |
32
|
|
|
* |
33
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
34
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
35
|
|
|
*/ |
36
|
|
|
protected function initialize(InputInterface $input, OutputInterface $output) {} |
37
|
|
|
|
38
|
|
|
/** (optional) |
39
|
|
|
* This method is executed after initialize() and before execute(). |
40
|
|
|
* Its purpose is to check if some of the options/arguments are missing and interactively |
41
|
|
|
* ask the user for those values. This is the last place where you can ask for missing |
42
|
|
|
* options/arguments. After this command, missing options/arguments will result in an error. |
43
|
|
|
* |
44
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
45
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
46
|
|
|
*/ |
47
|
|
|
protected function interact(InputInterface $input, OutputInterface $output) {} |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** (required) |
51
|
|
|
* This method is executed after interact() and initialize(). |
52
|
|
|
* It contains the logic you want the command to execute. |
53
|
|
|
* |
54
|
|
|
* @param InputInterface $input |
55
|
|
|
* @param OutputInterface $output |
56
|
|
|
*/ |
57
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) { |
58
|
|
|
\MyAdmin\Plugins\Plugin::setPermissions(); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|