@@ -102,8 +102,7 @@ |
||
102 | 102 | if ($this->recent) |
103 | 103 | { |
104 | 104 | $items = $this->repository->getRecentlyUpdatedItems(); |
105 | - } |
|
106 | - else |
|
105 | + } else |
|
107 | 106 | { |
108 | 107 | $items = $this->repository->getItems($this->source); |
109 | 108 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if ((isset($item['cms_version']) && $item['cms_version'] !== null) |
153 | 153 | && (isset($item['php_version']) && $item['php_version'] !== null)) |
154 | 154 | { |
155 | - $index = $item['cms_version'] . ' - ' . $item['php_version']; |
|
155 | + $index = $item['cms_version'].' - '.$item['php_version']; |
|
156 | 156 | $cms_php_version[$index] = $item['count']; |
157 | 157 | |
158 | 158 | $this->totalItems += $item['count']; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if ((isset($item['db_type']) && $item['db_type'] !== null) |
165 | 165 | && (isset($item['db_version']) && $item['db_version'] !== null)) |
166 | 166 | { |
167 | - $index = $item['db_type'] . ' - ' . $item['db_version']; |
|
167 | + $index = $item['db_type'].' - '.$item['db_version']; |
|
168 | 168 | $db_type_version[$index] = $item['count']; |
169 | 169 | |
170 | 170 | $this->totalItems += $item['count']; |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | break; |
282 | 282 | |
283 | 283 | case 'cms_php_version': |
284 | - $index = $item['cms_version'] . ' - ' . $item['php_version']; |
|
284 | + $index = $item['cms_version'].' - '.$item['php_version']; |
|
285 | 285 | $data[$this->source][$index] = $item['count']; |
286 | 286 | break; |
287 | 287 | |
288 | 288 | case 'db_type_version': |
289 | - $index = $item['db_type'] . ' - ' . $item['db_version']; |
|
289 | + $index = $item['db_type'].' - '.$item['db_version']; |
|
290 | 290 | $data[$this->source][$index] = $item['count']; |
291 | 291 | break; |
292 | 292 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | foreach ($dataGroup as $row) |
330 | 330 | { |
331 | 331 | $exploded = explode('.', $row['name']); |
332 | - $version = $exploded[0] . '.' . ($exploded[1] ?? '0'); |
|
332 | + $version = $exploded[0].'.'.($exploded[1] ?? '0'); |
|
333 | 333 | |
334 | 334 | // If the container does not exist, add it |
335 | 335 | if (!isset($counts[$version])) |
@@ -82,8 +82,7 @@ |
||
82 | 82 | try |
83 | 83 | { |
84 | 84 | $this->analytics->sendPageview(); |
85 | - } |
|
86 | - catch (\Exception $e) |
|
85 | + } catch (\Exception $e) |
|
87 | 86 | { |
88 | 87 | // Log the error for reference |
89 | 88 | $this->logger->error( |
@@ -196,7 +196,7 @@ |
||
196 | 196 | */ |
197 | 197 | private function doMigration(string $version): void |
198 | 198 | { |
199 | - $sqlFile = $version . '.sql'; |
|
199 | + $sqlFile = $version.'.sql'; |
|
200 | 200 | |
201 | 201 | if (!$this->filesystem->has($sqlFile)) |
202 | 202 | { |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | ->select('version') |
65 | 65 | ->from('#__migrations') |
66 | 66 | )->loadColumn(); |
67 | - } |
|
68 | - catch (ExecutionFailureException | PrepareStatementFailureException $exception) |
|
67 | + } catch (ExecutionFailureException | PrepareStatementFailureException $exception) |
|
69 | 68 | { |
70 | 69 | // On PDO we're checking "42S02, 1146, Table 'XXX.#__migrations' doesn't exist" |
71 | 70 | if (strpos($exception->getMessage(), "migrations' doesn't exist") === false) |
@@ -132,8 +131,7 @@ discard block |
||
132 | 131 | ->select('version') |
133 | 132 | ->from('#__migrations') |
134 | 133 | )->loadColumn(); |
135 | - } |
|
136 | - catch (ExecutionFailureException | PrepareStatementFailureException $exception) |
|
134 | + } catch (ExecutionFailureException | PrepareStatementFailureException $exception) |
|
137 | 135 | { |
138 | 136 | // If the table does not exist, we can still try to run migrations |
139 | 137 | if (strpos($exception->getMessage(), "migrations' doesn't exist") === false) |
@@ -121,11 +121,11 @@ |
||
121 | 121 | private function loadConfiguration(): Registry |
122 | 122 | { |
123 | 123 | $registry = new Registry; |
124 | - $registry->loadFile(APPROOT . '/etc/config.dist.json'); |
|
124 | + $registry->loadFile(APPROOT.'/etc/config.dist.json'); |
|
125 | 125 | |
126 | - if (file_exists(APPROOT . '/etc/config.json')) |
|
126 | + if (file_exists(APPROOT.'/etc/config.json')) |
|
127 | 127 | { |
128 | - $registry->loadFile(APPROOT . '/etc/config.json'); |
|
128 | + $registry->loadFile(APPROOT.'/etc/config.json'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | return $registry; |
@@ -132,8 +132,7 @@ |
||
132 | 132 | if ($recordExists) |
133 | 133 | { |
134 | 134 | $this->db->updateObject('#__jstats', $data, ['unique_id']); |
135 | - } |
|
136 | - else |
|
135 | + } else |
|
137 | 136 | { |
138 | 137 | $this->db->insertObject('#__jstats', $data, ['unique_id']); |
139 | 138 | } |
@@ -140,45 +140,45 @@ |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - /** |
|
144 | - * Loads the recently updated statistics data from the database. |
|
145 | - * |
|
146 | - * Updated within a timeframe, submit a pull request for a different behavior. |
|
147 | - * |
|
148 | - * @return array An array containing the response data |
|
149 | - */ |
|
150 | - public function getTimeframeUpdatedItems(int $timeframe = 0, string $showColumn = ''): array |
|
151 | - { |
|
152 | - $return = []; |
|
153 | - $columns = self::ALLOWED_SOURCES; |
|
154 | - if ($showColumn !== '') { |
|
155 | - // The column should exist in the table and be part of the API |
|
156 | - if (!\in_array($showColumn, self::ALLOWED_SOURCES)) { |
|
157 | - throw new \InvalidArgumentException('An invalid data source was requested.', 404); |
|
158 | - } |
|
159 | - |
|
160 | - $columns = [$showColumn]; |
|
161 | - } |
|
162 | - |
|
163 | - foreach ($columns as $column) { |
|
164 | - if (\in_array($column, ['cms_php_version', 'db_type_version'])) { |
|
165 | - throw new \InvalidArgumentException('An invalid data source was requested.', 404); |
|
166 | - } |
|
167 | - $return[$column] = $this->db->setQuery( |
|
168 | - $this->db->getQuery(true) |
|
169 | - ->select($column) |
|
170 | - ->select('COUNT(' . $column . ') AS count') |
|
171 | - ->from('(SELECT * FROM ' . $this->db->quoteName('#__jstats') . ' WHERE modified > DATE_SUB(NOW(), INTERVAL ' . $this->db->quote($timeframe) .' DAY)) AS tmptable') |
|
172 | - ->group($column) |
|
173 | - )->loadAssocList(); |
|
174 | - } |
|
175 | - |
|
176 | - if ($showColumn !== '') { |
|
177 | - return $return[$showColumn]; |
|
178 | - } |
|
179 | - |
|
180 | - return $return; |
|
181 | - } |
|
143 | + /** |
|
144 | + * Loads the recently updated statistics data from the database. |
|
145 | + * |
|
146 | + * Updated within a timeframe, submit a pull request for a different behavior. |
|
147 | + * |
|
148 | + * @return array An array containing the response data |
|
149 | + */ |
|
150 | + public function getTimeframeUpdatedItems(int $timeframe = 0, string $showColumn = ''): array |
|
151 | + { |
|
152 | + $return = []; |
|
153 | + $columns = self::ALLOWED_SOURCES; |
|
154 | + if ($showColumn !== '') { |
|
155 | + // The column should exist in the table and be part of the API |
|
156 | + if (!\in_array($showColumn, self::ALLOWED_SOURCES)) { |
|
157 | + throw new \InvalidArgumentException('An invalid data source was requested.', 404); |
|
158 | + } |
|
159 | + |
|
160 | + $columns = [$showColumn]; |
|
161 | + } |
|
162 | + |
|
163 | + foreach ($columns as $column) { |
|
164 | + if (\in_array($column, ['cms_php_version', 'db_type_version'])) { |
|
165 | + throw new \InvalidArgumentException('An invalid data source was requested.', 404); |
|
166 | + } |
|
167 | + $return[$column] = $this->db->setQuery( |
|
168 | + $this->db->getQuery(true) |
|
169 | + ->select($column) |
|
170 | + ->select('COUNT(' . $column . ') AS count') |
|
171 | + ->from('(SELECT * FROM ' . $this->db->quoteName('#__jstats') . ' WHERE modified > DATE_SUB(NOW(), INTERVAL ' . $this->db->quote($timeframe) .' DAY)) AS tmptable') |
|
172 | + ->group($column) |
|
173 | + )->loadAssocList(); |
|
174 | + } |
|
175 | + |
|
176 | + if ($showColumn !== '') { |
|
177 | + return $return[$showColumn]; |
|
178 | + } |
|
179 | + |
|
180 | + return $return; |
|
181 | + } |
|
182 | 182 | /** |
183 | 183 | * Saves the given data. |
184 | 184 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $this->db->setQuery( |
65 | 65 | $this->db->getQuery(true) |
66 | 66 | ->select('*') |
67 | - ->from($this->db->quoteName('#__jstats_counter_' . $column)) |
|
67 | + ->from($this->db->quoteName('#__jstats_counter_'.$column)) |
|
68 | 68 | )->loadAssocList(); |
69 | 69 | } |
70 | 70 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $return[$column] = $this->db->setQuery( |
76 | 76 | $this->db->getQuery(true) |
77 | 77 | ->select('*') |
78 | - ->from($this->db->quoteName('#__jstats_counter_' . $column)) |
|
78 | + ->from($this->db->quoteName('#__jstats_counter_'.$column)) |
|
79 | 79 | )->loadAssocList(); |
80 | 80 | } |
81 | 81 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $return[$column] = $this->db->setQuery( |
102 | 102 | $this->db->getQuery(true) |
103 | 103 | ->select($column) |
104 | - ->select('COUNT(' . $column . ') AS count') |
|
104 | + ->select('COUNT('.$column.') AS count') |
|
105 | 105 | ->from($this->db->quoteName('#__jstats')) |
106 | 106 | ->where('modified BETWEEN DATE_SUB(NOW(), INTERVAL 90 DAY) AND NOW()') |
107 | 107 | ->group($column) |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | { |
114 | 114 | $return['cms_php_version'] = $this->db->setQuery( |
115 | 115 | $this->db->getQuery(true) |
116 | - ->select('CONCAT(' . $db->qn('cms_version') . ', ' . $db->q(' - ') . ', ' . $db->qn('php_version') . ') AS cms_php_version') |
|
116 | + ->select('CONCAT('.$db->qn('cms_version').', '.$db->q(' - ').', '.$db->qn('php_version').') AS cms_php_version') |
|
117 | 117 | ->select('COUNT(*) AS count') |
118 | 118 | ->from($this->db->quoteName('#__jstats')) |
119 | 119 | ->where('modified BETWEEN DATE_SUB(NOW(), INTERVAL 90 DAY) AND NOW()') |
120 | - ->group('CONCAT(' . $db->qn('cms_version') . ', ' . $db->q(' - ') . ', ' . $db->qn('php_version') . ')') |
|
120 | + ->group('CONCAT('.$db->qn('cms_version').', '.$db->q(' - ').', '.$db->qn('php_version').')') |
|
121 | 121 | )->loadAssocList(); |
122 | 122 | continue; |
123 | 123 | } |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | { |
127 | 127 | $return['db_type_version'] = $this->db->setQuery( |
128 | 128 | $this->db->getQuery(true) |
129 | - ->select('CONCAT(' . $db->qn('db_type') . ', ' . $db->q(' - ') . ', ' . $db->qn('db_version') . ') AS db_type_version') |
|
129 | + ->select('CONCAT('.$db->qn('db_type').', '.$db->q(' - ').', '.$db->qn('db_version').') AS db_type_version') |
|
130 | 130 | ->select('COUNT(*) AS count') |
131 | 131 | ->from($this->db->quoteName('#__jstats')) |
132 | 132 | ->where('modified BETWEEN DATE_SUB(NOW(), INTERVAL 90 DAY) AND NOW()') |
133 | - ->group('CONCAT(' . $db->qn('db_type') . ', ' . $db->q(' - ') . ', ' . $db->qn('db_version') . ')') |
|
133 | + ->group('CONCAT('.$db->qn('db_type').', '.$db->q(' - ').', '.$db->qn('db_version').')') |
|
134 | 134 | )->loadAssocList(); |
135 | 135 | continue; |
136 | 136 | } |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | $return[$column] = $this->db->setQuery( |
168 | 168 | $this->db->getQuery(true) |
169 | 169 | ->select($column) |
170 | - ->select('COUNT(' . $column . ') AS count') |
|
171 | - ->from('(SELECT * FROM ' . $this->db->quoteName('#__jstats') . ' WHERE modified > DATE_SUB(NOW(), INTERVAL ' . $this->db->quote($timeframe) .' DAY)) AS tmptable') |
|
170 | + ->select('COUNT('.$column.') AS count') |
|
171 | + ->from('(SELECT * FROM '.$this->db->quoteName('#__jstats').' WHERE modified > DATE_SUB(NOW(), INTERVAL '.$this->db->quote($timeframe).' DAY)) AS tmptable') |
|
172 | 172 | ->group($column) |
173 | 173 | )->loadAssocList(); |
174 | 174 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $level = strtoupper($config->get('log.application', $config->get('log.level', 'error'))); |
91 | 91 | |
92 | - return new StreamHandler(APPROOT . '/logs/stats.log', \constant('\\Monolog\\Logger::' . $level)); |
|
92 | + return new StreamHandler(APPROOT.'/logs/stats.log', \constant('\\Monolog\\Logger::'.$level)); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $level = strtoupper($config->get('log.database', $config->get('log.level', 'error'))); |
108 | 108 | |
109 | - return new StreamHandler(APPROOT . '/logs/stats.log', \constant('\\Monolog\\Logger::' . $level)); |
|
109 | + return new StreamHandler(APPROOT.'/logs/stats.log', \constant('\\Monolog\\Logger::'.$level)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -135,7 +135,7 @@ |
||
135 | 135 | '/:source', |
136 | 136 | DisplayStatisticsController::class, |
137 | 137 | [ |
138 | - 'source' => '(' . implode('|', StatisticsRepository::ALLOWED_SOURCES) . ')', |
|
138 | + 'source' => '('.implode('|', StatisticsRepository::ALLOWED_SOURCES).')', |
|
139 | 139 | ] |
140 | 140 | ); |
141 | 141 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function getMigrationsFilesystemService(Container $container): Filesystem |
43 | 43 | { |
44 | - return new Filesystem(new Local(APPROOT . '/etc/migrations')); |
|
44 | + return new Filesystem(new Local(APPROOT.'/etc/migrations')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getSnapshotFilesystemService(Container $container): Filesystem |
55 | 55 | { |
56 | - return new Filesystem(new Local(APPROOT . '/snapshots')); |
|
56 | + return new Filesystem(new Local(APPROOT.'/snapshots')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -65,6 +65,6 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getVersionsFilesystemService(Container $container): Filesystem |
67 | 67 | { |
68 | - return new Filesystem(new Local(APPROOT . '/versions')); |
|
68 | + return new Filesystem(new Local(APPROOT.'/versions')); |
|
69 | 69 | } |
70 | 70 | } |
@@ -188,8 +188,7 @@ discard block |
||
188 | 188 | try |
189 | 189 | { |
190 | 190 | $validVersions = json_decode($this->filesystem->read('joomla.json'), true); |
191 | - } |
|
192 | - catch (FileNotFoundException $exception) |
|
191 | + } catch (FileNotFoundException $exception) |
|
193 | 192 | { |
194 | 193 | throw new \RuntimeException('Missing Joomla! release listing', 500, $exception); |
195 | 194 | } |
@@ -248,8 +247,7 @@ discard block |
||
248 | 247 | try |
249 | 248 | { |
250 | 249 | $validVersions = json_decode($this->filesystem->read('php.json'), true); |
251 | - } |
|
252 | - catch (FileNotFoundException $exception) |
|
250 | + } catch (FileNotFoundException $exception) |
|
253 | 251 | { |
254 | 252 | throw new \RuntimeException('Missing PHP release listing', 500, $exception); |
255 | 253 | } |