@@ -9,9 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace MyAdmin\Plugins\Command; |
| 11 | 11 | |
| 12 | +use Composer\Command\BaseCommand; |
|
| 12 | 13 | use Symfony\Component\Console\Input\InputInterface; |
| 13 | 14 | use Symfony\Component\Console\Output\OutputInterface; |
| 14 | -use Composer\Command\BaseCommand; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Class Command |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | 'User Creator', |
| 63 | 63 | '============', |
| 64 | 64 | '' |
| 65 | - ]); |
|
| 65 | + ]); |
|
| 66 | 66 | /* |
| 67 | 67 | $output->writeln('Username: '.$input->getArgument('username')); // retrieve the argument value using getArgument() |
| 68 | 68 | */ |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | * @param OutputInterface $output |
| 59 | 59 | */ |
| 60 | 60 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 61 | - $output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 61 | + $output->writeln([// outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 62 | 62 | 'User Creator', |
| 63 | 63 | '============', |
| 64 | 64 | '' |
@@ -9,12 +9,10 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace MyAdmin\Plugins\Command; |
| 11 | 11 | |
| 12 | +use Composer\Command\BaseCommand; |
|
| 12 | 13 | use Symfony\Component\Console\Input\InputArgument; |
| 13 | -use Symfony\Component\Console\Input\InputDefinition; |
|
| 14 | -use Symfony\Component\Console\Input\InputOption; |
|
| 15 | 14 | use Symfony\Component\Console\Input\InputInterface; |
| 16 | 15 | use Symfony\Component\Console\Output\OutputInterface; |
| 17 | -use Composer\Command\BaseCommand; |
|
| 18 | 16 | |
| 19 | 17 | /** |
| 20 | 18 | * Class CreateUser |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | 'User Creator', |
| 73 | 73 | '============', |
| 74 | 74 | '' |
| 75 | - ]); |
|
| 75 | + ]); |
|
| 76 | 76 | $output->writeln('Username: '.$input->getArgument('username')); // retrieve the argument value using getArgument() |
| 77 | 77 | $output->write('You are about to '); // outputs a message without adding a "\n" at the end of the line |
| 78 | 78 | $output->write('create a user.'); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | * @param OutputInterface $output |
| 59 | 59 | */ |
| 60 | 60 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 61 | - $output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 61 | + $output->writeln([// outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 62 | 62 | 'User Creator', |
| 63 | 63 | '============', |
| 64 | 64 | '' |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace MyAdmin\Plugins\Command; |
| 11 | 11 | |
| 12 | +use Composer\Command\BaseCommand; |
|
| 12 | 13 | use Symfony\Component\Console\Input\InputInterface; |
| 13 | 14 | use Symfony\Component\Console\Output\OutputInterface; |
| 14 | -use Composer\Command\BaseCommand; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Code Parser Comand |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | 'MyAdmin DocBlock Parser', |
| 67 | 67 | '=======================', |
| 68 | 68 | '' |
| 69 | - ]); |
|
| 69 | + ]); |
|
| 70 | 70 | $output->writeln('<info>foo</info>'); // green text |
| 71 | 71 | $output->writeln('<comment>foo</comment>'); // yellow text |
| 72 | 72 | $output->writeln('<question>foo</question>'); // black text on a cyan background |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | * @param OutputInterface $output |
| 63 | 63 | */ |
| 64 | 64 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 65 | - $output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 65 | + $output->writeln([// outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 66 | 66 | 'MyAdmin DocBlock Parser', |
| 67 | 67 | '=======================', |
| 68 | 68 | '' |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | namespace MyAdmin\Plugins\Command; |
| 11 | 11 | |
| 12 | +use Composer\Command\BaseCommand; |
|
| 12 | 13 | use Symfony\Component\Console\Input\InputInterface; |
| 13 | 14 | use Symfony\Component\Console\Output\OutputInterface; |
| 14 | -use Composer\Command\BaseCommand; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Class UpdatePlugins |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | 'User Creator', |
| 60 | 60 | '============', |
| 61 | 61 | '' |
| 62 | - ]); |
|
| 62 | + ]); |
|
| 63 | 63 | $output->write('You are about to '); // outputs a message without adding a "\n" at the end of the line |
| 64 | 64 | $output->write('create a user.'); |
| 65 | 65 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | * @param OutputInterface $output |
| 59 | 59 | */ |
| 60 | 60 | protected function execute(InputInterface $input, OutputInterface $output) { |
| 61 | - $output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 61 | + $output->writeln([// outputs multiple lines to the console (adding "\n" at the end of each line) |
|
| 62 | 62 | 'User Creator', |
| 63 | 63 | '============', |
| 64 | 64 | '' |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | |
| 12 | 12 | use Composer\Plugin\Capability\CommandProvider as CommandProviderCapability; |
| 13 | 13 | use MyAdmin\Plugins\Command\Command; |
| 14 | -use MyAdmin\Plugins\Command\Parse; |
|
| 15 | 14 | use MyAdmin\Plugins\Command\CreateUser; |
| 15 | +use MyAdmin\Plugins\Command\Parse; |
|
| 16 | 16 | use MyAdmin\Plugins\Command\UpdatePlugins; |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | namespace MyAdmin\Plugins; |
| 26 | 26 | |
| 27 | 27 | use Composer\Composer; |
| 28 | +use Composer\IO\IOInterface; |
|
| 28 | 29 | use Composer\Installer\BinaryInstaller; |
| 29 | 30 | use Composer\Installer\LibraryInstaller; |
| 30 | -use Composer\IO\IOInterface; |
|
| 31 | 31 | use Composer\Package\PackageInterface; |
| 32 | +use Composer\Repository\InstalledRepositoryInterface; |
|
| 32 | 33 | use Composer\Util\Filesystem; |
| 33 | 34 | use Composer\Util\Silencer; |
| 34 | -use Composer\Repository\InstalledRepositoryInterface; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Class Installer |
@@ -143,13 +143,13 @@ |
||
| 143 | 143 | public function getInstallPath(PackageInterface $package) { |
| 144 | 144 | if ($this->type == 'myadmin-template') { |
| 145 | 145 | $this->initializeTemplateDir(); |
| 146 | - $basePath = ($this->templateDir ? $this->templateDir.'/' : '') . $package->getPrettyName(); |
|
| 146 | + $basePath = ($this->templateDir ? $this->templateDir.'/' : '').$package->getPrettyName(); |
|
| 147 | 147 | } else { |
| 148 | 148 | $this->initializeVendorDir(); |
| 149 | - $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName(); |
|
| 149 | + $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '').$package->getPrettyName(); |
|
| 150 | 150 | } |
| 151 | 151 | $targetDir = $package->getTargetDir(); |
| 152 | - return $basePath . ($targetDir ? '/'.$targetDir : ''); |
|
| 152 | + return $basePath.($targetDir ? '/'.$targetDir : ''); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -99,8 +99,8 @@ |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * @param PreFileDownloadEvent $event |
|
| 103 | - */ |
|
| 102 | + * @param PreFileDownloadEvent $event |
|
| 103 | + */ |
|
| 104 | 104 | public function onPreFileDownload(PreFileDownloadEvent $event) { |
| 105 | 105 | /*$protocol = parse_url($event->getProcessedUrl(), PHP_URL_SCHEME); |
| 106 | 106 | if ($protocol === 's3') { |
@@ -165,6 +165,9 @@ |
||
| 165 | 165 | self::runCommand('chmod +a "$USER allow delete,write,append,file_inherit,directory_inherit" %path%', $path); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | + /** |
|
| 169 | + * @param string $command |
|
| 170 | + */ |
|
| 168 | 171 | public static function runCommand($command, $path) { |
| 169 | 172 | return self::runProcess(str_replace(['%httpduser%', '%path%'], [self::getHttpdUser(), $path], $command)); |
| 170 | 173 | } |
@@ -17,9 +17,9 @@ |
||
| 17 | 17 | use Composer\Composer; |
| 18 | 18 | use Composer\EventDispatcher\EventSubscriberInterface; |
| 19 | 19 | use Composer\IO\IOInterface; |
| 20 | -use Composer\Plugin\PluginInterface; |
|
| 21 | 20 | use Composer\Plugin\Capable; |
| 22 | 21 | use Composer\Plugin\PluginEvents; |
| 22 | +use Composer\Plugin\PluginInterface; |
|
| 23 | 23 | use Composer\Plugin\PreFileDownloadEvent; |
| 24 | 24 | use Composer\Script\Event; |
| 25 | 25 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | public static function SetfaclPermissionsSetter($path) { |
| 155 | 155 | if (!is_dir($path)) |
| 156 | - mkdir($path, 0777, true); |
|
| 156 | + mkdir($path, 0777, TRUE); |
|
| 157 | 157 | if (!is_dir($path)) |
| 158 | 158 | throw new \Exception('Path Not Found: '.$path); |
| 159 | 159 | self::runCommand('setfacl -m u:"%httpduser%":rwX -m u:$USER:rwX %path%', $path); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | public static function ChmodPermissionsSetter($path) { |
| 164 | 164 | if (!is_dir($path)) |
| 165 | - mkdir($path, 0777, true); |
|
| 165 | + mkdir($path, 0777, TRUE); |
|
| 166 | 166 | if (!is_dir($path)) |
| 167 | 167 | throw new \Exception('Path Not Found: '.$path); |
| 168 | 168 | self::runCommand('chmod +a "%httpduser% allow delete,write,append,file_inherit,directory_inherit" %path%', $path); |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | * @param array|bool $settings |
| 15 | 15 | * @return void |
| 16 | 16 | */ |
| 17 | -function register_module($module, $settings = false) { |
|
| 18 | - if ($settings === false) |
|
| 17 | +function register_module($module, $settings = FALSE) { |
|
| 18 | + if ($settings === FALSE) |
|
| 19 | 19 | $settings = []; |
| 20 | 20 | if (!isset($GLOBALS['modules'])) |
| 21 | 21 | $GLOBALS['modules'] = []; |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | * @param bool|string $setting optional parameter, false to return all settings, or a specific setting name to return that setting |
| 71 | 71 | * @return array|false array of settings or false if no setting |
| 72 | 72 | */ |
| 73 | -function get_module_settings($module = 'default', $setting = false) { |
|
| 73 | +function get_module_settings($module = 'default', $setting = FALSE) { |
|
| 74 | 74 | if (!isset($GLOBALS['modules'][$module])) { |
| 75 | 75 | $keys = array_keys($GLOBALS['modules']); |
| 76 | 76 | $module = $keys[0]; |
| 77 | 77 | } |
| 78 | - if ($setting !== false) { |
|
| 78 | + if ($setting !== FALSE) { |
|
| 79 | 79 | if (isset($GLOBALS['modules'][$module][$setting])) |
| 80 | 80 | return $GLOBALS['modules'][$module][$setting]; |
| 81 | 81 | else |
| 82 | - return false; |
|
| 82 | + return FALSE; |
|
| 83 | 83 | } else |
| 84 | 84 | return $GLOBALS['modules'][$module]; |
| 85 | 85 | } |
@@ -22,22 +22,22 @@ |
||
| 22 | 22 | * {@inheritDoc} |
| 23 | 23 | * @throws \InvalidArgumentException |
| 24 | 24 | */ |
| 25 | - public function getInstallPath(PackageInterface $package) { |
|
| 26 | - $prefix = mb_substr($package->getPrettyName(), 0, 23); |
|
| 27 | - if ('myadmin/template-' !== $prefix) { |
|
| 28 | - throw new \InvalidArgumentException( |
|
| 29 | - 'Unable to install template, myadmin templates ' |
|
| 30 | - .'should always start their package name with ' |
|
| 31 | - .'"myadmin/template-"' |
|
| 32 | - ); |
|
| 33 | - } |
|
| 34 | - return 'data/templates/'.mb_substr($package->getPrettyName(), 23); |
|
| 35 | - } |
|
| 25 | + public function getInstallPath(PackageInterface $package) { |
|
| 26 | + $prefix = mb_substr($package->getPrettyName(), 0, 23); |
|
| 27 | + if ('myadmin/template-' !== $prefix) { |
|
| 28 | + throw new \InvalidArgumentException( |
|
| 29 | + 'Unable to install template, myadmin templates ' |
|
| 30 | + .'should always start their package name with ' |
|
| 31 | + .'"myadmin/template-"' |
|
| 32 | + ); |
|
| 33 | + } |
|
| 34 | + return 'data/templates/'.mb_substr($package->getPrettyName(), 23); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * {@inheritDoc} |
|
| 39 | - */ |
|
| 40 | - public function supports($packageType) { |
|
| 41 | - return 'myadmin-template' === $packageType; |
|
| 42 | - } |
|
| 37 | + /** |
|
| 38 | + * {@inheritDoc} |
|
| 39 | + */ |
|
| 40 | + public function supports($packageType) { |
|
| 41 | + return 'myadmin-template' === $packageType; |
|
| 42 | + } |
|
| 43 | 43 | } |