@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | protected function configure() |
| 18 | 18 | { |
| 19 | - $this->_projectPath = getcwd(); |
|
| 19 | + $this->_projectPath=getcwd(); |
|
| 20 | 20 | |
| 21 | 21 | $this->setName("behat"); |
| 22 | 22 | $this->setDescription("Run Behat against your project"); |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | protected function execute(InputInterface $input, OutputInterface $output) |
| 32 | 32 | { |
| 33 | - $option = $input->getArgument('option'); |
|
| 34 | - $command = $this->getCommand(new Config($output), $option); |
|
| 33 | + $option=$input->getArgument('option'); |
|
| 34 | + $command=$this->getCommand(new Config($output), $option); |
|
| 35 | 35 | if (!$command) { |
| 36 | 36 | return $output->writeln('<error>Command not available for this application</error>'); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $output->writeln('<info>Running Behat</info>'); |
| 40 | - $passedCommand = "vagrant ssh -c '". $command ."'"; |
|
| 40 | + $passedCommand="vagrant ssh -c '".$command."'"; |
|
| 41 | 41 | passthru($passedCommand); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function getCommand(Config $config, $option) |
| 50 | 50 | { |
| 51 | - $type = $config->type; |
|
| 51 | + $type=$config->type; |
|
| 52 | 52 | switch ($type) { |
| 53 | 53 | case 'magento': |
| 54 | 54 | return "cd /var/www;bin/behat $option"; |
@@ -48,27 +48,27 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function installMagento(array $options, $projectPath, OutputInterface $output) |
| 50 | 50 | { |
| 51 | - $locale = $options['magestead']['apps']['mba_12345']['locale']; |
|
| 52 | - $db_name = $options['magestead']['apps']['mba_12345']['db_name']; |
|
| 53 | - $base_url = $options['magestead']['apps']['mba_12345']['base_url']; |
|
| 54 | - $default_currency = $options['magestead']['apps']['mba_12345']['default_currency']; |
|
| 51 | + $locale=$options['magestead']['apps']['mba_12345']['locale']; |
|
| 52 | + $db_name=$options['magestead']['apps']['mba_12345']['db_name']; |
|
| 53 | + $base_url=$options['magestead']['apps']['mba_12345']['base_url']; |
|
| 54 | + $default_currency=$options['magestead']['apps']['mba_12345']['default_currency']; |
|
| 55 | 55 | |
| 56 | - $install = 'vagrant ssh -c \'cd /var/www/public; php -f install.php -- \ |
|
| 56 | + $install='vagrant ssh -c \'cd /var/www/public; php -f install.php -- \ |
|
| 57 | 57 | --license_agreement_accepted "yes" \ |
| 58 | ---locale "' . $locale . '" \ |
|
| 58 | +--locale "' . $locale.'" \ |
|
| 59 | 59 | --timezone "Europe/London" \ |
| 60 | ---default_currency "' . $default_currency . '" \ |
|
| 60 | +--default_currency "' . $default_currency.'" \ |
|
| 61 | 61 | --db_host "localhost" \ |
| 62 | ---db_name "' . $db_name . '" \ |
|
| 62 | +--db_name "' . $db_name.'" \ |
|
| 63 | 63 | --db_user "magestead" \ |
| 64 | 64 | --db_pass "vagrant" \ |
| 65 | 65 | --session_save "db" \ |
| 66 | ---url "http://' . $base_url . '/" \ |
|
| 66 | +--url "http://' . $base_url.'/" \ |
|
| 67 | 67 | --use_rewrites "yes" \ |
| 68 | 68 | --skip_url_validation "yes" \ |
| 69 | 69 | --use_secure "no" \ |
| 70 | 70 | --use_secure_admin "no" \ |
| 71 | ---secure_base_url "http://' . $base_url . '/" \ |
|
| 71 | +--secure_base_url "http://' . $base_url.'/" \ |
|
| 72 | 72 | --admin_firstname "RichDynamix" \ |
| 73 | 73 | --admin_lastname "Magestead" \ |
| 74 | 74 | --admin_email "[email protected]" \ |
@@ -88,27 +88,27 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | protected function setPermissions($projectPath, OutputInterface $output) |
| 90 | 90 | { |
| 91 | - $command = 'vagrant ssh -c \'cd /var/www/public; sudo find var/ -type f -exec chmod 600 {} \;\''; |
|
| 91 | + $command='vagrant ssh -c \'cd /var/www/public; sudo find var/ -type f -exec chmod 600 {} \;\''; |
|
| 92 | 92 | $output->writeln('<comment>Setting "var" Files Permissions</comment>'); |
| 93 | 93 | new ProcessCommand($command, $projectPath, $output); |
| 94 | 94 | |
| 95 | - $command = 'vagrant ssh -c \'cd /var/www/public; sudo find media/ -type f -exec chmod 600 {} \;\''; |
|
| 95 | + $command='vagrant ssh -c \'cd /var/www/public; sudo find media/ -type f -exec chmod 600 {} \;\''; |
|
| 96 | 96 | $output->writeln('<comment>Setting "media" Files Permissions</comment>'); |
| 97 | 97 | new ProcessCommand($command, $projectPath, $output); |
| 98 | 98 | |
| 99 | - $command = 'vagrant ssh -c \'cd /var/www/public; sudo find var/ -type d -exec chmod 700 {} \;\''; |
|
| 99 | + $command='vagrant ssh -c \'cd /var/www/public; sudo find var/ -type d -exec chmod 700 {} \;\''; |
|
| 100 | 100 | $output->writeln('<comment>Setting "var" Folder Permissions</comment>'); |
| 101 | 101 | new ProcessCommand($command, $projectPath, $output); |
| 102 | 102 | |
| 103 | - $command = 'vagrant ssh -c \'cd /var/www/public; sudo find media/ -type d -exec chmod 700 {} \;\''; |
|
| 103 | + $command='vagrant ssh -c \'cd /var/www/public; sudo find media/ -type d -exec chmod 700 {} \;\''; |
|
| 104 | 104 | $output->writeln('<comment>Setting "media" Folder Permissions</comment>'); |
| 105 | 105 | new ProcessCommand($command, $projectPath, $output); |
| 106 | 106 | |
| 107 | - $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 700 includes;\''; |
|
| 107 | + $command='vagrant ssh -c \'cd /var/www/public; sudo chmod 700 includes;\''; |
|
| 108 | 108 | $output->writeln('<comment>Setting "includes" Permissions</comment>'); |
| 109 | 109 | new ProcessCommand($command, $projectPath, $output); |
| 110 | 110 | |
| 111 | - $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 600 includes/config.php;\''; |
|
| 111 | + $command='vagrant ssh -c \'cd /var/www/public; sudo chmod 600 includes/config.php;\''; |
|
| 112 | 112 | $output->writeln('<comment>Setting "includes/config.php" Permissions</comment>'); |
| 113 | 113 | new ProcessCommand($command, $projectPath, $output); |
| 114 | 114 | } |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function installMagerun($projectPath, OutputInterface $output) |
| 121 | 121 | { |
| 122 | - $command = 'vagrant ssh -c \'cd /var/www/bin; sudo wget https://files.magerun.net/n98-magerun.phar;\''; |
|
| 122 | + $command='vagrant ssh -c \'cd /var/www/bin; sudo wget https://files.magerun.net/n98-magerun.phar;\''; |
|
| 123 | 123 | $output->writeln('<info>Downloading Magerun</info>'); |
| 124 | 124 | new ProcessCommand($command, $projectPath, $output); |
| 125 | 125 | |
| 126 | - $command = 'vagrant ssh -c \'cd /var/www/bin; sudo chmod +x ./n98-magerun.phar;\''; |
|
| 126 | + $command='vagrant ssh -c \'cd /var/www/bin; sudo chmod +x ./n98-magerun.phar;\''; |
|
| 127 | 127 | $output->writeln('<comment>Setting Magerun Permissions</comment>'); |
| 128 | 128 | new ProcessCommand($command, $projectPath, $output); |
| 129 | 129 | } |
@@ -135,21 +135,21 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function finaliseSetup(array $options, $projectPath, OutputInterface $output) |
| 137 | 137 | { |
| 138 | - $command = 'vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar index:reindex:all;\''; |
|
| 138 | + $command='vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar index:reindex:all;\''; |
|
| 139 | 139 | $output->writeln('<comment>Reindexing Tables</comment>'); |
| 140 | 140 | new ProcessCommand($command, $projectPath, $output); |
| 141 | 141 | |
| 142 | - $command = 'vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar cache:enable;\''; |
|
| 142 | + $command='vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar cache:enable;\''; |
|
| 143 | 143 | $output->writeln('<comment>Enabling All Cache</comment>'); |
| 144 | 144 | new ProcessCommand($command, $projectPath, $output); |
| 145 | 145 | |
| 146 | - $command = 'vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar cache:flush;\''; |
|
| 146 | + $command='vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar cache:flush;\''; |
|
| 147 | 147 | $output->writeln('<comment>Flushing All Cache</comment>'); |
| 148 | 148 | new ProcessCommand($command, $projectPath, $output); |
| 149 | 149 | |
| 150 | 150 | $this->processVcs($options, $projectPath, $output); |
| 151 | 151 | |
| 152 | - $command = 'vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar sys:check;\''; |
|
| 152 | + $command='vagrant ssh -c \'cd /var/www/public; ../bin/n98-magerun.phar sys:check;\''; |
|
| 153 | 153 | $output->writeln('<comment>System Check</comment>'); |
| 154 | 154 | new ProcessCommand($command, $projectPath, $output); |
| 155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | protected function showCredentials(array $options, OutputInterface $output) |
| 162 | 162 | { |
| 163 | 163 | $output->writeln('<info>SUCCESS: Magestead has finished installing Magento!</info>'); |
| 164 | - $table = new Table($output); |
|
| 164 | + $table=new Table($output); |
|
| 165 | 165 | $table |
| 166 | 166 | ->setHeaders(['Username', 'Password', 'Base URL']) |
| 167 | 167 | ->setRows([ |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | protected function processVcs(array $options, $projectPath, OutputInterface $output) |
| 182 | 182 | { |
| 183 | 183 | if (!empty($options['repo_url'])) { |
| 184 | - copy($projectPath . "/puphpet/magestead/magento/stubs/gitignore.tmp", $projectPath . "/.gitignore"); |
|
| 184 | + copy($projectPath."/puphpet/magestead/magento/stubs/gitignore.tmp", $projectPath."/.gitignore"); |
|
| 185 | 185 | return new VersionControl($options['repo_url'], $projectPath, $output); |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function composerInstall($projectPath, OutputInterface $output) |
| 194 | 194 | { |
| 195 | - copy($projectPath . "/puphpet/magestead/magento/stubs/composer.tmp", $projectPath . "/composer.json"); |
|
| 195 | + copy($projectPath."/puphpet/magestead/magento/stubs/composer.tmp", $projectPath."/composer.json"); |
|
| 196 | 196 | new ProcessCommand('composer install', $projectPath, $output); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -210,31 +210,31 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | protected function updateConfigXml($projectPath) |
| 212 | 212 | { |
| 213 | - $localFile = '/public/app/etc/local.xml'; |
|
| 214 | - $localXml = file_get_contents($projectPath . $localFile); |
|
| 215 | - |
|
| 216 | - $config = new \SimpleXMLElement($localXml); |
|
| 217 | - |
|
| 218 | - $config->global[0]->redis_session[0]->host = '127.0.0.1'; |
|
| 219 | - $config->global[0]->redis_session[0]->port = '6379'; |
|
| 220 | - $config->global[0]->redis_session[0]->password = ''; |
|
| 221 | - $config->global[0]->redis_session[0]->timeout = '2.5'; |
|
| 222 | - $config->global[0]->redis_session[0]->persistent = ''; |
|
| 223 | - $config->global[0]->redis_session[0]->db = ''; |
|
| 224 | - $config->global[0]->redis_session[0]->compression_threshold = '2048'; |
|
| 225 | - $config->global[0]->redis_session[0]->compression_lib = 'gzip'; |
|
| 226 | - $config->global[0]->redis_session[0]->log_level = '1'; |
|
| 227 | - $config->global[0]->redis_session[0]->max_concurrency = '6'; |
|
| 228 | - $config->global[0]->redis_session[0]->break_after_frontend = '5'; |
|
| 229 | - $config->global[0]->redis_session[0]->break_after_adminhtml = '30'; |
|
| 230 | - $config->global[0]->redis_session[0]->first_lifetime = '600'; |
|
| 231 | - $config->global[0]->redis_session[0]->bot_first_lifetime = '60'; |
|
| 232 | - $config->global[0]->redis_session[0]->bot_lifetime = '7200'; |
|
| 233 | - $config->global[0]->redis_session[0]->disable_locking = '0'; |
|
| 234 | - $config->global[0]->redis_session[0]->min_lifetime = '60'; |
|
| 235 | - $config->global[0]->redis_session[0]->max_lifetime = '2592000'; |
|
| 236 | - |
|
| 237 | - file_put_contents($projectPath . $localFile, $config->asXML()); |
|
| 213 | + $localFile='/public/app/etc/local.xml'; |
|
| 214 | + $localXml=file_get_contents($projectPath.$localFile); |
|
| 215 | + |
|
| 216 | + $config=new \SimpleXMLElement($localXml); |
|
| 217 | + |
|
| 218 | + $config->global[0]->redis_session[0]->host='127.0.0.1'; |
|
| 219 | + $config->global[0]->redis_session[0]->port='6379'; |
|
| 220 | + $config->global[0]->redis_session[0]->password=''; |
|
| 221 | + $config->global[0]->redis_session[0]->timeout='2.5'; |
|
| 222 | + $config->global[0]->redis_session[0]->persistent=''; |
|
| 223 | + $config->global[0]->redis_session[0]->db=''; |
|
| 224 | + $config->global[0]->redis_session[0]->compression_threshold='2048'; |
|
| 225 | + $config->global[0]->redis_session[0]->compression_lib='gzip'; |
|
| 226 | + $config->global[0]->redis_session[0]->log_level='1'; |
|
| 227 | + $config->global[0]->redis_session[0]->max_concurrency='6'; |
|
| 228 | + $config->global[0]->redis_session[0]->break_after_frontend='5'; |
|
| 229 | + $config->global[0]->redis_session[0]->break_after_adminhtml='30'; |
|
| 230 | + $config->global[0]->redis_session[0]->first_lifetime='600'; |
|
| 231 | + $config->global[0]->redis_session[0]->bot_first_lifetime='60'; |
|
| 232 | + $config->global[0]->redis_session[0]->bot_lifetime='7200'; |
|
| 233 | + $config->global[0]->redis_session[0]->disable_locking='0'; |
|
| 234 | + $config->global[0]->redis_session[0]->min_lifetime='60'; |
|
| 235 | + $config->global[0]->redis_session[0]->max_lifetime='2592000'; |
|
| 236 | + |
|
| 237 | + file_put_contents($projectPath.$localFile, $config->asXML()); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function activateModule($projectPath) |
| 244 | 244 | { |
| 245 | - $moduleFile = '/public/app/etc/modules/Cm_RedisSession.xml'; |
|
| 246 | - $moduleXml = file_get_contents($projectPath . $moduleFile); |
|
| 247 | - $config = new \SimpleXMLElement($moduleXml); |
|
| 245 | + $moduleFile='/public/app/etc/modules/Cm_RedisSession.xml'; |
|
| 246 | + $moduleXml=file_get_contents($projectPath.$moduleFile); |
|
| 247 | + $config=new \SimpleXMLElement($moduleXml); |
|
| 248 | 248 | |
| 249 | - $config->modules[0]->Cm_RedisSession[0]->active = 'true'; |
|
| 250 | - file_put_contents($projectPath . $moduleFile, $config->asXML()); |
|
| 249 | + $config->modules[0]->Cm_RedisSession[0]->active='true'; |
|
| 250 | + file_put_contents($projectPath.$moduleFile, $config->asXML()); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | protected function configureTestSuites(array $options, $projectPath, OutputInterface $output) |
| 260 | 260 | { |
| 261 | 261 | $output->writeln('<info>Configuring PHPSpec & Behat Suites</info>'); |
| 262 | - $progress = new ProgressBar($output, 2); |
|
| 262 | + $progress=new ProgressBar($output, 2); |
|
| 263 | 263 | |
| 264 | 264 | $progress->start(); |
| 265 | - copy($projectPath . "/puphpet/magestead/magento/stubs/phpspec.yml", $projectPath . "/phpspec.yml"); |
|
| 265 | + copy($projectPath."/puphpet/magestead/magento/stubs/phpspec.yml", $projectPath."/phpspec.yml"); |
|
| 266 | 266 | $progress->advance(); |
| 267 | 267 | $progress->advance(); |
| 268 | 268 | // $behat = $this->getBehatConfig($options, $projectPath, $output); |
@@ -281,12 +281,12 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | protected function getBehatConfig(array $options, $projectPath, OutputInterface $output) |
| 283 | 283 | { |
| 284 | - $yaml = new Parser(); |
|
| 284 | + $yaml=new Parser(); |
|
| 285 | 285 | |
| 286 | 286 | try { |
| 287 | - $behat = $yaml->parse(file_get_contents($projectPath . "/puphpet/magestead/magento/stubs/behat.yml")); |
|
| 287 | + $behat=$yaml->parse(file_get_contents($projectPath."/puphpet/magestead/magento/stubs/behat.yml")); |
|
| 288 | 288 | |
| 289 | - $behat['default']['extensions']['MageTest\MagentoExtension\Extension']['base_url'] = $options['base_url']; |
|
| 289 | + $behat['default']['extensions']['MageTest\MagentoExtension\Extension']['base_url']=$options['base_url']; |
|
| 290 | 290 | return $behat; |
| 291 | 291 | } catch (ParseException $e) { |
| 292 | 292 | $output->writeln('<error>Unable to parse the YAML config</error>'); |
@@ -303,11 +303,11 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | protected function saveBehatConfig($projectPath, OutputInterface $output, $behat, $progress) |
| 305 | 305 | { |
| 306 | - $dumper = new Dumper(); |
|
| 307 | - $yaml = $dumper->dump($behat, 6); |
|
| 306 | + $dumper=new Dumper(); |
|
| 307 | + $yaml=$dumper->dump($behat, 6); |
|
| 308 | 308 | |
| 309 | 309 | try { |
| 310 | - file_put_contents($projectPath . '/behat.yml', $yaml); |
|
| 310 | + file_put_contents($projectPath.'/behat.yml', $yaml); |
|
| 311 | 311 | $progress->advance(); |
| 312 | 312 | } catch (\Exception $e) { |
| 313 | 313 | $output->writeln('<error>Unable to write to the YAML file</error>'); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | - $this->_projectPath = getcwd(); |
|
| 24 | + $this->_projectPath=getcwd(); |
|
| 25 | 25 | $this->setName("log:stream"); |
| 26 | 26 | $this->setDescription("Stream a specific server log"); |
| 27 | 27 | $this->addArgument('log', InputArgument::REQUIRED, 'access or error'); |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | protected function execute(InputInterface $input, OutputInterface $output) |
| 36 | 36 | { |
| 37 | - $log = $input->getArgument('log'); |
|
| 37 | + $log=$input->getArgument('log'); |
|
| 38 | 38 | |
| 39 | - $output->writeln('<info>Streaming '. ucwords($log) . ' Log</info>'); |
|
| 40 | - $command = $this->getCommand(new Config($output), $log); |
|
| 39 | + $output->writeln('<info>Streaming '.ucwords($log).' Log</info>'); |
|
| 40 | + $command=$this->getCommand(new Config($output), $log); |
|
| 41 | 41 | if (!$command) { |
| 42 | 42 | return $output->writeln('<error>Command not available for this application</error>'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $pCommand = "vagrant ssh -c '". $command ."'"; |
|
| 45 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 46 | 46 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | private function getCommand(Config $config, $log) |
| 55 | 55 | { |
| 56 | - $server = $config->_config['magestead']['server']; |
|
| 57 | - $os = $config->_config['magestead']['os']; |
|
| 56 | + $server=$config->_config['magestead']['server']; |
|
| 57 | + $os=$config->_config['magestead']['os']; |
|
| 58 | 58 | |
| 59 | - $location = $this->getLogLocation($server, $os); |
|
| 60 | - $command = 'tail -f /var/log/' . $location . '/' . $config->base_url . '-' . $log . '.log'; |
|
| 59 | + $location=$this->getLogLocation($server, $os); |
|
| 60 | + $command='tail -f /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log'; |
|
| 61 | 61 | |
| 62 | 62 | return $command; |
| 63 | 63 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function getLogLocation($server, $os) |
| 71 | 71 | { |
| 72 | - $location = 'nginx'; |
|
| 72 | + $location='nginx'; |
|
| 73 | 73 | if ($server != 'nginx') { |
| 74 | - $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd'; |
|
| 74 | + $location=($os == 'ubuntu14') ? 'apache2' : 'httpd'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $location; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | - $this->_projectPath = getcwd(); |
|
| 24 | + $this->_projectPath=getcwd(); |
|
| 25 | 25 | $this->setName("log:view"); |
| 26 | 26 | $this->setDescription("View a specific server log"); |
| 27 | 27 | $this->addArgument('log', InputArgument::REQUIRED, 'access or error'); |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | protected function execute(InputInterface $input, OutputInterface $output) |
| 36 | 36 | { |
| 37 | - $log = $input->getArgument('log'); |
|
| 37 | + $log=$input->getArgument('log'); |
|
| 38 | 38 | |
| 39 | - $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>'); |
|
| 40 | - $command = $this->getCommand(new Config($output), $log); |
|
| 39 | + $output->writeln('<info>Viewing '.ucwords($log).' Log</info>'); |
|
| 40 | + $command=$this->getCommand(new Config($output), $log); |
|
| 41 | 41 | if (!$command) { |
| 42 | 42 | return $output->writeln('<error>Command not available for this application</error>'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $pCommand = "vagrant ssh -c '". $command ."'"; |
|
| 45 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 46 | 46 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | private function getCommand(Config $config, $log) |
| 55 | 55 | { |
| 56 | - $server = $config->_config['magestead']['server']; |
|
| 57 | - $os = $config->_config['magestead']['os']; |
|
| 56 | + $server=$config->_config['magestead']['server']; |
|
| 57 | + $os=$config->_config['magestead']['os']; |
|
| 58 | 58 | |
| 59 | - $location = $this->getLogLocation($server, $os); |
|
| 60 | - $command = 'cat /var/log/' . $location . '/' . $config->base_url . '-' . $log . '.log'; |
|
| 59 | + $location=$this->getLogLocation($server, $os); |
|
| 60 | + $command='cat /var/log/'.$location.'/'.$config->base_url.'-'.$log.'.log'; |
|
| 61 | 61 | |
| 62 | 62 | return $command; |
| 63 | 63 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function getLogLocation($server, $os) |
| 71 | 71 | { |
| 72 | - $location = 'nginx'; |
|
| 72 | + $location='nginx'; |
|
| 73 | 73 | if ($server != 'nginx') { |
| 74 | - $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd'; |
|
| 74 | + $location=($os == 'ubuntu14') ? 'apache2' : 'httpd'; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $location; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | $this->setName("cache:enable"); |
| 22 | 22 | $this->setDescription("Enable cache types"); |
| 23 | 23 | $this->addArgument('type', InputArgument::OPTIONAL, '[cache code/type]'); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $output->writeln('<info>Enabling all cache types</info>'); |
| 34 | 34 | |
| 35 | - $cacheType = $input->getArgument('type'); |
|
| 36 | - $command = $this->getCommand(new Config($output), $cacheType); |
|
| 37 | - $pCommand = "vagrant ssh -c '". $command ."'"; |
|
| 35 | + $cacheType=$input->getArgument('type'); |
|
| 36 | + $command=$this->getCommand(new Config($output), $cacheType); |
|
| 37 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 38 | 38 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getCommand(Config $config, $cacheType) |
| 46 | 46 | { |
| 47 | - $type = $config->type; |
|
| 47 | + $type=$config->type; |
|
| 48 | 48 | switch ($type) { |
| 49 | 49 | case 'magento': |
| 50 | 50 | return "cd /var/www/public;../bin/n98-magerun.phar cache:enable $cacheType"; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | $this->setName("cache:flush"); |
| 22 | 22 | $this->setDescription("Flushes cache storage used by cache types"); |
| 23 | 23 | $this->addArgument('type', InputArgument::OPTIONAL, '[cache code/type]'); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $output->writeln('<info>Flushing cache storage</info>'); |
| 34 | 34 | |
| 35 | - $cacheType = $input->getArgument('type'); |
|
| 36 | - $command = $this->getCommand(new Config($output), $cacheType); |
|
| 37 | - $pCommand = "vagrant ssh -c '". $command ."'"; |
|
| 35 | + $cacheType=$input->getArgument('type'); |
|
| 36 | + $command=$this->getCommand(new Config($output), $cacheType); |
|
| 37 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 38 | 38 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getCommand(Config $config, $cacheType) |
| 46 | 46 | { |
| 47 | - $type = $config->type; |
|
| 47 | + $type=$config->type; |
|
| 48 | 48 | switch ($type) { |
| 49 | 49 | case 'magento': |
| 50 | 50 | return "cd /var/www/public;../bin/n98-magerun.phar cache:flush $cacheType"; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | $this->setName("cache:clean"); |
| 22 | 22 | $this->setDescription("Cleans cache types"); |
| 23 | 23 | $this->addArgument('type', InputArgument::OPTIONAL, '[cache code/type]'); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $output->writeln('<info>Cleaning all cache types</info>'); |
| 34 | 34 | |
| 35 | - $cacheType = $input->getArgument('type'); |
|
| 36 | - $command = $this->getCommand(new Config($output), $cacheType); |
|
| 37 | - $pCommand = "vagrant ssh -c '". $command ."'"; |
|
| 35 | + $cacheType=$input->getArgument('type'); |
|
| 36 | + $command=$this->getCommand(new Config($output), $cacheType); |
|
| 37 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 38 | 38 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getCommand(Config $config, $cacheType) |
| 46 | 46 | { |
| 47 | - $type = $config->type; |
|
| 47 | + $type=$config->type; |
|
| 48 | 48 | switch ($type) { |
| 49 | 49 | case 'magento': |
| 50 | 50 | return "cd /var/www/public;../bin/n98-magerun.phar cache:clean $cacheType"; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | - $this->_projectPath = getcwd(); |
|
| 20 | + $this->_projectPath=getcwd(); |
|
| 21 | 21 | $this->setName("cache:disable"); |
| 22 | 22 | $this->setDescription("Disable cache types"); |
| 23 | 23 | $this->addArgument('type', InputArgument::OPTIONAL, '[cache code/type]'); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $output->writeln('<info>Disabling all cache types</info>'); |
| 34 | 34 | |
| 35 | - $cacheType = $input->getArgument('type'); |
|
| 36 | - $command = $this->getCommand(new Config($output), $cacheType); |
|
| 37 | - $pCommand = "vagrant ssh -c '". $command ."'"; |
|
| 35 | + $cacheType=$input->getArgument('type'); |
|
| 36 | + $command=$this->getCommand(new Config($output), $cacheType); |
|
| 37 | + $pCommand="vagrant ssh -c '".$command."'"; |
|
| 38 | 38 | return new ProcessCommand($pCommand, $this->_projectPath, $output); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getCommand(Config $config, $cacheType) |
| 46 | 46 | { |
| 47 | - $type = $config->type; |
|
| 47 | + $type=$config->type; |
|
| 48 | 48 | switch ($type) { |
| 49 | 49 | case 'magento': |
| 50 | 50 | return "cd /var/www/public;../bin/n98-magerun.phar cache:disable $cacheType"; |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
| 12 | - protected $_apiUrl = "https://api.magestead.com/v1/usage"; |
|
| 12 | + protected $_apiUrl="https://api.magestead.com/v1/usage"; |
|
| 13 | 13 | // protected $_apiUrl = "http://magestead-api.app/v1/usage"; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @var array |
| 17 | 17 | */ |
| 18 | - protected $_params = []; |
|
| 18 | + protected $_params=[]; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * UsageApi constructor. |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct($data) |
| 25 | 25 | { |
| 26 | - $this->_params['os_type'] = urlencode($data['os']); |
|
| 27 | - $this->_params['server_type'] = urlencode($data['server']); |
|
| 28 | - $this->_params['php_version'] = urlencode($data['phpver']); |
|
| 29 | - $this->_params['application_version'] = urlencode($data['app']); |
|
| 30 | - $this->_params['vm_memory_limit'] = urlencode($data['memory_limit']); |
|
| 31 | - $this->_params['vm_cpu_count'] = urlencode($data['cpus']); |
|
| 32 | - $this->_params['ip_address'] = urlencode($data['ip_address']); |
|
| 33 | - $this->_params['box'] = urlencode($data['box']); |
|
| 34 | - $this->_params['locale'] = urlencode($data['locale']); |
|
| 35 | - $this->_params['default_currency'] = urlencode($data['default_currency']); |
|
| 26 | + $this->_params['os_type']=urlencode($data['os']); |
|
| 27 | + $this->_params['server_type']=urlencode($data['server']); |
|
| 28 | + $this->_params['php_version']=urlencode($data['phpver']); |
|
| 29 | + $this->_params['application_version']=urlencode($data['app']); |
|
| 30 | + $this->_params['vm_memory_limit']=urlencode($data['memory_limit']); |
|
| 31 | + $this->_params['vm_cpu_count']=urlencode($data['cpus']); |
|
| 32 | + $this->_params['ip_address']=urlencode($data['ip_address']); |
|
| 33 | + $this->_params['box']=urlencode($data['box']); |
|
| 34 | + $this->_params['locale']=urlencode($data['locale']); |
|
| 35 | + $this->_params['default_currency']=urlencode($data['default_currency']); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function send() |
| 42 | 42 | { |
| 43 | - $fields_string = $this->getFieldsString(); |
|
| 43 | + $fields_string=$this->getFieldsString(); |
|
| 44 | 44 | |
| 45 | - $ch = curl_init(); |
|
| 45 | + $ch=curl_init(); |
|
| 46 | 46 | |
| 47 | - curl_setopt($ch,CURLOPT_URL, $this->_apiUrl); |
|
| 48 | - curl_setopt($ch,CURLOPT_POST, count($this->_params)); |
|
| 49 | - curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); |
|
| 47 | + curl_setopt($ch, CURLOPT_URL, $this->_apiUrl); |
|
| 48 | + curl_setopt($ch, CURLOPT_POST, count($this->_params)); |
|
| 49 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); |
|
| 50 | 50 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 51 | 51 | |
| 52 | - $result = curl_exec($ch); |
|
| 52 | + $result=curl_exec($ch); |
|
| 53 | 53 | |
| 54 | 54 | curl_close($ch); |
| 55 | 55 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected function getFieldsString() |
| 62 | 62 | { |
| 63 | - $fields_string = ''; |
|
| 63 | + $fields_string=''; |
|
| 64 | 64 | foreach ($this->_params as $key => $value) { |
| 65 | - $fields_string .= $key . '=' . $value . '&'; |
|
| 65 | + $fields_string.=$key.'='.$value.'&'; |
|
| 66 | 66 | } |
| 67 | 67 | rtrim($fields_string, '&'); |
| 68 | 68 | return $fields_string; |