AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/awebpaca/piwik/plugins/Diagnostics/Diagnostic/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/awebpaca/piwik/plugins/Diagnostics/Diagnostic/DbMaxPacket.php
<?php

namespace Piwik\Plugins\Diagnostics\Diagnostic;

use Piwik\Db;
use Piwik\Piwik;
use Piwik\SettingsPiwik;
use Piwik\Translation\Translator;
use Piwik\Metrics\Formatter;

/**
 * Check if Piwik is connected with database through ssl.
 */
class DbMaxPacket implements Diagnostic
{
    /**
     * @var Translator
     */
    private $translator;

    const MIN_VALUE_MAX_PACKET_MB = 64;

    public function __construct(Translator $translator)
    {
        $this->translator = $translator;
    }

    public function execute()
    {
        if (!SettingsPiwik::isMatomoInstalled()) {
            return array(); // only possible to perform check once we have DB connection
        }

        $maxPacketBytes = Db::fetchRow("SHOW VARIABLES LIKE 'max_allowed_packet'");

        $status = DiagnosticResult::STATUS_OK;
        $label = $this->translator->translate('Diagnostics_MysqlMaxPacketSize');
        $comment = '';

        $minSize = self::MIN_VALUE_MAX_PACKET_MB * 1000 * 1000; // not using 1024 just in case... this amount be good enough
        if (!empty($maxPacketBytes['Value']) && $maxPacketBytes['Value'] < $minSize) {
            $status = DiagnosticResult::STATUS_WARNING;
            $formatter = new Formatter\Html();
            $pretty = $formatter->getPrettySizeFromBytes($maxPacketBytes['Value'], 'M', $precision = 1);
            $configured = str_replace(array(' M', '&nbsp;M'), 'MB', $pretty);
            $comment = Piwik::translate('Diagnostics_MysqlMaxPacketSizeWarning', array('64MB', $configured));
        }

        return array(DiagnosticResult::singleResult($label, $status, $comment));
    }
}

Anon7 - 2022
AnonSec Team