1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 06:57:53 +00:00
Files
matomo/plugins/Diagnostics/Diagnostic/NfsDiskCheck.php
caddoo 55b28a4dc5 Block installation if installation is older than 3 days (#22750)
* Block installation if installation is older than 3 days

* Extend installation UI tests

* Move installation expiration logic out of constructor

* Update installation expiration error page

* Update expected screenshots

* Update FAQ link

---------

Co-authored-by: Marc Neudert <marc@innocraft.com>
2024-11-25 18:02:07 +01:00

57 خطوط
1.5 KiB
PHP

<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\Diagnostics\Diagnostic;
use Piwik\Filesystem;
use Piwik\SettingsPiwik;
use Piwik\Translation\Translator;
/**
* Checks if the filesystem Piwik stores sessions in is NFS or not.
*
* This check is done in order to avoid using file based sessions on NFS system,
* since on such a filesystem file locking can make file based sessions incredibly slow.
*/
class NfsDiskCheck implements Diagnostic
{
/**
* @var Translator
*/
private $translator;
public function __construct(Translator $translator)
{
$this->translator = $translator;
}
public function execute()
{
$label = $this->translator->translate('Installation_Filesystem');
if (! Filesystem::checkIfFileSystemIsNFS()) {
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
}
if (!SettingsPiwik::isMatomoInstalled()) {
$help = 'Installation_NfsFilesystemWarningSuffixInstall';
} else {
$help = 'Installation_NfsFilesystemWarningSuffixAdmin';
}
$comment = sprintf(
'%s<br />%s',
$this->translator->translate('Installation_NfsFilesystemWarning'),
$this->translator->translate($help)
);
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
}
}