1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/plugins/Diagnostics/Diagnostic/PhpFunctionsCheck.php
dependabot[bot] 363100d829 [Submodules] Bump the all-submodules group with 16 updates (#23159)
* [Submodules] Bump the all-submodules group with 16 updates

Bumps the all-submodules group with 16 updates:

| Package | From | To |
| --- | --- | --- |
| [plugins/SecurityInfo](https://github.com/matomo-org/plugin-SecurityInfo) | ``0f538ac`` | ``5fb8122`` |
| [plugins/TreemapVisualization](https://github.com/matomo-org/plugin-TreemapVisualization) | ``fcde7c6`` | ``677bdaf`` |
| [plugins/VisitorGenerator](https://github.com/matomo-org/plugin-VisitorGenerator) | ``007687e`` | ``1796a9b`` |
| [plugins/CustomAlerts](https://github.com/matomo-org/plugin-CustomAlerts) | ``71ab364`` | ``d6f258d`` |
| [plugins/TasksTimetable](https://github.com/matomo-org/plugin-TasksTimetable) | ``df5199b`` | ``a79676f`` |
| [plugins/QueuedTracking](https://github.com/matomo-org/plugin-QueuedTracking) | ``3b1b9a0`` | ``c47bed9`` |
| [plugins/LogViewer](https://github.com/matomo-org/plugin-LogViewer) | ``f2349f7`` | ``456af76`` |
| [plugins/AnonymousPiwikUsageMeasurement](https://github.com/matomo-org/plugin-AnonymousPiwikUsageMeasurement) | ``377a652`` | ``0d521d1`` |
| [plugins/Bandwidth](https://github.com/matomo-org/plugin-Bandwidth) | ``81ea191`` | ``b7a9482`` |
| [plugins/LoginLdap](https://github.com/matomo-org/plugin-LoginLdap) | ``f19508a`` | ``db8273d`` |
| [plugins/MarketingCampaignsReporting](https://github.com/matomo-org/plugin-MarketingCampaignsReporting) | ``13751f4`` | ``2522a0e`` |
| [plugins/TagManager](https://github.com/matomo-org/tag-manager) | ``5e7d523`` | ``457071d`` |
| [plugins/DeviceDetectorCache](https://github.com/matomo-org/plugin-DeviceDetectorCache) | ``249a78a`` | ``d709424`` |
| [plugins/Provider](https://github.com/matomo-org/plugin-Provider) | ``5b51ee4`` | ``9469c13`` |
| [plugins/CustomVariables](https://github.com/matomo-org/plugin-CustomVariables) | ``32ffdaf`` | ``f29c470`` |
| [plugins/TrackingSpamPrevention](https://github.com/matomo-org/plugin-TrackingSpamPrevention) | ``0accb25`` | ``573a361`` |


Updates `plugins/SecurityInfo` from `0f538ac` to `5fb8122`
- [Release notes](https://github.com/matomo-org/plugin-SecurityInfo/releases)
- [Commits](0f538ac2e8...5fb8122ba5)

Updates `plugins/TreemapVisualization` from `fcde7c6` to `677bdaf`
- [Release notes](https://github.com/matomo-org/plugin-TreemapVisualization/releases)
- [Commits](fcde7c6717...677bdaf4e0)

Updates `plugins/VisitorGenerator` from `007687e` to `1796a9b`
- [Release notes](https://github.com/matomo-org/plugin-VisitorGenerator/releases)
- [Commits](007687eaae...1796a9b200)

Updates `plugins/CustomAlerts` from `71ab364` to `d6f258d`
- [Release notes](https://github.com/matomo-org/plugin-CustomAlerts/releases)
- [Commits](71ab36497c...d6f258d4c3)

Updates `plugins/TasksTimetable` from `df5199b` to `a79676f`
- [Release notes](https://github.com/matomo-org/plugin-TasksTimetable/releases)
- [Commits](df5199bb95...a79676fed9)

Updates `plugins/QueuedTracking` from `3b1b9a0` to `c47bed9`
- [Release notes](https://github.com/matomo-org/plugin-QueuedTracking/releases)
- [Commits](3b1b9a0571...c47bed9f7d)

Updates `plugins/LogViewer` from `f2349f7` to `456af76`
- [Release notes](https://github.com/matomo-org/plugin-LogViewer/releases)
- [Commits](f2349f7c1a...456af76f29)

Updates `plugins/AnonymousPiwikUsageMeasurement` from `377a652` to `0d521d1`
- [Release notes](https://github.com/matomo-org/plugin-AnonymousPiwikUsageMeasurement/releases)
- [Commits](377a6528b9...0d521d1bd3)

Updates `plugins/Bandwidth` from `81ea191` to `b7a9482`
- [Release notes](https://github.com/matomo-org/plugin-Bandwidth/releases)
- [Commits](81ea19153e...b7a9482e8e)

Updates `plugins/LoginLdap` from `f19508a` to `db8273d`
- [Release notes](https://github.com/matomo-org/plugin-LoginLdap/releases)
- [Commits](f19508ac50...db8273d4d1)

Updates `plugins/MarketingCampaignsReporting` from `13751f4` to `2522a0e`
- [Release notes](https://github.com/matomo-org/plugin-MarketingCampaignsReporting/releases)
- [Commits](13751f44ec...2522a0ed5a)

Updates `plugins/TagManager` from `5e7d523` to `457071d`
- [Commits](5e7d5238ef...457071d774)

Updates `plugins/DeviceDetectorCache` from `249a78a` to `d709424`
- [Release notes](https://github.com/matomo-org/plugin-DeviceDetectorCache/releases)
- [Commits](249a78a9bf...d709424c43)

Updates `plugins/Provider` from `5b51ee4` to `9469c13`
- [Release notes](https://github.com/matomo-org/plugin-Provider/releases)
- [Commits](5b51ee433d...9469c13082)

Updates `plugins/CustomVariables` from `32ffdaf` to `f29c470`
- [Release notes](https://github.com/matomo-org/plugin-CustomVariables/releases)
- [Commits](32ffdaf559...f29c470be8)

Updates `plugins/TrackingSpamPrevention` from `0accb25` to `573a361`
- [Release notes](https://github.com/matomo-org/plugin-TrackingSpamPrevention/releases)
- [Commits](0accb2534e...573a361d78)

---
updated-dependencies:
- dependency-name: plugins/SecurityInfo
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/TreemapVisualization
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/VisitorGenerator
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/CustomAlerts
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/TasksTimetable
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/QueuedTracking
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/LogViewer
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/AnonymousPiwikUsageMeasurement
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/Bandwidth
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/LoginLdap
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/MarketingCampaignsReporting
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/TagManager
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/DeviceDetectorCache
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/Provider
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/CustomVariables
  dependency-type: direct:production
  dependency-group: all-submodules
- dependency-name: plugins/TrackingSpamPrevention
  dependency-type: direct:production
  dependency-group: all-submodules
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update PhpFunctionsCheck.php (#23152)

Added escapeshellarg to required functions check. Updating Matomo (on web) fails with an exception if this function is disabled in PHP settings.

* updates expected UI test files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Horstmanshof <eric@arrowwebprojects.nl>
Co-authored-by: sgiehl <stefan@matomo.org>
2025-03-21 10:30:02 +01:00

115 خطوط
3.2 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\Translation\Translator;
/**
* Check the enabled PHP functions.
*/
class PhpFunctionsCheck implements Diagnostic
{
/**
* @var Translator
*/
private $translator;
public function __construct(Translator $translator)
{
$this->translator = $translator;
}
public function execute()
{
$label = $this->translator->translate('Installation_SystemCheckFunctions');
$result = new DiagnosticResult($label);
foreach ($this->getRequiredFunctions() as $function) {
if (! self::functionExists($function)) {
$status = DiagnosticResult::STATUS_ERROR;
$comment = sprintf(
'%s <br/><br/><em>%s</em><br/><em>%s</em><br/>',
$function,
$this->getHelpMessage($function),
$this->translator->translate('Installation_RestartWebServer')
);
} else {
$status = DiagnosticResult::STATUS_OK;
$comment = $function;
}
$result->addItem(new DiagnosticResultItem($status, $comment));
}
return array($result);
}
/**
* @return string[]
*/
private function getRequiredFunctions()
{
return array(
'debug_backtrace',
'escapeshellarg',
'eval',
'hash',
'gzcompress',
'gzuncompress',
'pack',
);
}
/**
* Tests if a function exists. Also handles the case where a function is disabled via Suhosin.
*
* @param string $function
* @return bool
*/
public static function functionExists($function)
{
// eval() is a language construct
if ($function == 'eval') {
// does not check suhosin.executor.eval.whitelist (or blacklist)
if (extension_loaded('suhosin')) {
return @ini_get("suhosin.executor.disable_eval") != "1";
}
return true;
}
$exists = function_exists($function);
if (extension_loaded('suhosin')) {
$blacklist = @ini_get("suhosin.executor.func.blacklist");
if (!empty($blacklist)) {
$blacklistFunctions = array_map('strtolower', array_map('trim', explode(',', $blacklist)));
return $exists && !in_array($function, $blacklistFunctions);
}
}
return $exists;
}
private function getHelpMessage($missingFunction)
{
$messages = array(
'debug_backtrace' => 'Installation_SystemCheckDebugBacktraceHelp',
'eval' => 'Installation_SystemCheckEvalHelp',
'hash' => 'Installation_SystemCheckHashHelp',
'gzcompress' => 'Installation_SystemCheckGzcompressHelp',
'gzuncompress' => 'Installation_SystemCheckGzuncompressHelp',
'pack' => 'Installation_SystemCheckPackHelp',
);
return $this->translator->translate($messages[$missingFunction]);
}
}