@@ -83,58 +83,58 @@ |
||
| 83 | 83 | |
| 84 | 84 | $writeApi->write($point, WritePrecision::S, 'cms'); |
| 85 | 85 | |
| 86 | - if (!empty($data->db_version)) { |
|
| 87 | - |
|
| 88 | - // Extract major and minor version |
|
| 89 | - preg_match('/^(\d+)\.(\d+)\./', $data->db_version, $matches); |
|
| 90 | - |
|
| 91 | - $dbServer = 'Unknown'; |
|
| 92 | - |
|
| 93 | - if ($data->db_type === 'postgresql') { |
|
| 94 | - $dbServer = 'PostgreSQL'; |
|
| 95 | - } elseif (str_contains($data->db_type, 'mysql')) { |
|
| 96 | - if (version_compare($data->db_version, '10.0.0', '>=')) { |
|
| 97 | - $dbServer = 'MariaDB'; |
|
| 98 | - } else { |
|
| 99 | - $dbServer = 'MySQL'; |
|
| 100 | - } |
|
| 101 | - } elseif (str_contains($data->db_type, 'sqlsrv')) { |
|
| 102 | - $dbServer = 'MSSQL'; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - $point = clone $pointTemplate; |
|
| 106 | - $point |
|
| 107 | - ->addTag('db_version', $data->db_version) |
|
| 108 | - ->addTag('db_driver', $data->db_type) |
|
| 109 | - ->addTag('db_server', $dbServer) |
|
| 110 | - ->addTag('db_major', $matches[1]) |
|
| 111 | - ->addTag('db_minor', $matches[1] . '.' . $matches[2]); |
|
| 112 | - |
|
| 113 | - $writeApi->write($point, WritePrecision::S, 'database'); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - if (!empty($data->server_os)) { |
|
| 117 | - $os = explode(' ', $data->server_os, 2); |
|
| 118 | - |
|
| 119 | - $point = clone $pointTemplate; |
|
| 120 | - $point |
|
| 121 | - ->addTag('server_version', $data->server_os) |
|
| 122 | - ->addTag('server_os', $os[0]); |
|
| 123 | - |
|
| 124 | - $writeApi->write($point, WritePrecision::S, 'os'); |
|
| 125 | - } |
|
| 86 | + if (!empty($data->db_version)) { |
|
| 87 | + |
|
| 88 | + // Extract major and minor version |
|
| 89 | + preg_match('/^(\d+)\.(\d+)\./', $data->db_version, $matches); |
|
| 90 | + |
|
| 91 | + $dbServer = 'Unknown'; |
|
| 92 | + |
|
| 93 | + if ($data->db_type === 'postgresql') { |
|
| 94 | + $dbServer = 'PostgreSQL'; |
|
| 95 | + } elseif (str_contains($data->db_type, 'mysql')) { |
|
| 96 | + if (version_compare($data->db_version, '10.0.0', '>=')) { |
|
| 97 | + $dbServer = 'MariaDB'; |
|
| 98 | + } else { |
|
| 99 | + $dbServer = 'MySQL'; |
|
| 100 | + } |
|
| 101 | + } elseif (str_contains($data->db_type, 'sqlsrv')) { |
|
| 102 | + $dbServer = 'MSSQL'; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + $point = clone $pointTemplate; |
|
| 106 | + $point |
|
| 107 | + ->addTag('db_version', $data->db_version) |
|
| 108 | + ->addTag('db_driver', $data->db_type) |
|
| 109 | + ->addTag('db_server', $dbServer) |
|
| 110 | + ->addTag('db_major', $matches[1]) |
|
| 111 | + ->addTag('db_minor', $matches[1] . '.' . $matches[2]); |
|
| 112 | + |
|
| 113 | + $writeApi->write($point, WritePrecision::S, 'database'); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + if (!empty($data->server_os)) { |
|
| 117 | + $os = explode(' ', $data->server_os, 2); |
|
| 118 | + |
|
| 119 | + $point = clone $pointTemplate; |
|
| 120 | + $point |
|
| 121 | + ->addTag('server_version', $data->server_os) |
|
| 122 | + ->addTag('server_os', $os[0]); |
|
| 123 | + |
|
| 124 | + $writeApi->write($point, WritePrecision::S, 'os'); |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | 127 | // Extract major and minor version |
| 128 | 128 | preg_match('/^(\d+)\.(\d+)\./', $data->php_version, $matches); |
| 129 | 129 | |
| 130 | - if (!empty($data->php_version)) |
|
| 131 | - { |
|
| 132 | - $point = clone $pointTemplate; |
|
| 133 | - $point |
|
| 134 | - ->addTag('php_version', $data->php_version) |
|
| 135 | - ->addTag('db_major', $matches[1]) |
|
| 136 | - ->addTag('db_minor', $matches[1] . '.' . $matches[2]); |
|
| 137 | - $writeApi->write($point, WritePrecision::S, 'php'); |
|
| 138 | - } |
|
| 130 | + if (!empty($data->php_version)) |
|
| 131 | + { |
|
| 132 | + $point = clone $pointTemplate; |
|
| 133 | + $point |
|
| 134 | + ->addTag('php_version', $data->php_version) |
|
| 135 | + ->addTag('db_major', $matches[1]) |
|
| 136 | + ->addTag('db_minor', $matches[1] . '.' . $matches[2]); |
|
| 137 | + $writeApi->write($point, WritePrecision::S, 'php'); |
|
| 138 | + } |
|
| 139 | 139 | } |
| 140 | 140 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $point |
| 80 | 80 | ->addTag('cms_version', $data->cms_version) |
| 81 | 81 | ->addTag('cms_major', $matches[1]) |
| 82 | - ->addTag('cms_minor', $matches[1] . '.' . $matches[2]); |
|
| 82 | + ->addTag('cms_minor', $matches[1].'.'.$matches[2]); |
|
| 83 | 83 | |
| 84 | 84 | $writeApi->write($point, WritePrecision::S, 'cms'); |
| 85 | 85 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ->addTag('db_driver', $data->db_type) |
| 109 | 109 | ->addTag('db_server', $dbServer) |
| 110 | 110 | ->addTag('db_major', $matches[1]) |
| 111 | - ->addTag('db_minor', $matches[1] . '.' . $matches[2]); |
|
| 111 | + ->addTag('db_minor', $matches[1].'.'.$matches[2]); |
|
| 112 | 112 | |
| 113 | 113 | $writeApi->write($point, WritePrecision::S, 'database'); |
| 114 | 114 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $point |
| 134 | 134 | ->addTag('php_version', $data->php_version) |
| 135 | 135 | ->addTag('db_major', $matches[1]) |
| 136 | - ->addTag('db_minor', $matches[1] . '.' . $matches[2]); |
|
| 136 | + ->addTag('db_minor', $matches[1].'.'.$matches[2]); |
|
| 137 | 137 | $writeApi->write($point, WritePrecision::S, 'php'); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -169,7 +169,7 @@ |
||
| 169 | 169 | $controller = new SubmitDataController( |
| 170 | 170 | $container->get(StatisticsRepository::class), |
| 171 | 171 | $container->get('filesystem.versions'), |
| 172 | - $container->get(InfluxdbRepository::class), |
|
| 172 | + $container->get(InfluxdbRepository::class), |
|
| 173 | 173 | ); |
| 174 | 174 | |
| 175 | 175 | $controller->setApplication($container->get(AbstractApplication::class)); |
@@ -154,9 +154,9 @@ |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $this->repository->save((object) $data); |
| 157 | - if ($this->influxdbRepository instanceof InfluxdbRepository) { |
|
| 158 | - $this->influxdbRepository->save((object) $data); |
|
| 159 | - } |
|
| 157 | + if ($this->influxdbRepository instanceof InfluxdbRepository) { |
|
| 158 | + $this->influxdbRepository->save((object) $data); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | 161 | /** @var JsonResponse $response */ |
| 162 | 162 | $response = $this->getApplication()->getResponse(); |
@@ -110,16 +110,16 @@ |
||
| 110 | 110 | ->registerServiceProvider(new RepositoryServiceProvider) |
| 111 | 111 | ->registerServiceProvider(new WebApplicationServiceProvider); |
| 112 | 112 | |
| 113 | - $container->share( |
|
| 114 | - \InfluxDB2\Client::class, |
|
| 115 | - function (Container $container) { |
|
| 116 | - /** @var \Joomla\Registry\Registry $config */ |
|
| 117 | - $config = $container->get('config'); |
|
| 118 | - $options = (array) $config->get('influxdb'); |
|
| 119 | - |
|
| 120 | - return new \InfluxDB2\Client($options); |
|
| 121 | - } |
|
| 122 | - ); |
|
| 113 | + $container->share( |
|
| 114 | + \InfluxDB2\Client::class, |
|
| 115 | + function (Container $container) { |
|
| 116 | + /** @var \Joomla\Registry\Registry $config */ |
|
| 117 | + $config = $container->get('config'); |
|
| 118 | + $options = (array) $config->get('influxdb'); |
|
| 119 | + |
|
| 120 | + return new \InfluxDB2\Client($options); |
|
| 121 | + } |
|
| 122 | + ); |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | return $container; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $container->share( |
| 114 | 114 | \InfluxDB2\Client::class, |
| 115 | - function (Container $container) { |
|
| 115 | + function(Container $container) { |
|
| 116 | 116 | /** @var \Joomla\Registry\Registry $config */ |
| 117 | 117 | $config = $container->get('config'); |
| 118 | 118 | $options = (array) $config->get('influxdb'); |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | private function loadConfiguration(): Registry |
| 134 | 134 | { |
| 135 | 135 | $registry = new Registry; |
| 136 | - $registry->loadFile(APPROOT . '/etc/config.dist.json'); |
|
| 136 | + $registry->loadFile(APPROOT.'/etc/config.dist.json'); |
|
| 137 | 137 | |
| 138 | - if (file_exists(APPROOT . '/etc/config.json')) |
|
| 138 | + if (file_exists(APPROOT.'/etc/config.json')) |
|
| 139 | 139 | { |
| 140 | - $registry->loadFile(APPROOT . '/etc/config.json'); |
|
| 140 | + $registry->loadFile(APPROOT.'/etc/config.json'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | return $registry; |