diff options
author | Peter Zhang <waikatozhang@gmail.com> | 2021-10-05 06:27:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 06:27:47 +0300 |
commit | 4196894e8f39771b252b1dfaa5a7c8f734d84bfb (patch) | |
tree | aa4a14d3ab6df923653fc525b17f8ec04f389ba9 /plugins/Diagnostics | |
parent | f48b6d52710bf25aeff0bf7724ecdd594ec6c3f1 (diff) |
add php binary format check (#18060)
add PHP binary format check recommend 64 bit
Diffstat (limited to 'plugins/Diagnostics')
-rw-r--r-- | plugins/Diagnostics/Diagnostic/PHPBinaryCheck.php | 45 | ||||
-rw-r--r-- | plugins/Diagnostics/config/config.php | 1 | ||||
-rw-r--r-- | plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png | 4 |
3 files changed, 48 insertions, 2 deletions
diff --git a/plugins/Diagnostics/Diagnostic/PHPBinaryCheck.php b/plugins/Diagnostics/Diagnostic/PHPBinaryCheck.php new file mode 100644 index 0000000000..502f6ef90c --- /dev/null +++ b/plugins/Diagnostics/Diagnostic/PHPBinaryCheck.php @@ -0,0 +1,45 @@ +<?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\Translation\Translator; + +/** + * Check the PHP Binary is set to 64 bit + */ +class PHPBinaryCheck implements Diagnostic +{ + /** + * @var Translator + */ + private $translator; + + /** + * @var int + */ + + public function __construct(Translator $translator) + { + $this->translator = $translator; + } + + public function execute() + { + $label = $this->translator->translate('Installation_PhpBinaryCheck'); + + if (PHP_INT_SIZE === 8) { + $status = DiagnosticResult::STATUS_OK; + $comment = ""; + } else { + $status = DiagnosticResult::STATUS_WARNING; + $comment = $this->translator->translate('Installation_PhpBinaryCheckHelp'); + } + + return array(DiagnosticResult::singleResult($label, $status, $comment)); + } +} diff --git a/plugins/Diagnostics/config/config.php b/plugins/Diagnostics/config/config.php index 9209ac505e..2edd5f7bc2 100644 --- a/plugins/Diagnostics/config/config.php +++ b/plugins/Diagnostics/config/config.php @@ -20,6 +20,7 @@ return array( DI\get(RequiredPrivateDirectories::class), DI\get(RecommendedPrivateDirectories::class), DI\get('Piwik\Plugins\Diagnostics\Diagnostic\FileIntegrityCheck'), + DI\get('Piwik\Plugins\Diagnostics\Diagnostic\PHPBinaryCheck'), DI\get('Piwik\Plugins\Diagnostics\Diagnostic\TrackerCheck'), DI\get('Piwik\Plugins\Diagnostics\Diagnostic\MemoryLimitCheck'), DI\get('Piwik\Plugins\Diagnostics\Diagnostic\TimezoneCheck'), diff --git a/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png b/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png index d67421b809..0aabb52e85 100644 --- a/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png +++ b/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:471fa17bcda0562745eda811beddb7327527c2bb697a7a59e27f7fb4b50e8659 -size 464624 +oid sha256:3bd811ead76de5332d5c0fe6023e4adab18ebf4c4701b4931aef12cf0ffe4446 +size 466436 |