@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | protected $_config; |
| 15 | 15 | protected $_projectPath; |
| 16 | 16 | |
| 17 | - protected function configure() |
|
| 18 | - { |
|
| 17 | + protected function configure() { |
|
| 19 | 18 | $this->_projectPath = getcwd(); |
| 20 | 19 | $this->setName("redis:flush-all"); |
| 21 | 20 | $this->setDescription("Flush redis storage"); |
@@ -26,8 +25,7 @@ discard block |
||
| 26 | 25 | * @param OutputInterface $output |
| 27 | 26 | * @return ProcessCommand |
| 28 | 27 | */ |
| 29 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 30 | - { |
|
| 28 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 31 | 29 | $output->writeln('<info>Flushing Redis Storage</info>'); |
| 32 | 30 | |
| 33 | 31 | $command = "redis-cli flushall"; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | protected function configure() |
| 17 | 17 | { |
| 18 | - $this->_projectPath = getcwd(); |
|
| 18 | + $this->_projectPath=getcwd(); |
|
| 19 | 19 | |
| 20 | 20 | $this->setName("vm:up"); |
| 21 | 21 | $this->setDescription("Spin up your development machine"); |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | protected $_config; |
| 15 | 15 | protected $_projectPath; |
| 16 | 16 | |
| 17 | - protected function configure() |
|
| 18 | - { |
|
| 17 | + protected function configure() { |
|
| 19 | 18 | $this->_projectPath = getcwd(); |
| 20 | 19 | $this->setName("redis:flush-all"); |
| 21 | 20 | $this->setDescription("Flush redis storage"); |
@@ -26,8 +25,7 @@ discard block |
||
| 26 | 25 | * @param OutputInterface $output |
| 27 | 26 | * @return ProcessCommand |
| 28 | 27 | */ |
| 29 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 30 | - { |
|
| 28 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 31 | 29 | $output->writeln('<info>Flushing Redis Storage</info>'); |
| 32 | 30 | |
| 33 | 31 | $command = "redis-cli flushall"; |
@@ -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("vm:run"); |
| 22 | 22 | $this->setDescription("Run commands on your development machine via SSH"); |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | protected function execute(InputInterface $input, OutputInterface $output) |
| 32 | 32 | { |
| 33 | - $command = $input->getArgument('ssh-command'); |
|
| 33 | + $command=$input->getArgument('ssh-command'); |
|
| 34 | 34 | $output->writeln('<info>Running "'.$command.'" on Magestead</info>'); |
| 35 | 35 | |
| 36 | - $passedCommand = "vagrant ssh -c '". $command ."'"; |
|
| 36 | + $passedCommand="vagrant ssh -c '".$command."'"; |
|
| 37 | 37 | return new ProcessCommand($passedCommand, $this->_projectPath, $output); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | protected $_config; |
| 17 | 17 | protected $_projectPath; |
| 18 | 18 | |
| 19 | - protected function configure() |
|
| 20 | - { |
|
| 19 | + protected function configure() { |
|
| 21 | 20 | $this->_projectPath = getcwd(); |
| 22 | 21 | $this->setName("index:reindex"); |
| 23 | 22 | $this->setDescription("Reindex data"); |
@@ -29,8 +28,7 @@ discard block |
||
| 29 | 28 | * @param OutputInterface $output |
| 30 | 29 | * @return ProcessCommand |
| 31 | 30 | */ |
| 32 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 33 | - { |
|
| 31 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 34 | 32 | $output->writeln('<info>Reindexing data</info>'); |
| 35 | 33 | $index = $input->getArgument('index'); |
| 36 | 34 | |
@@ -44,8 +42,7 @@ discard block |
||
| 44 | 42 | * @param $index |
| 45 | 43 | * @return bool|string |
| 46 | 44 | */ |
| 47 | - protected function getCommand(Config $config, $index) |
|
| 48 | - { |
|
| 45 | + protected function getCommand(Config $config, $index) { |
|
| 49 | 46 | $type = $config->type; |
| 50 | 47 | switch ($type) { |
| 51 | 48 | case 'magento': |
@@ -52,6 +52,6 @@ |
||
| 52 | 52 | break; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - return false; |
|
| 55 | + return FALSE; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function configure() |
| 20 | 20 | { |
| 21 | - $this->_projectPath = getcwd(); |
|
| 21 | + $this->_projectPath=getcwd(); |
|
| 22 | 22 | $this->setName("index:mode:show"); |
| 23 | 23 | $this->setDescription("Show index mode"); |
| 24 | 24 | $this->addArgument('index', InputArgument::OPTIONAL, '[indexer]'); |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | protected function execute(InputInterface $input, OutputInterface $output) |
| 33 | 33 | { |
| 34 | - $index = $input->getArgument('index'); |
|
| 34 | + $index=$input->getArgument('index'); |
|
| 35 | 35 | |
| 36 | - $command = $this->getCommand(new Config($output), $index); |
|
| 36 | + $command=$this->getCommand(new Config($output), $index); |
|
| 37 | 37 | if ($command) { |
| 38 | 38 | $output->writeln('<info>Getting index mode</info>'); |
| 39 | - $passedCommand = "vagrant ssh -c '". $command ."'"; |
|
| 39 | + $passedCommand="vagrant ssh -c '".$command."'"; |
|
| 40 | 40 | return new ProcessCommand($passedCommand, $this->_projectPath, $output); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function getCommand(Config $config, $index) |
| 52 | 52 | { |
| 53 | - $type = $config->type; |
|
| 53 | + $type=$config->type; |
|
| 54 | 54 | switch ($type) { |
| 55 | 55 | case 'magento2': |
| 56 | 56 | return "cd /var/www/public;bin/magento indexer:show-mode $index"; |
@@ -4,4 +4,6 @@ |
||
| 4 | 4 | * Class ExistingProjectException |
| 5 | 5 | * @package Magestead\Exceptions |
| 6 | 6 | */ |
| 7 | -class ExistingProjectException extends \Exception {} |
|
| 8 | 7 | \ No newline at end of file |
| 8 | +class ExistingProjectException extends \Exception |
|
| 9 | +{ |
|
| 10 | +} |
|
| 9 | 11 | \ No newline at end of file |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | protected function configure() |
| 26 | 26 | { |
| 27 | - $this->_basePath = dirname( __FILE__ ) . '/../../../'; |
|
| 28 | - $this->_projectPath = getcwd(); |
|
| 27 | + $this->_basePath=dirname(__FILE__).'/../../../'; |
|
| 28 | + $this->_projectPath=getcwd(); |
|
| 29 | 29 | |
| 30 | 30 | $this->setName("new"); |
| 31 | 31 | $this->setDescription("Initialise new Magestead project into current working directory"); |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected function execute(InputInterface $input, OutputInterface $output) |
| 43 | 43 | { |
| 44 | - $project = $this->setProject($input); |
|
| 44 | + $project=$this->setProject($input); |
|
| 45 | 45 | |
| 46 | - $helper = $this->getHelper('question'); |
|
| 47 | - $options = new Options($helper, $input, $output, $project); |
|
| 46 | + $helper=$this->getHelper('question'); |
|
| 47 | + $options=new Options($helper, $input, $output, $project); |
|
| 48 | 48 | |
| 49 | 49 | $this->setupProject($output, $options); |
| 50 | 50 | |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | protected function copyConfigFiles($source, $target, OutputInterface $output) |
| 63 | 63 | { |
| 64 | 64 | try { |
| 65 | - $progress = new ProgressBar($output, 3720); |
|
| 65 | + $progress=new ProgressBar($output, 3720); |
|
| 66 | 66 | $progress->start(); |
| 67 | 67 | foreach ( |
| 68 | - $iterator = new \RecursiveIteratorIterator( |
|
| 68 | + $iterator=new \RecursiveIteratorIterator( |
|
| 69 | 69 | new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), |
| 70 | 70 | \RecursiveIteratorIterator::SELF_FIRST) as $item |
| 71 | 71 | ) { |
| 72 | 72 | if ($item->isDir()) { |
| 73 | - mkdir($target . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); |
|
| 73 | + mkdir($target.DIRECTORY_SEPARATOR.$iterator->getSubPathName()); |
|
| 74 | 74 | } else { |
| 75 | - copy($item, $target . DIRECTORY_SEPARATOR . $iterator->getSubPathName()); |
|
| 75 | + copy($item, $target.DIRECTORY_SEPARATOR.$iterator->getSubPathName()); |
|
| 76 | 76 | } |
| 77 | 77 | $progress->advance(); |
| 78 | 78 | } |
@@ -89,24 +89,24 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function configureProject(array $options, OutputInterface $output) |
| 91 | 91 | { |
| 92 | - $msConfig = $this->getConfigFile($output); |
|
| 92 | + $msConfig=$this->getConfigFile($output); |
|
| 93 | 93 | |
| 94 | - $app = ($options['app'] == 'magento2') ? 'magento2' : 'magento'; |
|
| 95 | - $hostname = 'magestead-' . $options['base_url']; |
|
| 94 | + $app=($options['app'] == 'magento2') ? 'magento2' : 'magento'; |
|
| 95 | + $hostname='magestead-'.$options['base_url']; |
|
| 96 | 96 | |
| 97 | - $msConfig['vagrantfile']['vm']['box'] = $options['box']; |
|
| 98 | - $msConfig['vagrantfile']['vm']['box_url'] = $options['box']; |
|
| 99 | - $msConfig['vagrantfile']['vm']['hostname'] = $hostname; |
|
| 100 | - $msConfig['vagrantfile']['vm']['memory'] = $options['memory_limit']; |
|
| 101 | - $msConfig['vagrantfile']['vm']['network']['private_network'] = $options['ip_address']; |
|
| 102 | - $msConfig['magestead']['apps']['mba_12345']['type'] = $app; |
|
| 103 | - $msConfig['magestead']['apps']['mba_12345']['locale'] = $options['locale']; |
|
| 104 | - $msConfig['magestead']['apps']['mba_12345']['default_currency'] = $options['default_currency']; |
|
| 105 | - $msConfig['magestead']['apps']['mba_12345']['base_url'] = $options['base_url']; |
|
| 106 | - $msConfig['magestead']['os'] = $options['os']; |
|
| 107 | - $msConfig['magestead']['server'] = $options['server']; |
|
| 97 | + $msConfig['vagrantfile']['vm']['box']=$options['box']; |
|
| 98 | + $msConfig['vagrantfile']['vm']['box_url']=$options['box']; |
|
| 99 | + $msConfig['vagrantfile']['vm']['hostname']=$hostname; |
|
| 100 | + $msConfig['vagrantfile']['vm']['memory']=$options['memory_limit']; |
|
| 101 | + $msConfig['vagrantfile']['vm']['network']['private_network']=$options['ip_address']; |
|
| 102 | + $msConfig['magestead']['apps']['mba_12345']['type']=$app; |
|
| 103 | + $msConfig['magestead']['apps']['mba_12345']['locale']=$options['locale']; |
|
| 104 | + $msConfig['magestead']['apps']['mba_12345']['default_currency']=$options['default_currency']; |
|
| 105 | + $msConfig['magestead']['apps']['mba_12345']['base_url']=$options['base_url']; |
|
| 106 | + $msConfig['magestead']['os']=$options['os']; |
|
| 107 | + $msConfig['magestead']['server']=$options['server']; |
|
| 108 | 108 | |
| 109 | - $this->_msConfig = $msConfig; |
|
| 109 | + $this->_msConfig=$msConfig; |
|
| 110 | 110 | |
| 111 | 111 | $this->saveConfigFile($msConfig, $output); |
| 112 | 112 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function getConfigFile(OutputInterface $output) |
| 120 | 120 | { |
| 121 | - $yaml = new Parser(); |
|
| 121 | + $yaml=new Parser(); |
|
| 122 | 122 | try { |
| 123 | - return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml')); |
|
| 123 | + return $yaml->parse(file_get_contents($this->_projectPath.'/magestead.yaml')); |
|
| 124 | 124 | } catch (ParseException $e) { |
| 125 | 125 | $output->writeln('<error>Unable to parse the YAML string</error>'); |
| 126 | 126 | printf("Unable to parse the YAML string: %s", $e->getMessage()); |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | protected function saveConfigFile(array $config, OutputInterface $output) |
| 135 | 135 | { |
| 136 | - $dumper = new Dumper(); |
|
| 137 | - $yaml = $dumper->dump($config, 6); |
|
| 136 | + $dumper=new Dumper(); |
|
| 137 | + $yaml=$dumper->dump($config, 6); |
|
| 138 | 138 | |
| 139 | 139 | try { |
| 140 | - file_put_contents($this->_projectPath . '/magestead.yaml', $yaml); |
|
| 140 | + file_put_contents($this->_projectPath.'/magestead.yaml', $yaml); |
|
| 141 | 141 | } catch (\Exception $e) { |
| 142 | 142 | $output->writeln('<error>Unable to write to the YAML file</error>'); |
| 143 | 143 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | protected function setupProject(OutputInterface $output, $options) |
| 151 | 151 | { |
| 152 | 152 | $output->writeln('<info>Setting up project structure</info>'); |
| 153 | - $provisionFolder = $this->_basePath . "provision"; |
|
| 153 | + $provisionFolder=$this->_basePath."provision"; |
|
| 154 | 154 | $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output); |
| 155 | 155 | $this->configureProject($options->getAllOptions(), $output); |
| 156 | 156 | } |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | protected function setProject(InputInterface $input) |
| 164 | 164 | { |
| 165 | - $project = $input->getArgument('project'); |
|
| 166 | - $this->_projectPath = $this->_projectPath . '/' . $project; |
|
| 165 | + $project=$input->getArgument('project'); |
|
| 166 | + $this->_projectPath=$this->_projectPath.'/'.$project; |
|
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | if (is_dir($this->_projectPath)) { |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | protected $_projectPath; |
| 23 | 23 | protected $_msConfig; |
| 24 | 24 | |
| 25 | - protected function configure() |
|
| 26 | - { |
|
| 25 | + protected function configure() { |
|
| 27 | 26 | $this->_basePath = dirname( __FILE__ ) . '/../../../'; |
| 28 | 27 | $this->_projectPath = getcwd(); |
| 29 | 28 | |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | * @return \Magestead\Installers\Magento2Project|\Magestead\Installers\MagentoProject |
| 40 | 39 | * @throws ExistingProjectException |
| 41 | 40 | */ |
| 42 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 43 | - { |
|
| 41 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 44 | 42 | $project = $this->setProject($input); |
| 45 | 43 | |
| 46 | 44 | $helper = $this->getHelper('question'); |
@@ -59,8 +57,7 @@ discard block |
||
| 59 | 57 | * @param $target |
| 60 | 58 | * @param OutputInterface $output |
| 61 | 59 | */ |
| 62 | - protected function copyConfigFiles($source, $target, OutputInterface $output) |
|
| 63 | - { |
|
| 60 | + protected function copyConfigFiles($source, $target, OutputInterface $output) { |
|
| 64 | 61 | try { |
| 65 | 62 | $progress = new ProgressBar($output, 3720); |
| 66 | 63 | $progress->start(); |
@@ -87,8 +84,7 @@ discard block |
||
| 87 | 84 | * @param array $options |
| 88 | 85 | * @param OutputInterface $output |
| 89 | 86 | */ |
| 90 | - protected function configureProject(array $options, OutputInterface $output) |
|
| 91 | - { |
|
| 87 | + protected function configureProject(array $options, OutputInterface $output) { |
|
| 92 | 88 | $msConfig = $this->getConfigFile($output); |
| 93 | 89 | |
| 94 | 90 | $app = ($options['app'] == 'magento2') ? 'magento2' : 'magento'; |
@@ -116,8 +112,7 @@ discard block |
||
| 116 | 112 | * @param OutputInterface $output |
| 117 | 113 | * @return mixed |
| 118 | 114 | */ |
| 119 | - protected function getConfigFile(OutputInterface $output) |
|
| 120 | - { |
|
| 115 | + protected function getConfigFile(OutputInterface $output) { |
|
| 121 | 116 | $yaml = new Parser(); |
| 122 | 117 | try { |
| 123 | 118 | return $yaml->parse(file_get_contents($this->_projectPath . '/magestead.yaml')); |
@@ -131,8 +126,7 @@ discard block |
||
| 131 | 126 | * @param array $config |
| 132 | 127 | * @param OutputInterface $output |
| 133 | 128 | */ |
| 134 | - protected function saveConfigFile(array $config, OutputInterface $output) |
|
| 135 | - { |
|
| 129 | + protected function saveConfigFile(array $config, OutputInterface $output) { |
|
| 136 | 130 | $dumper = new Dumper(); |
| 137 | 131 | $yaml = $dumper->dump($config, 6); |
| 138 | 132 | |
@@ -147,8 +141,7 @@ discard block |
||
| 147 | 141 | * @param OutputInterface $output |
| 148 | 142 | * @param $options |
| 149 | 143 | */ |
| 150 | - protected function setupProject(OutputInterface $output, $options) |
|
| 151 | - { |
|
| 144 | + protected function setupProject(OutputInterface $output, $options) { |
|
| 152 | 145 | $output->writeln('<info>Setting up project structure</info>'); |
| 153 | 146 | $provisionFolder = $this->_basePath . "provision"; |
| 154 | 147 | $this->copyConfigFiles($provisionFolder, $this->_projectPath, $output); |
@@ -160,8 +153,7 @@ discard block |
||
| 160 | 153 | * @return mixed |
| 161 | 154 | * @throws ExistingProjectException |
| 162 | 155 | */ |
| 163 | - protected function setProject(InputInterface $input) |
|
| 164 | - { |
|
| 156 | + protected function setProject(InputInterface $input) { |
|
| 165 | 157 | $project = $input->getArgument('project'); |
| 166 | 158 | $this->_projectPath = $this->_projectPath . '/' . $project; |
| 167 | 159 | |
@@ -170,7 +170,7 @@ |
||
| 170 | 170 | throw new ExistingProjectException('Target project directory already exists'); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - mkdir($this->_projectPath, 0777, true); |
|
| 173 | + mkdir($this->_projectPath, 0777, TRUE); |
|
| 174 | 174 | return $project; |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
| 12 | - protected $_apiUrl = "http://api.magestead.com/v1/usage"; |
|
| 12 | + protected $_apiUrl="http://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; |
@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | * UsageApi constructor. |
| 22 | 22 | * @param $data |
| 23 | 23 | */ |
| 24 | - public function __construct($data) |
|
| 25 | - { |
|
| 24 | + public function __construct($data) { |
|
| 26 | 25 | $this->_params['os_type'] = urlencode($data['os']); |
| 27 | 26 | $this->_params['server_type'] = urlencode($data['server']); |
| 28 | 27 | $this->_params['php_version'] = urlencode($data['phpver']); |
@@ -38,8 +37,7 @@ discard block |
||
| 38 | 37 | /** |
| 39 | 38 | * |
| 40 | 39 | */ |
| 41 | - public function send() |
|
| 42 | - { |
|
| 40 | + public function send() { |
|
| 43 | 41 | $fields_string = $this->getFieldsString(); |
| 44 | 42 | |
| 45 | 43 | $ch = curl_init(); |
@@ -58,8 +56,7 @@ discard block |
||
| 58 | 56 | /** |
| 59 | 57 | * @return string |
| 60 | 58 | */ |
| 61 | - protected function getFieldsString() |
|
| 62 | - { |
|
| 59 | + protected function getFieldsString() { |
|
| 63 | 60 | $fields_string = ''; |
| 64 | 61 | foreach ($this->_params as $key => $value) { |
| 65 | 62 | $fields_string .= $key . '=' . $value . '&'; |
@@ -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; |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * Configure the view command |
| 21 | 21 | */ |
| 22 | - protected function configure() |
|
| 23 | - { |
|
| 22 | + protected function configure() { |
|
| 24 | 23 | $this->_projectPath = getcwd(); |
| 25 | 24 | $this->setName("log:view"); |
| 26 | 25 | $this->setDescription("View a specific server log"); |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | * @param OutputInterface $output |
| 33 | 32 | * @return ProcessCommand |
| 34 | 33 | */ |
| 35 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 36 | - { |
|
| 34 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 37 | 35 | $log = $input->getArgument('log'); |
| 38 | 36 | |
| 39 | 37 | $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>'); |
@@ -51,8 +49,7 @@ discard block |
||
| 51 | 49 | * @param $log |
| 52 | 50 | * @return string |
| 53 | 51 | */ |
| 54 | - private function getCommand(Config $config, $log) |
|
| 55 | - { |
|
| 52 | + private function getCommand(Config $config, $log) { |
|
| 56 | 53 | $server = $config->_config['magestead']['server']; |
| 57 | 54 | $os = $config->_config['magestead']['os']; |
| 58 | 55 | |
@@ -67,8 +64,7 @@ discard block |
||
| 67 | 64 | * @param $os |
| 68 | 65 | * @return string |
| 69 | 66 | */ |
| 70 | - private function getLogLocation($server, $os) |
|
| 71 | - { |
|
| 67 | + private function getLogLocation($server, $os) { |
|
| 72 | 68 | $location = 'nginx'; |
| 73 | 69 | if ($server != 'nginx') { |
| 74 | 70 | $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd'; |
@@ -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; |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * Configure the view command |
| 21 | 21 | */ |
| 22 | - protected function configure() |
|
| 23 | - { |
|
| 22 | + protected function configure() { |
|
| 24 | 23 | $this->_projectPath = getcwd(); |
| 25 | 24 | $this->setName("log:view"); |
| 26 | 25 | $this->setDescription("View a specific server log"); |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | * @param OutputInterface $output |
| 33 | 32 | * @return ProcessCommand |
| 34 | 33 | */ |
| 35 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 36 | - { |
|
| 34 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 37 | 35 | $log = $input->getArgument('log'); |
| 38 | 36 | |
| 39 | 37 | $output->writeln('<info>Viewing '. ucwords($log) . ' Log</info>'); |
@@ -51,8 +49,7 @@ discard block |
||
| 51 | 49 | * @param $log |
| 52 | 50 | * @return string |
| 53 | 51 | */ |
| 54 | - private function getCommand(Config $config, $log) |
|
| 55 | - { |
|
| 52 | + private function getCommand(Config $config, $log) { |
|
| 56 | 53 | $server = $config->_config['magestead']['server']; |
| 57 | 54 | $os = $config->_config['magestead']['os']; |
| 58 | 55 | |
@@ -67,8 +64,7 @@ discard block |
||
| 67 | 64 | * @param $os |
| 68 | 65 | * @return string |
| 69 | 66 | */ |
| 70 | - private function getLogLocation($server, $os) |
|
| 71 | - { |
|
| 67 | + private function getLogLocation($server, $os) { |
|
| 72 | 68 | $location = 'nginx'; |
| 73 | 69 | if ($server != 'nginx') { |
| 74 | 70 | $location = ($os == 'ubuntu14') ? 'apache2' : 'httpd'; |