mirror of
https://github.com/Findus23/matomo-DiagnosticsExtended.git
synced 2024-09-19 16:03:46 +02:00
skip checks when enable_internet_features = 0
This commit is contained in:
parent
3507876141
commit
8b61d8fbf8
6 changed files with 24 additions and 1 deletions
|
@ -12,6 +12,7 @@ use Piwik\Http;
|
|||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\Diagnostic;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CurlVersionCheck implements Diagnostic
|
||||
|
@ -59,6 +60,9 @@ class CurlVersionCheck implements Diagnostic
|
|||
$url = "https://curl.se/docs/vuln.pm";
|
||||
$timeout = self::SOCKET_TIMEOUT;
|
||||
try {
|
||||
if (!SettingsPiwik::isInternetEnabled()) {
|
||||
throw new \Exception("internet is disabled");
|
||||
}
|
||||
$response = $this->lazyCache->fetch(self::CACHEID);
|
||||
if (!$response) {
|
||||
$response = Http::sendHttpRequest($url, $timeout);
|
||||
|
|
|
@ -15,6 +15,7 @@ use Piwik\Piwik;
|
|||
use Piwik\Plugins\Diagnostics\Diagnostic\Diagnostic;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResultItem;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class DatabaseVersionCheck implements Diagnostic
|
||||
|
@ -66,6 +67,9 @@ class DatabaseVersionCheck implements Diagnostic
|
|||
$url = "https://endoflife.date/api/mariadb/$minorVersion.json";
|
||||
$timeout = self::SOCKET_TIMEOUT;
|
||||
try {
|
||||
if (!SettingsPiwik::isInternetEnabled()) {
|
||||
throw new \Exception("internet is disabled");
|
||||
}
|
||||
$response = $this->lazyCache->fetch($cacheId);
|
||||
if (!$response) {
|
||||
$response = Http::sendHttpRequest($url, $timeout);
|
||||
|
|
|
@ -47,6 +47,9 @@ class MatomoJsCheck implements Diagnostic
|
|||
*/
|
||||
public function execute()
|
||||
{
|
||||
if (!SettingsPiwik::isInternetEnabled()) {
|
||||
throw new \Exception("internet is disabled");
|
||||
}
|
||||
$matomoUrl = SettingsPiwik::getPiwikUrl();
|
||||
$generator = new TrackerCodeGenerator();
|
||||
$matomoJs = $generator->getJsTrackerEndpoint();
|
||||
|
|
|
@ -14,6 +14,7 @@ use Piwik\Piwik;
|
|||
use Piwik\Plugins\Diagnostics\Diagnostic\Diagnostic;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResultItem;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PhpVersionCheck implements Diagnostic
|
||||
|
@ -68,6 +69,9 @@ class PhpVersionCheck implements Diagnostic
|
|||
$url = "https://php.net/releases/?json=1&version=" . $minorVersion;
|
||||
$timeout = self::SOCKET_TIMEOUT;
|
||||
try {
|
||||
if (!SettingsPiwik::isInternetEnabled()) {
|
||||
throw new \Exception("internet is disabled");
|
||||
}
|
||||
$response = $this->lazyCache->fetch($cacheId);
|
||||
if (!$response) {
|
||||
$response = Http::sendHttpRequest($url, $timeout);
|
||||
|
|
|
@ -48,6 +48,13 @@ class URLCheck implements Diagnostic
|
|||
|
||||
public function execute()
|
||||
{
|
||||
if (!SettingsPiwik::isInternetEnabled()) {
|
||||
return [DiagnosticResult::singleResult(
|
||||
$this->label,
|
||||
DiagnosticResult::STATUS_INFORMATIONAL,
|
||||
Piwik::translate("DiagnosticsExtended_URLCheckSkipped")
|
||||
)]
|
||||
}
|
||||
//TODO: don't check if running in development mode
|
||||
$result = new DiagnosticResult($this->label);
|
||||
$result->addItem($this->checkConfigIni());
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
"URLCheckError": "%s should never be public, but seems to be. Please check your webserver config.",
|
||||
"URLCheckLabel": "Files that should not be public",
|
||||
"URLCheckLongErrorMessage": "Please check if your webserver processes the .htaccess files generated by Matomo properly. If you are using Nginx, please take a look at the %1$sofficial matomo-nginx config%2$s for reference for files that should not be public.<br> Otherwise attackers might be able to read sensitive data.",
|
||||
"URLCheckOk": "%s doesn't seem to be publicly reachable"
|
||||
"URLCheckOk": "%s doesn't seem to be publicly reachable",
|
||||
"URLCheckSkipped": "Internet features are disabled, so this check is skipped."
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue