@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | use Symfony\Component\Console\Input\InputInterface; |
| 7 | 7 | |
| 8 | 8 | class SelimApplication extends Application { |
| 9 | - public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN'){ |
|
| 10 | - parent::__construct($name,$version); |
|
| 9 | + public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') { |
|
| 10 | + parent::__construct($name, $version); |
|
| 11 | 11 | $this->selim_config = SelimConfig::getInstance(); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | * @param InputInterface $input |
| 16 | 16 | * @return SelimConfig |
| 17 | 17 | */ |
| 18 | - public function getSelimConfig(InputInterface $input){ |
|
| 18 | + public function getSelimConfig(InputInterface $input) { |
|
| 19 | 19 | $config_path = $input->getOption('config'); |
| 20 | - if($config_path) { |
|
| 20 | + if ($config_path) { |
|
| 21 | 21 | $this->selim_config->setPath($config_path); |
| 22 | 22 | } |
| 23 | 23 | return $this->selim_config; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | use Symfony\Component\Console\Input\InputInterface; |
| 10 | 10 | use Symfony\Component\Console\Output\OutputInterface; |
| 11 | 11 | |
| 12 | -class SecurityCommand extends SelimCommand{ |
|
| 12 | +class SecurityCommand extends SelimCommand { |
|
| 13 | 13 | protected function configure() |
| 14 | 14 | { |
| 15 | 15 | parent::configure(); |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | $sc = SecurityChecker::getInstance(); |
| 35 | 35 | $issues = $sc->findIssues(new SilverstripePage($site), true); |
| 36 | 36 | |
| 37 | - if(count($issues)) { |
|
| 37 | + if (count($issues)) { |
|
| 38 | 38 | foreach ($issues as $iss) { |
| 39 | 39 | echo $iss; |
| 40 | 40 | } |
| 41 | - }else{ |
|
| 41 | + } else { |
|
| 42 | 42 | echo "No security issues found."; |
| 43 | 43 | } |
| 44 | 44 | } else { |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | use Symfony\Component\Console\Input\InputInterface; |
| 8 | 8 | use Symfony\Component\Console\Output\OutputInterface; |
| 9 | 9 | |
| 10 | -class RemoveSiteCommand extends SelimCommand{ |
|
| 10 | +class RemoveSiteCommand extends SelimCommand { |
|
| 11 | 11 | protected function configure() |
| 12 | 12 | { |
| 13 | 13 | parent::configure(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | use Symfony\Component\Console\Input\InputOption; |
| 12 | 12 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | 13 | |
| 14 | -class DefaultCommand extends SelimCommand{ |
|
| 14 | +class DefaultCommand extends SelimCommand { |
|
| 15 | 15 | protected function configure() |
| 16 | 16 | { |
| 17 | 17 | parent::configure(); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | use Symfony\Component\Console\Output\OutputInterface; |
| 11 | 11 | use Symfony\Component\Console\Question\Question; |
| 12 | 12 | |
| 13 | -class FindSitesCommand extends SelimCommand{ |
|
| 13 | +class FindSitesCommand extends SelimCommand { |
|
| 14 | 14 | protected function configure() |
| 15 | 15 | { |
| 16 | 16 | parent::configure(); |
@@ -35,40 +35,40 @@ discard block |
||
| 35 | 35 | $skippaths = $input->getOption("skip-known-paths") ? true : false; |
| 36 | 36 | $path = realpath($input->getArgument("path")); |
| 37 | 37 | $projects = array(); |
| 38 | - $question_helper = $this->getHelper("question"); |
|
| 38 | + $question_helper = $this->getHelper("question"); |
|
| 39 | 39 | |
| 40 | 40 | $output->write("Start searching _config.php files..."); |
| 41 | 41 | $fact = new File_Iterator_Factory(); |
| 42 | - $iterator = $fact->getFileIterator($path,"php","_config"); |
|
| 42 | + $iterator = $fact->getFileIterator($path, "php", "_config"); |
|
| 43 | 43 | $output->writeln("OK"); |
| 44 | 44 | |
| 45 | 45 | $output->write("Filter for project paths..."); |
| 46 | - while($file = $iterator->current()){ |
|
| 46 | + while ($file = $iterator->current()) { |
|
| 47 | 47 | $content = Util::stripPhpComments(file_get_contents($file)); |
| 48 | - if(preg_match("/\\\$project\\s=/",$content)){ |
|
| 49 | - array_push($projects,dirname($file)); |
|
| 48 | + if (preg_match("/\\\$project\\s=/", $content)) { |
|
| 49 | + array_push($projects, dirname($file)); |
|
| 50 | 50 | } |
| 51 | 51 | $iterator->next(); |
| 52 | 52 | } |
| 53 | 53 | $output->writeln("OK"); |
| 54 | 54 | |
| 55 | - if(count($projects)){ |
|
| 55 | + if (count($projects)) { |
|
| 56 | 56 | $sites_added = false; |
| 57 | 57 | $output->writeln("found ".count($projects)." possible sites"); |
| 58 | - foreach($projects as $p){ |
|
| 59 | - if($skippaths && $cfg->sitePathExists($p)) continue; |
|
| 58 | + foreach ($projects as $p) { |
|
| 59 | + if ($skippaths && $cfg->sitePathExists($p)) continue; |
|
| 60 | 60 | |
| 61 | 61 | $question = new Question("Please enter name for '$p' (leave empty to skip)"); |
| 62 | 62 | do { |
| 63 | 63 | $name = $question_helper->ask($input, $output, $question); |
| 64 | - }while($cfg->siteExists($name)); |
|
| 64 | + }while ($cfg->siteExists($name)); |
|
| 65 | 65 | |
| 66 | - if($name){ |
|
| 66 | + if ($name) { |
|
| 67 | 67 | $sites_added = true; |
| 68 | - $cfg->addSite($name,$p); |
|
| 68 | + $cfg->addSite($name, $p); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | - if($sites_added) { |
|
| 71 | + if ($sites_added) { |
|
| 72 | 72 | $output->write("Writing config.json ..."); |
| 73 | 73 | $cfg->write(); |
| 74 | 74 | $output->writeln("OK"); |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | use Symfony\Component\Console\Input\InputInterface; |
| 7 | 7 | use Symfony\Component\Console\Output\OutputInterface; |
| 8 | 8 | |
| 9 | -class AddSiteCommand extends SelimCommand{
|
|
| 9 | +class AddSiteCommand extends SelimCommand {
|
|
| 10 | 10 | protected function configure() |
| 11 | 11 | {
|
| 12 | 12 | parent::configure(); |
@@ -7,20 +7,20 @@ |
||
| 7 | 7 | use Symfony\Component\Console\Command\Command; |
| 8 | 8 | use Symfony\Component\Console\Input\InputInterface; |
| 9 | 9 | |
| 10 | -abstract class SelimCommand extends Command{ |
|
| 10 | +abstract class SelimCommand extends Command { |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @param InputInterface $input |
| 14 | 14 | * @return SelimConfig |
| 15 | 15 | */ |
| 16 | - protected function getSelimConfig(InputInterface $input){ |
|
| 16 | + protected function getSelimConfig(InputInterface $input) { |
|
| 17 | 17 | return $this->getApplication()->getSelimConfig($input); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @return SelimApplication |
| 22 | 22 | */ |
| 23 | - public function getApplication(){ |
|
| 23 | + public function getApplication() { |
|
| 24 | 24 | return parent::getApplication(); |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | echo $e->getMessage().PHP_EOL; |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - }else{
|
|
| 130 | + } else {
|
|
| 131 | 131 | $this->envtype = "live"; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -27,11 +27,11 @@ |
||
| 27 | 27 | array_push($issues, "IMPORTANT: It seems as if you are running Silverstripe 2. Support for this version of Silverstripe ended March 31st 2015"); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($sspage->hasDefaultAdmin()){ |
|
| 30 | + if ($sspage->hasDefaultAdmin()) { |
|
| 31 | 31 | array_push($issues, "IMPORTANT: Security::setDefaultAdmin() is used."); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if($sspage->getEnvironmentType() == "dev"){ |
|
| 34 | + if ($sspage->getEnvironmentType() == "dev") { |
|
| 35 | 35 | array_push($issues, "WARNING: Director.environment_type is set to 'dev'"); |
| 36 | 36 | } |
| 37 | 37 | |