diff options
Diffstat (limited to 'plugins/Diagnostics/Diagnostic/MatomoInformational.php')
-rw-r--r-- | plugins/Diagnostics/Diagnostic/MatomoInformational.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/Diagnostics/Diagnostic/MatomoInformational.php b/plugins/Diagnostics/Diagnostic/MatomoInformational.php new file mode 100644 index 0000000000..bcb43a5908 --- /dev/null +++ b/plugins/Diagnostics/Diagnostic/MatomoInformational.php @@ -0,0 +1,55 @@ +<?php +/** + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Plugins\Diagnostics\Diagnostic; + +use Piwik\DbHelper; +use Piwik\SettingsPiwik; +use Piwik\Translation\Translator; +use Piwik\Version; + +/** + * Information about Matomo itself + */ +class MatomoInformational implements Diagnostic +{ + /** + * @var Translator + */ + private $translator; + + public function __construct(Translator $translator) + { + $this->translator = $translator; + } + + public function execute() + { + $results = []; + + $results[] = DiagnosticResult::informationalResult('Matomo Version', Version::VERSION); + + if (SettingsPiwik::isMatomoInstalled()) { + $results[] = DiagnosticResult::informationalResult('Matomo Install Version', $this->getInstallVersion()); + } + + return $results; + } + + private function getInstallVersion() { + try { + $version = DbHelper::getInstallVersion(); + if (empty($version)) { + $version = 'Unknown - pre 3.8.'; + } + return $version; + } catch (\Exception $e) { + return $e->getMessage(); + } + } + +} |