1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Plugins Management |
4
|
|
|
* @author Joe Huss <[email protected]> |
5
|
|
|
* @copyright 2019 |
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
|
|
|
{ |
23
|
|
|
protected function configure() |
24
|
|
|
{ |
25
|
|
|
$this |
26
|
|
|
->setName('myadmin:set-permissions') // the name of the command (the part after "bin/console") |
27
|
|
|
->setDescription('Creates and Sets Writable Permissions on Required Dirs') // the short description shown while running "php bin/console list" |
28
|
|
|
->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 |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** (optional) |
32
|
|
|
* This method is executed before the interact() and the execute() methods. |
33
|
|
|
* Its main purpose is to initialize variables used in the rest of the command methods. |
34
|
|
|
* |
35
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
36
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
37
|
|
|
*/ |
38
|
|
|
protected function initialize(InputInterface $input, OutputInterface $output) |
39
|
|
|
{ |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** (optional) |
43
|
|
|
* This method is executed after initialize() and before execute(). |
44
|
|
|
* Its purpose is to check if some of the options/arguments are missing and interactively |
45
|
|
|
* ask the user for those values. This is the last place where you can ask for missing |
46
|
|
|
* options/arguments. After this command, missing options/arguments will result in an error. |
47
|
|
|
* |
48
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
49
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
50
|
|
|
*/ |
51
|
|
|
protected function interact(InputInterface $input, OutputInterface $output) |
52
|
|
|
{ |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
/** (required) |
57
|
|
|
* This method is executed after interact() and initialize(). |
58
|
|
|
* It contains the logic you want the command to execute. |
59
|
|
|
* |
60
|
|
|
* @param InputInterface $input |
61
|
|
|
* @param OutputInterface $output |
62
|
|
|
*/ |
63
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
64
|
|
|
{ |
65
|
|
|
\MyAdmin\Plugins\Plugin::setPermissions(); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.