@@ -84,8 +84,7 @@ |
||
84 | 84 | |
85 | 85 | $commands[strtolower("$namespace:" . str_replace('Command', '', $command))] = $this->getContainer()->get($className); |
86 | 86 | } |
87 | - } |
|
88 | - else |
|
87 | + } else |
|
89 | 88 | { |
90 | 89 | $command = $fileInfo->getBasename('.php'); |
91 | 90 | $className = __NAMESPACE__ . "\\Commands\\$command"; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $commands = []; |
56 | 56 | |
57 | 57 | /** @var \DirectoryIterator $fileInfo */ |
58 | - foreach (new \DirectoryIterator(__DIR__ . '/Commands') as $fileInfo) |
|
58 | + foreach (new \DirectoryIterator(__DIR__.'/Commands') as $fileInfo) |
|
59 | 59 | { |
60 | 60 | if ($fileInfo->isDot()) |
61 | 61 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | $command = $subFileInfo->getBasename('.php'); |
78 | - $className = __NAMESPACE__ . "\\Commands\\$namespace\\$command"; |
|
78 | + $className = __NAMESPACE__."\\Commands\\$namespace\\$command"; |
|
79 | 79 | |
80 | 80 | if (!class_exists($className)) |
81 | 81 | { |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | // If the class isn't instantiable, it isn't a valid command |
86 | 86 | if ((new \ReflectionClass($className))->isInstantiable()) |
87 | 87 | { |
88 | - $commands[strtolower("$namespace:" . str_replace('Command', '', $command))] = $this->getContainer()->get($className); |
|
88 | + $commands[strtolower("$namespace:".str_replace('Command', '', $command))] = $this->getContainer()->get($className); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | 92 | else |
93 | 93 | { |
94 | 94 | $command = $fileInfo->getBasename('.php'); |
95 | - $className = __NAMESPACE__ . "\\Commands\\$command"; |
|
95 | + $className = __NAMESPACE__."\\Commands\\$command"; |
|
96 | 96 | |
97 | 97 | if (!class_exists($className)) |
98 | 98 | { |
@@ -161,7 +161,7 @@ |
||
161 | 161 | */ |
162 | 162 | private function doMigration($version) |
163 | 163 | { |
164 | - $sqlFile = 'migrations/' . $version . '.sql'; |
|
164 | + $sqlFile = 'migrations/'.$version.'.sql'; |
|
165 | 165 | |
166 | 166 | if (!$this->filesystem->has($sqlFile)) |
167 | 167 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $container->alias('db', DatabaseDriver::class) |
31 | 31 | ->share( |
32 | 32 | DatabaseDriver::class, |
33 | - function (Container $container) |
|
33 | + function(Container $container) |
|
34 | 34 | { |
35 | 35 | /** @var \Joomla\Registry\Registry $config */ |
36 | 36 | $config = $container->get('config'); |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | $container->alias('db.migrations', Migrations::class) |
48 | 48 | ->set(Migrations::class, |
49 | - function (Container $container) |
|
49 | + function(Container $container) |
|
50 | 50 | { |
51 | 51 | return new Migrations( |
52 | 52 | $container->get('db'), |
53 | - new Filesystem(new Local(APPROOT . '/etc')) |
|
53 | + new Filesystem(new Local(APPROOT.'/etc')) |
|
54 | 54 | ); |
55 | 55 | }, true, true |
56 | 56 | ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ->out('1) Yes') |
63 | 63 | ->out('2) No') |
64 | 64 | ->out() |
65 | - ->out('<question>' . g11n3t('Select:') . '</question>', false); |
|
65 | + ->out('<question>'.g11n3t('Select:').'</question>', false); |
|
66 | 66 | |
67 | 67 | $in = trim($this->getApplication()->in()); |
68 | 68 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->out('No database found.') |
85 | 85 | ->out('Creating the database...', false); |
86 | 86 | |
87 | - $this->db->setQuery('CREATE DATABASE ' . $this->db->quoteName($this->getApplication()->get('database.name'))) |
|
87 | + $this->db->setQuery('CREATE DATABASE '.$this->db->quoteName($this->getApplication()->get('database.name'))) |
|
88 | 88 | ->execute(); |
89 | 89 | |
90 | 90 | $this->db->select($this->getApplication()->get('database.name')); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $dbType = 'mysql'; |
153 | 153 | } |
154 | 154 | |
155 | - $fName = APPROOT . '/etc/' . $dbType . '.sql'; |
|
155 | + $fName = APPROOT.'/etc/'.$dbType.'.sql'; |
|
156 | 156 | |
157 | 157 | if (!file_exists($fName)) |
158 | 158 | { |
@@ -75,8 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | $this->cleanDatabase($tables); |
78 | - } |
|
79 | - catch (\RuntimeException $e) |
|
78 | + } catch (\RuntimeException $e) |
|
80 | 79 | { |
81 | 80 | // Check if the message is "Could not connect to database." Odds are, this means the DB isn't there or the server is down. |
82 | 81 | if (strpos($e->getMessage(), 'Could not connect to database.') !== false) |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | $this->db->select($this->getApplication()->get('database.name')); |
91 | 90 | |
92 | 91 | $this->out('<info>Database created.</info>'); |
93 | - } |
|
94 | - else |
|
92 | + } else |
|
95 | 93 | { |
96 | 94 | throw $e; |
97 | 95 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Stats\Commands; |
4 | 4 | |
5 | 5 | use Joomla\Controller\AbstractController; |
6 | -use Joomla\Database\DatabaseDriver; |
|
7 | 6 | use Stats\CommandInterface; |
8 | 7 | |
9 | 8 | /** |
@@ -30,12 +30,12 @@ |
||
30 | 30 | $this->getApplication()->out('<info>Updating server to git HEAD</info>'); |
31 | 31 | |
32 | 32 | // Pull from remote repo |
33 | - $this->runCommand('cd ' . APPROOT . ' && git pull 2>&1'); |
|
33 | + $this->runCommand('cd '.APPROOT.' && git pull 2>&1'); |
|
34 | 34 | |
35 | 35 | $this->getApplication()->out('<info>Updating Composer resources</info>'); |
36 | 36 | |
37 | 37 | // Run Composer install |
38 | - $this->runCommand('cd ' . APPROOT . ' && composer install --no-dev -o 2>&1'); |
|
38 | + $this->runCommand('cd '.APPROOT.' && composer install --no-dev -o 2>&1'); |
|
39 | 39 | |
40 | 40 | $this->getApplication()->out('<info>Update complete</info>'); |
41 | 41 |
@@ -57,8 +57,7 @@ |
||
57 | 57 | if ($recordExists) |
58 | 58 | { |
59 | 59 | $db->updateObject('#__jstats', $data, ['unique_id']); |
60 | - } |
|
61 | - else |
|
60 | + } else |
|
62 | 61 | { |
63 | 62 | $db->insertObject('#__jstats', $data, ['unique_id']); |
64 | 63 | } |
@@ -87,15 +87,15 @@ |
||
87 | 87 | |
88 | 88 | // Allow the next patch release after this one |
89 | 89 | $nextPatch = $explodedVersion[2] + 1; |
90 | - $versions[] = $explodedVersion[0] . '.' . $explodedVersion[1] . '.' . $nextPatch; |
|
90 | + $versions[] = $explodedVersion[0].'.'.$explodedVersion[1].'.'.$nextPatch; |
|
91 | 91 | |
92 | 92 | // And allow the next minor release after this one |
93 | 93 | $nextMinor = $explodedVersion[1] + 1; |
94 | - $versions[] = $explodedVersion[0] . '.' . $nextMinor . '.0'; |
|
94 | + $versions[] = $explodedVersion[0].'.'.$nextMinor.'.0'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | // Store the version data now |
98 | - $path = APPROOT . '/versions/joomla.json'; |
|
98 | + $path = APPROOT.'/versions/joomla.json'; |
|
99 | 99 | |
100 | 100 | if (file_put_contents($path, json_encode($versions)) === false) |
101 | 101 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $container->alias(CliApplication::class, JoomlaApplication\AbstractCliApplication::class) |
53 | 53 | ->share( |
54 | 54 | JoomlaApplication\AbstractCliApplication::class, |
55 | - function (Container $container) |
|
55 | + function(Container $container) |
|
56 | 56 | { |
57 | 57 | $application = new CliApplication( |
58 | 58 | $container->get(Cli::class), |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $container->alias(WebApplication::class, JoomlaApplication\AbstractWebApplication::class) |
75 | 75 | ->share( |
76 | 76 | JoomlaApplication\AbstractWebApplication::class, |
77 | - function (Container $container) |
|
77 | + function(Container $container) |
|
78 | 78 | { |
79 | 79 | $application = new WebApplication($container->get(Input::class), $container->get('config')); |
80 | 80 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $container->share( |
92 | 92 | Input::class, |
93 | - function () |
|
93 | + function() |
|
94 | 94 | { |
95 | 95 | return new Input($_REQUEST); |
96 | 96 | }, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $container->share( |
101 | 101 | Cli::class, |
102 | - function () |
|
102 | + function() |
|
103 | 103 | { |
104 | 104 | return new Cli; |
105 | 105 | }, |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $container->share( |
110 | 110 | Console::class, |
111 | - function (Container $container) |
|
111 | + function(Container $container) |
|
112 | 112 | { |
113 | 113 | $console = new Console; |
114 | 114 | $console->setContainer($container); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $container->share( |
121 | 121 | JoomlaApplication\Cli\Output\Processor\ColorProcessor::class, |
122 | - function (Container $container) |
|
122 | + function(Container $container) |
|
123 | 123 | { |
124 | 124 | $processor = new JoomlaApplication\Cli\Output\Processor\ColorProcessor; |
125 | 125 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $container->share( |
142 | 142 | JoomlaApplication\Cli\CliInput::class, |
143 | - function (Container $container) |
|
143 | + function(Container $container) |
|
144 | 144 | { |
145 | 145 | return new JoomlaApplication\Cli\CliInput; |
146 | 146 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $container->alias(JoomlaApplication\Cli\CliOutput::class, JoomlaApplication\Cli\Output\Stdout::class) |
150 | 150 | ->share( |
151 | 151 | JoomlaApplication\Cli\Output\Stdout::class, |
152 | - function (Container $container) |
|
152 | + function(Container $container) |
|
153 | 153 | { |
154 | 154 | return new JoomlaApplication\Cli\Output\Stdout($container->get(JoomlaApplication\Cli\Output\Processor\ColorProcessor::class)); |
155 | 155 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $container->share( |
159 | 159 | Analytics::class, |
160 | - function () |
|
160 | + function() |
|
161 | 161 | { |
162 | 162 | return new Analytics(true); |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | $container->share( |
167 | 167 | Router::class, |
168 | - function (Container $container) |
|
168 | + function(Container $container) |
|
169 | 169 | { |
170 | 170 | $router = (new Router($container->get(Input::class))) |
171 | 171 | ->setContainer($container) |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | $container->share( |
183 | 183 | HelpCommand::class, |
184 | - function (Container $container) |
|
184 | + function(Container $container) |
|
185 | 185 | { |
186 | 186 | $command = new HelpCommand; |
187 | 187 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | $container->share( |
197 | 197 | InstallCommand::class, |
198 | - function (Container $container) |
|
198 | + function(Container $container) |
|
199 | 199 | { |
200 | 200 | $command = new InstallCommand($container->get(DatabaseDriver::class)); |
201 | 201 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $container->share( |
211 | 211 | SnapshotCommand::class, |
212 | - function (Container $container) |
|
212 | + function(Container $container) |
|
213 | 213 | { |
214 | 214 | $command = new SnapshotCommand($container->get(StatsJsonView::class)); |
215 | 215 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $container->share( |
225 | 225 | UpdateCommand::class, |
226 | - function (Container $container) |
|
226 | + function(Container $container) |
|
227 | 227 | { |
228 | 228 | $command = new UpdateCommand; |
229 | 229 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | $container->share( |
239 | 239 | ClearCommand::class, |
240 | - function (Container $container) |
|
240 | + function(Container $container) |
|
241 | 241 | { |
242 | 242 | $command = new ClearCommand($container->get(Cache::class)); |
243 | 243 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | $container->share( |
253 | 253 | MigrateCommand::class, |
254 | - function (Container $container) |
|
254 | + function(Container $container) |
|
255 | 255 | { |
256 | 256 | $command = new MigrateCommand($container->get(Migrations::class)); |
257 | 257 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | $container->share( |
268 | 268 | StatusCommand::class, |
269 | - function (Container $container) |
|
269 | + function(Container $container) |
|
270 | 270 | { |
271 | 271 | $command = new StatusCommand($container->get(Migrations::class)); |
272 | 272 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | $container->share( |
282 | 282 | JoomlaCommand::class, |
283 | - function (Container $container) |
|
283 | + function(Container $container) |
|
284 | 284 | { |
285 | 285 | $command = new JoomlaCommand($container->get(GitHub::class)); |
286 | 286 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | $container->share( |
296 | 296 | DisplayControllerGet::class, |
297 | - function (Container $container) |
|
297 | + function(Container $container) |
|
298 | 298 | { |
299 | 299 | $controller = new DisplayControllerGet( |
300 | 300 | $container->get(StatsJsonView::class), |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | $container->share( |
313 | 313 | SubmitControllerCreate::class, |
314 | - function (Container $container) |
|
314 | + function(Container $container) |
|
315 | 315 | { |
316 | 316 | $controller = new SubmitControllerCreate( |
317 | 317 | $container->get(StatsModel::class) |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | $container->share( |
329 | 329 | SubmitControllerGet::class, |
330 | - function (Container $container) |
|
330 | + function(Container $container) |
|
331 | 331 | { |
332 | 332 | $controller = new SubmitControllerGet; |
333 | 333 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | $container->share( |
343 | 343 | StatsModel::class, |
344 | - function (Container $container) |
|
344 | + function(Container $container) |
|
345 | 345 | { |
346 | 346 | return new StatsModel( |
347 | 347 | $container->get(DatabaseDriver::class) |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | $container->share( |
354 | 354 | StatsJsonView::class, |
355 | - function (Container $container) |
|
355 | + function(Container $container) |
|
356 | 356 | { |
357 | 357 | return new StatsJsonView( |
358 | 358 | $container->get(StatsModel::class) |