PDF rausgenommen
This commit is contained in:
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Commands;
|
||||
|
||||
use Piwik\Container\StaticContainer;
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ConsoleCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
|
||||
/**
|
||||
* Diagnostic command that analyzes a single archive table. Displays information like # of segment archives,
|
||||
* # invalidated archives, # temporary archives, etc.
|
||||
*/
|
||||
class AnalyzeArchiveTable extends ConsoleCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('diagnostics:analyze-archive-table');
|
||||
$this->setDescription('Analyze an archive table and display human readable information about what is stored. '
|
||||
. 'This command can be used to diagnose issues like bloated archive tables.');
|
||||
$this->addArgument('table-date', InputArgument::REQUIRED, "The table's associated date, eg, 2015_01 or 2015_02");
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$tableDate = $input->getArgument('table-date');
|
||||
|
||||
$output->writeln("<comment>Statistics for the archive_numeric_$tableDate and archive_blob_$tableDate tables:</comment>");
|
||||
$output->writeln("");
|
||||
|
||||
$archiveTableDao = StaticContainer::get('Piwik\DataAccess\ArchiveTableDao');
|
||||
$rows = $archiveTableDao->getArchiveTableAnalysis($tableDate);
|
||||
|
||||
// process labels
|
||||
$periodIdsToLabels = array_flip(Piwik::$idPeriods);
|
||||
foreach ($rows as $key => &$row) {
|
||||
list($idSite, $date1, $date2, $period) = explode('.', $key);
|
||||
|
||||
$periodLabel = isset($periodIdsToLabels[$period]) ? $periodIdsToLabels[$period] : "Unknown Period ($period)";
|
||||
$row['label'] = $periodLabel . "[" . $date1 . " - " . $date2 . "] idSite = " . $idSite;
|
||||
}
|
||||
|
||||
$headers = array('Group', '# Archives', '# Invalidated', '# Temporary', '# Error', '# Segment',
|
||||
'# Numeric Rows', '# Blob Rows', '# Blob Data');
|
||||
|
||||
// display all rows
|
||||
$table = new Table($output);
|
||||
$table->setHeaders($headers)->setRows($rows);
|
||||
$table->render();
|
||||
|
||||
// display summary
|
||||
$totalArchives = 0;
|
||||
$totalInvalidated = 0;
|
||||
$totalTemporary = 0;
|
||||
$totalError = 0;
|
||||
$totalSegment = 0;
|
||||
$totalBlobLength = 0;
|
||||
foreach ($rows as $row) {
|
||||
$totalArchives += $row['count_archives'];
|
||||
$totalInvalidated += $row['count_invalidated_archives'];
|
||||
$totalTemporary += $row['count_temporary_archives'];
|
||||
$totalError += $row['count_error_archives'];
|
||||
$totalSegment += $row['count_segment_archives'];
|
||||
if (isset($row['sum_blob_length'])) {
|
||||
$totalBlobLength += $row['sum_blob_length'];
|
||||
}
|
||||
}
|
||||
|
||||
$formatter = new Formatter();
|
||||
|
||||
$output->writeln("");
|
||||
$output->writeln("Total # Archives: <comment>$totalArchives</comment>");
|
||||
$output->writeln("Total # Invalidated Archives: <comment>$totalInvalidated</comment>");
|
||||
$output->writeln("Total # Temporary Archives: <comment>$totalTemporary</comment>");
|
||||
$output->writeln("Total # Error Archives: <comment>$totalError</comment>");
|
||||
$output->writeln("Total # Segment Archives: <comment>$totalSegment</comment>");
|
||||
$output->writeln("Total Size of Blobs: <comment>" . $formatter->getPrettySizeFromBytes($totalBlobLength) . "</comment>");
|
||||
$output->writeln("");
|
||||
}
|
||||
}
|
94
msd2/tracking/piwik/plugins/Diagnostics/Commands/Run.php
Normal file
94
msd2/tracking/piwik/plugins/Diagnostics/Commands/Run.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Commands;
|
||||
|
||||
use Piwik\Container\StaticContainer;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ConsoleCommand;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResultItem;
|
||||
use Piwik\Plugins\Diagnostics\DiagnosticService;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Run the diagnostics.
|
||||
*/
|
||||
class Run extends ConsoleCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('diagnostics:run')
|
||||
->setDescription('Run diagnostics to check that Piwik is installed and runs correctly')
|
||||
->addOption('all', null, InputOption::VALUE_NONE, 'Show all diagnostics, including those that passed with success');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
// Replace this with dependency injection once available
|
||||
/** @var DiagnosticService $diagnosticService */
|
||||
$diagnosticService = StaticContainer::get('Piwik\Plugins\Diagnostics\DiagnosticService');
|
||||
|
||||
$showAll = $input->getOption('all');
|
||||
|
||||
$report = $diagnosticService->runDiagnostics();
|
||||
|
||||
foreach ($report->getAllResults() as $result) {
|
||||
$items = $result->getItems();
|
||||
|
||||
if (! $showAll && ($result->getStatus() === DiagnosticResult::STATUS_OK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count($items) === 1) {
|
||||
$output->writeln($result->getLabel() . ': ' . $this->formatItem($items[0]), OutputInterface::OUTPUT_NORMAL);
|
||||
continue;
|
||||
}
|
||||
|
||||
$output->writeln($result->getLabel() . ':');
|
||||
foreach ($items as $item) {
|
||||
$output->writeln("\t- " . $this->formatItem($item), OutputInterface::OUTPUT_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
if ($report->hasWarnings()) {
|
||||
$output->writeln(sprintf('<comment>%d warnings detected</comment>', $report->getWarningCount()));
|
||||
}
|
||||
if ($report->hasErrors()) {
|
||||
$output->writeln(sprintf('<error>%d errors detected</error>', $report->getErrorCount()));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!$report->hasWarnings() && !$report->hasErrors()) {
|
||||
$output->writeln(sprintf('<info>%s</info>', Piwik::translate('Installation_SystemCheckSummaryNoProblems')));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function formatItem(DiagnosticResultItem $item)
|
||||
{
|
||||
if ($item->getStatus() === DiagnosticResult::STATUS_ERROR) {
|
||||
$tag = 'error';
|
||||
} elseif ($item->getStatus() === DiagnosticResult::STATUS_WARNING) {
|
||||
$tag = 'comment';
|
||||
} else {
|
||||
$tag = 'info';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<%s>%s %s</%s>',
|
||||
$tag,
|
||||
strtoupper($item->getStatus()),
|
||||
preg_replace('%</?[a-z][a-z0-9]*[^<>]*>%sim', '', preg_replace('/\<br\s*\/?\>/i', "\n", $item->getComment())),
|
||||
$tag
|
||||
);
|
||||
}
|
||||
}
|
205
msd2/tracking/piwik/plugins/Diagnostics/ConfigReader.php
Normal file
205
msd2/tracking/piwik/plugins/Diagnostics/ConfigReader.php
Normal file
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics;
|
||||
|
||||
use Piwik\Development;
|
||||
use Piwik\Ini\IniReader;
|
||||
use Piwik\Application\Kernel\GlobalSettingsProvider;
|
||||
use Piwik\Settings as PiwikSettings;
|
||||
use Piwik\Plugin\Settings as PluginSettings;
|
||||
|
||||
/**
|
||||
* A diagnostic report contains all the results of all the diagnostics.
|
||||
*/
|
||||
class ConfigReader
|
||||
{
|
||||
/**
|
||||
* @var GlobalSettingsProvider
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* @var IniReader
|
||||
*/
|
||||
private $iniReader;
|
||||
|
||||
public function __construct(GlobalSettingsProvider $settings, IniReader $iniReader)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->iniReader = $iniReader;
|
||||
}
|
||||
|
||||
public function getConfigValuesFromFiles()
|
||||
{
|
||||
$ini = $this->settings->getIniFileChain();
|
||||
$descriptions = $this->iniReader->readComments($this->settings->getPathGlobal());
|
||||
|
||||
$copy = array();
|
||||
foreach ($ini->getAll() as $category => $values) {
|
||||
if ($this->shouldSkipCategory($category)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$local = $this->getFromLocalConfig($category);
|
||||
if (empty($local)) {
|
||||
$local = array();
|
||||
}
|
||||
|
||||
$global = $this->getFromGlobalConfig($category);
|
||||
if (empty($global)) {
|
||||
$global = array();
|
||||
}
|
||||
|
||||
$copy[$category] = array();
|
||||
foreach ($values as $key => $value) {
|
||||
|
||||
$newValue = $value;
|
||||
if ($this->isKeyAPassword($key)) {
|
||||
$newValue = $this->getMaskedPassword();
|
||||
}
|
||||
|
||||
$defaultValue = null;
|
||||
if (array_key_exists($key, $global)) {
|
||||
$defaultValue = $global[$key];
|
||||
}
|
||||
|
||||
$description = '';
|
||||
if (!empty($descriptions[$category][$key])) {
|
||||
$description = trim($descriptions[$category][$key]);
|
||||
}
|
||||
|
||||
$copy[$category][$key] = array(
|
||||
'value' => $newValue,
|
||||
'description' => $description,
|
||||
'isCustomValue' => array_key_exists($key, $local),
|
||||
'defaultValue' => $defaultValue,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $copy;
|
||||
}
|
||||
|
||||
private function shouldSkipCategory($category)
|
||||
{
|
||||
$category = strtolower($category);
|
||||
if ($category === 'database') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$developmentOnlySections = array('database_tests', 'tests', 'debugtests');
|
||||
|
||||
return !Development::isEnabled() && in_array($category, $developmentOnlySections);
|
||||
}
|
||||
|
||||
public function getFromGlobalConfig($name)
|
||||
{
|
||||
return $this->settings->getIniFileChain()->getFrom($this->settings->getPathGlobal(), $name);
|
||||
}
|
||||
|
||||
public function getFromLocalConfig($name)
|
||||
{
|
||||
return $this->settings->getIniFileChain()->getFrom($this->settings->getPathLocal(), $name);
|
||||
}
|
||||
|
||||
private function getMaskedPassword()
|
||||
{
|
||||
return '******';
|
||||
}
|
||||
|
||||
private function isKeyAPassword($key)
|
||||
{
|
||||
$key = strtolower($key);
|
||||
$passwordFields = array(
|
||||
'password', 'secret', 'apikey', 'privatekey', 'admin_pass', 'md5', 'sha1'
|
||||
);
|
||||
foreach ($passwordFields as $value) {
|
||||
if (strpos($key, $value) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($key === 'salt') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds config values that can be used to overwrite a plugin system setting and adds a description + default value
|
||||
* for already existing configured config values that overwrite a plugin system setting.
|
||||
*
|
||||
* @param array $configValues
|
||||
* @param \Piwik\Settings\Plugin\SystemSettings[] $systemSettings
|
||||
* @return array
|
||||
*/
|
||||
public function addConfigValuesFromSystemSettings($configValues, $systemSettings)
|
||||
{
|
||||
foreach ($systemSettings as $pluginSetting) {
|
||||
$pluginName = $pluginSetting->getPluginName();
|
||||
|
||||
if (empty($pluginName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!array_key_exists($pluginName, $configValues)) {
|
||||
$configValues[$pluginName] = array();
|
||||
}
|
||||
|
||||
foreach ($pluginSetting->getSettingsWritableByCurrentUser() as $setting) {
|
||||
|
||||
$name = $setting->getName();
|
||||
|
||||
$configSection = $pluginName;
|
||||
|
||||
if ($setting instanceof PiwikSettings\Plugin\SystemConfigSetting) {
|
||||
$configSection = $setting->getConfigSectionName();
|
||||
|
||||
if ($this->shouldSkipCategory($configSection)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$config = $setting->configureField();
|
||||
|
||||
$description = '';
|
||||
if (!empty($config->description)) {
|
||||
$description .= $config->description . ' ';
|
||||
}
|
||||
|
||||
if (!empty($config->inlineHelp)) {
|
||||
$description .= $config->inlineHelp;
|
||||
}
|
||||
|
||||
if (isset($configValues[$configSection][$name])) {
|
||||
$configValues[$configSection][$name]['defaultValue'] = $setting->getDefaultValue();
|
||||
$configValues[$configSection][$name]['description'] = trim($description);
|
||||
|
||||
if ($config->uiControl === PiwikSettings\FieldConfig::UI_CONTROL_PASSWORD) {
|
||||
$configValues[$configSection][$name]['value'] = $this->getMaskedPassword();
|
||||
}
|
||||
} else {
|
||||
$defaultValue = $setting->getValue();
|
||||
$configValues[$configSection][$name] = array(
|
||||
'value' => null,
|
||||
'description' => trim($description),
|
||||
'isCustomValue' => false,
|
||||
'defaultValue' => $defaultValue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($configValues[$pluginName])) {
|
||||
unset($configValues[$pluginName]);
|
||||
}
|
||||
}
|
||||
|
||||
return $configValues;
|
||||
}
|
||||
}
|
68
msd2/tracking/piwik/plugins/Diagnostics/Controller.php
Normal file
68
msd2/tracking/piwik/plugins/Diagnostics/Controller.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\SettingsProvider;
|
||||
use Piwik\View;
|
||||
use Piwik\Settings;
|
||||
|
||||
class Controller extends \Piwik\Plugin\ControllerAdmin
|
||||
{
|
||||
/**
|
||||
* @var ConfigReader
|
||||
*/
|
||||
private $configReader;
|
||||
|
||||
public function __construct(ConfigReader $configReader)
|
||||
{
|
||||
$this->configReader = $configReader;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function configfile()
|
||||
{
|
||||
Piwik::checkUserHasSuperUserAccess();
|
||||
|
||||
$settings = new SettingsProvider(\Piwik\Plugin\Manager::getInstance());
|
||||
$allSettings = $settings->getAllSystemSettings();
|
||||
|
||||
$configValues = $this->configReader->getConfigValuesFromFiles();
|
||||
$configValues = $this->configReader->addConfigValuesFromSystemSettings($configValues, $allSettings);
|
||||
$configValues = $this->sortConfigValues($configValues);
|
||||
|
||||
return $this->renderTemplate('configfile', array(
|
||||
'allConfigValues' => $configValues
|
||||
));
|
||||
}
|
||||
|
||||
private function sortConfigValues($configValues)
|
||||
{
|
||||
// we sort by sections alphabetically
|
||||
uksort($configValues, function ($section1, $section2) {
|
||||
return strcasecmp($section1, $section2);
|
||||
});
|
||||
|
||||
foreach ($configValues as $category => &$settings) {
|
||||
// we sort keys alphabetically but list the ones that are changed first
|
||||
uksort($settings, function ($setting1, $setting2) use ($settings) {
|
||||
if ($settings[$setting1]['isCustomValue'] && !$settings[$setting2]['isCustomValue']) {
|
||||
return -1;
|
||||
} elseif (!$settings[$setting1]['isCustomValue'] && $settings[$setting2]['isCustomValue']) {
|
||||
return 1;
|
||||
}
|
||||
return strcasecmp($setting1, $setting2);
|
||||
});
|
||||
}
|
||||
|
||||
return $configValues;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\CliMulti;
|
||||
use Piwik\Config;
|
||||
use Piwik\Http;
|
||||
use Piwik\Translation\Translator;
|
||||
use Piwik\Url;
|
||||
|
||||
/**
|
||||
* Check if cron archiving can run through CLI.
|
||||
*/
|
||||
class CronArchivingCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckCronArchiveProcess');
|
||||
$comment = $this->translator->translate('Installation_SystemCheckCronArchiveProcessCLI') . ': ';
|
||||
|
||||
$process = new CliMulti();
|
||||
|
||||
if ($process->supportsAsync()) {
|
||||
$comment .= $this->translator->translate('General_Ok');
|
||||
} else {
|
||||
$comment .= $this->translator->translate('Installation_NotSupported')
|
||||
. ' ' . $this->translator->translate('Goals_Optional');
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\ArchiveProcessor\Rules;
|
||||
use Piwik\Config;
|
||||
use Piwik\CronArchive;
|
||||
use Piwik\Date;
|
||||
use Piwik\Metrics\Formatter;
|
||||
use Piwik\Option;
|
||||
use Piwik\Plugins\Intl\DateTimeFormatProvider;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check if cron archiving has run in the last 24-48 hrs.
|
||||
*/
|
||||
class CronArchivingLastRunCheck implements Diagnostic
|
||||
{
|
||||
const SECONDS_IN_DAY = 86400;
|
||||
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
if (!SettingsPiwik::isMatomoInstalled()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$label = $this->translator->translate('Diagnostics_CronArchivingLastRunCheck');
|
||||
$commandToRerun = '<code>' . $this->getArchivingCommand() . '</code>';
|
||||
$coreArchiveShort = '<code>core:archive</code>';
|
||||
$mailto = '<code>MAILTO</code>';
|
||||
|
||||
// check cron archiving has been enabled
|
||||
$isBrowserTriggerDisabled = !Rules::isBrowserTriggerEnabled();
|
||||
if (!$isBrowserTriggerDisabled) {
|
||||
$comment = $this->translator->translate('Diagnostics_BrowserTriggeredArchivingEnabled', [
|
||||
'<a href="https://matomo.org/docs/setup-auto-archiving/" target="_blank" rel="noreferrer noopener">', '</a>']);
|
||||
return [DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)];
|
||||
}
|
||||
|
||||
// check archiving has been run
|
||||
$lastRunTime = (int)Option::get(CronArchive::OPTION_ARCHIVING_FINISHED_TS);
|
||||
if (empty($lastRunTime)) {
|
||||
$comment = $this->translator->translate('Diagnostics_CronArchivingHasNotRun')
|
||||
. '<br/><br/>' . $this->translator->translate('Diagnostics_CronArchivingRunDetails', [$coreArchiveShort, $mailto, $commandToRerun]);;
|
||||
return [DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_ERROR, $comment)];
|
||||
}
|
||||
|
||||
$lastRunTimePretty = Date::factory($lastRunTime)->getLocalized(DateTimeFormatProvider::DATETIME_FORMAT_LONG);
|
||||
|
||||
$diffTime = self::getTimeSinceLastSuccessfulRun($lastRunTime);
|
||||
|
||||
$formatter = new Formatter();
|
||||
$diffTimePretty = $formatter->getPrettyTimeFromSeconds($diffTime);
|
||||
|
||||
$errorComment = $this->translator->translate('Diagnostics_CronArchivingHasNotRunInAWhile', [$lastRunTimePretty, $diffTimePretty])
|
||||
. '<br/><br/>' . $this->translator->translate('Diagnostics_CronArchivingRunDetails', [$coreArchiveShort, $mailto, $commandToRerun]);
|
||||
|
||||
// check archiving has been run recently
|
||||
if ($diffTime > self::SECONDS_IN_DAY * 2) {
|
||||
$result = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_ERROR, $errorComment);
|
||||
} else if ($diffTime > self::SECONDS_IN_DAY) {
|
||||
$result = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $errorComment);
|
||||
} else {
|
||||
$comment = $this->translator->translate('Diagnostics_CronArchivingRanSuccessfullyXAgo', $diffTimePretty);
|
||||
$result = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $comment);
|
||||
}
|
||||
|
||||
return [$result];
|
||||
}
|
||||
|
||||
private function getArchivingCommand()
|
||||
{
|
||||
$domain = Config::getHostname();
|
||||
return PIWIK_INCLUDE_PATH . ' --matomo-domain=' . $domain . ' core:archive';
|
||||
}
|
||||
|
||||
public static function getTimeSinceLastSuccessfulRun($lastRunTime = null)
|
||||
{
|
||||
if (empty($lastRunTime)) {
|
||||
$lastRunTime = (int)Option::get(CronArchive::OPTION_ARCHIVING_FINISHED_TS);
|
||||
}
|
||||
|
||||
if (empty($lastRunTime)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$now = Date::now()->getTimestamp();
|
||||
$diffTime = $now - $lastRunTime;
|
||||
|
||||
return $diffTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Db\Adapter;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check supported DB adapters are available.
|
||||
*/
|
||||
class DbAdapterCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$results = array();
|
||||
$results[] = $this->checkPdo();
|
||||
$results = array_merge($results, $this->checkDbAdapters());
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function checkPdo()
|
||||
{
|
||||
$label = 'PDO ' . $this->translator->translate('Installation_Extension');
|
||||
|
||||
if (extension_loaded('PDO')) {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_WARNING;
|
||||
}
|
||||
|
||||
return DiagnosticResult::singleResult($label, $status);
|
||||
}
|
||||
|
||||
private function checkDbAdapters()
|
||||
{
|
||||
$results = array();
|
||||
$adapters = Adapter::getAdapters();
|
||||
|
||||
foreach ($adapters as $adapter => $port) {
|
||||
$label = $adapter . ' ' . $this->translator->translate('Installation_Extension');
|
||||
|
||||
$results[] = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK);
|
||||
}
|
||||
|
||||
if (empty($adapters)) {
|
||||
$label = $this->translator->translate('Installation_SystemCheckDatabaseExtensions');
|
||||
$comment = $this->translator->translate('Installation_SystemCheckDatabaseHelp');
|
||||
|
||||
$result = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_ERROR, $comment);
|
||||
$result->setLongErrorMessage($this->getLongErrorMessage());
|
||||
|
||||
$results[] = $result;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function getLongErrorMessage()
|
||||
{
|
||||
$message = '<p>';
|
||||
|
||||
if (SettingsServer::isWindows()) {
|
||||
$message .= $this->translator->translate(
|
||||
'Installation_SystemCheckWinPdoAndMysqliHelp',
|
||||
array('<br /><br /><code>extension=php_mysqli.dll</code><br /><code>extension=php_pdo.dll</code><br /><code>extension=php_pdo_mysql.dll</code><br />')
|
||||
);
|
||||
} else {
|
||||
$message .= $this->translator->translate(
|
||||
'Installation_SystemCheckPdoAndMysqliHelp',
|
||||
array(
|
||||
'<br /><br /><code>--with-mysqli</code><br /><code>--with-pdo-mysql</code><br /><br />',
|
||||
'<br /><br /><code>extension=mysqli.so</code><br /><code>extension=pdo.so</code><br /><code>extension=pdo_mysql.so</code><br />'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$message .= $this->translator->translate('Installation_RestartWebServer') . '<br/><br/>';
|
||||
$message .= $this->translator->translate('Installation_SystemCheckPhpPdoAndMysqli', array(
|
||||
'<a style="color:red" href="http://php.net/pdo">',
|
||||
'</a>',
|
||||
'<a style="color:red" href="http://php.net/mysqli">',
|
||||
'</a>',
|
||||
));
|
||||
$message .= '</p>';
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Db;
|
||||
use Piwik\MetricsFormatter;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\SettingsPiwik;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* 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::isPiwikInstalled()) {
|
||||
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;
|
||||
$pretty = MetricsFormatter::getPrettySizeFromBytes($maxPacketBytes['Value'], 'M');
|
||||
$configured = str_replace(array(' M', ' M'), 'MB', $pretty);
|
||||
$comment = Piwik::translate('Diagnostics_MysqlMaxPacketSizeWarning', array('64MB', $configured));
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, $status, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Db;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check if Piwik is connected with database through ssl.
|
||||
*/
|
||||
class DbOverSSLCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$enable_ssl = Config::getInstance()->database['enable_ssl'];
|
||||
if (!$enable_ssl) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$label = $this->translator->translate('Installation_SystemCheckDatabaseSSL');
|
||||
|
||||
$cipher = Db::fetchRow("show status like 'Ssl_cipher'");
|
||||
if(!empty($cipher['Value'])) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $this->translator->translate('Installation_SystemCheckDatabaseSSLCipher') . ': ' . $cipher['Value']));
|
||||
}
|
||||
|
||||
//no cipher, not working
|
||||
$comment = sprintf($this->translator->translate('Installation_SystemCheckDatabaseSSLNotWorking'), "enable_ssl") . "<br />";
|
||||
|
||||
// test ssl support
|
||||
$ssl_support = Db::fetchRow("SHOW VARIABLES LIKE 'have_ssl'");
|
||||
if(!empty($ssl_support['Value'])) {
|
||||
switch ($ssl_support['Value']) {
|
||||
case 'YES':
|
||||
$comment .= $this->translator->translate('Installation_SystemCheckDatabaseSSLOn');
|
||||
break;
|
||||
case 'DISABLED':
|
||||
$comment .= $this->translator->translate('Installation_SystemCheckDatabaseSSLDisabled');
|
||||
break;
|
||||
case 'NO':
|
||||
$comment .= $this->translator->translate('Installation_SystemCheckDatabaseSSLNo');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$comment .= '<br />' . '<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/faq/"> FAQ on matomo.org</a>';
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
/**
|
||||
* Performs a diagnostic on the system or Piwik.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* class MyDiagnostic implements Diagnostic
|
||||
* {
|
||||
* public function execute()
|
||||
* {
|
||||
* $results = array();
|
||||
*
|
||||
* // First check (error)
|
||||
* $status = testSomethingIsOk() ? DiagnosticResult::STATUS_OK : DiagnosticResult::STATUS_ERROR;
|
||||
* $results[] = DiagnosticResult::singleResult('First check', $status);
|
||||
*
|
||||
* // Second check (warning)
|
||||
* $status = testSomethingElseIsOk() ? DiagnosticResult::STATUS_OK : DiagnosticResult::STATUS_WARNING;
|
||||
* $results[] = DiagnosticResult::singleResult('Second check', $status);
|
||||
*
|
||||
* return $results;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Diagnostics are loaded with dependency injection support.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
interface Diagnostic
|
||||
{
|
||||
/**
|
||||
* @return DiagnosticResult[]
|
||||
*/
|
||||
public function execute();
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
/**
|
||||
* The result of a diagnostic.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
class DiagnosticResult
|
||||
{
|
||||
const STATUS_ERROR = 'error';
|
||||
const STATUS_WARNING = 'warning';
|
||||
const STATUS_OK = 'ok';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $label;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $longErrorMessage = '';
|
||||
|
||||
/**
|
||||
* @var DiagnosticResultItem[]
|
||||
*/
|
||||
private $items = array();
|
||||
|
||||
public function __construct($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
* @param string $status
|
||||
* @param string $comment
|
||||
* @return DiagnosticResult
|
||||
*/
|
||||
public static function singleResult($label, $status, $comment = '')
|
||||
{
|
||||
$result = new self($label);
|
||||
$result->addItem(new DiagnosticResultItem($status, $comment));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DiagnosticResultItem[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function addItem(DiagnosticResultItem $item)
|
||||
{
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DiagnosticResultItem[] $items
|
||||
*/
|
||||
public function setItems(array $items)
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLongErrorMessage()
|
||||
{
|
||||
return $this->longErrorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $longErrorMessage
|
||||
*/
|
||||
public function setLongErrorMessage($longErrorMessage)
|
||||
{
|
||||
$this->longErrorMessage = $longErrorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the worst status of the items.
|
||||
*
|
||||
* @return string One of the `STATUS_*` constants.
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$status = self::STATUS_OK;
|
||||
|
||||
foreach ($this->getItems() as $item) {
|
||||
if ($item->getStatus() === self::STATUS_ERROR) {
|
||||
return self::STATUS_ERROR;
|
||||
}
|
||||
|
||||
if ($item->getStatus() === self::STATUS_WARNING) {
|
||||
$status = self::STATUS_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
class DiagnosticResultItem
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* Optional comment about the item.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
public function __construct($status, $comment = '')
|
||||
{
|
||||
$this->status = $status;
|
||||
$this->comment = $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Development;
|
||||
use Piwik\FileIntegrity;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check the files integrity.
|
||||
*/
|
||||
class FileIntegrityCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckFileIntegrity');
|
||||
|
||||
if(Development::isEnabled()) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, '(Disabled in development mode)'));
|
||||
}
|
||||
|
||||
list($ok, $messages) = FileIntegrity::getFileIntegrityInformation();
|
||||
|
||||
if ($ok) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, implode('<br/>', $messages)));
|
||||
}
|
||||
|
||||
$comment = $this->translator->translate('General_FileIntegrityWarning');
|
||||
|
||||
// Keep only the 20 first lines else it becomes unmanageable
|
||||
if (count($messages) > 20) {
|
||||
$messages = array_slice($messages, 0, 20);
|
||||
$messages[] = '...';
|
||||
}
|
||||
$comment .= '<br/><br/><pre style="overflow-x: scroll;max-width: 600px;">'
|
||||
. implode("\n", $messages) . '</pre>';
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Matomo - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\ProxyHttp;
|
||||
use Piwik\Translation\Translator;
|
||||
use Piwik\Url;
|
||||
|
||||
/**
|
||||
* Check that Matomo is configured to force SSL.
|
||||
*/
|
||||
class ForceSSLCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('General_ForcedSSL');
|
||||
|
||||
// special handling during install
|
||||
$isPiwikInstalling = !Config::getInstance()->existsLocalConfig();
|
||||
if ($isPiwikInstalling) {
|
||||
if (ProxyHttp::isHttps()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$message = $this->translator->translate('General_UseSSLInstall', [
|
||||
'<a href="https://'. Url::getCurrentHost() . Url::getCurrentScriptName(false) . Url::getCurrentQueryString() .'">',
|
||||
'</a>'
|
||||
]);
|
||||
return [DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $message)];
|
||||
}
|
||||
|
||||
$forceSSLEnabled = (Config::getInstance()->General['force_ssl'] == 1);
|
||||
|
||||
if ($forceSSLEnabled) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
|
||||
}
|
||||
|
||||
$comment = $this->translator->translate('General_ForceSSLRecommended', ['<code>force_ssl = 1</code>', '<code>General</code>']);
|
||||
|
||||
if (!ProxyHttp::isHttps()) {
|
||||
$comment .= '<br /><br />' . $this->translator->translate('General_NotPossibleWithoutHttps');
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check that the GD extension is installed and the correct version.
|
||||
*/
|
||||
class GdExtensionCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckGDFreeType');
|
||||
|
||||
if (SettingsServer::isGdExtensionEnabled()) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
|
||||
}
|
||||
|
||||
$comment = sprintf(
|
||||
'%s<br />%s',
|
||||
$this->translator->translate('Installation_SystemCheckGDFreeType'),
|
||||
$this->translator->translate('Installation_SystemCheckGDHelp')
|
||||
);
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\Filechecks;
|
||||
use Piwik\Http;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check that Piwik's HTTP client can work correctly.
|
||||
*/
|
||||
class HttpClientCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckOpenURL');
|
||||
|
||||
$httpMethod = Http::getTransportMethod();
|
||||
|
||||
if ($httpMethod) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $httpMethod));
|
||||
}
|
||||
|
||||
$canAutoUpdate = Filechecks::canAutoUpdate();
|
||||
|
||||
$comment = $this->translator->translate('Installation_SystemCheckOpenURLHelp');
|
||||
|
||||
if (! $canAutoUpdate) {
|
||||
$comment .= '<br/>' . $this->translator->translate('Installation_SystemCheckAutoUpdateHelp');
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Db;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check if Piwik can use LOAD DATA INFILE.
|
||||
*/
|
||||
class LoadDataInfileCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$isPiwikInstalling = !Config::getInstance()->existsLocalConfig();
|
||||
if ($isPiwikInstalling) {
|
||||
// Skip the diagnostic if Piwik is being installed
|
||||
return array();
|
||||
}
|
||||
|
||||
$label = $this->translator->translate('Installation_DatabaseAbilities');
|
||||
|
||||
$optionTable = Common::prefixTable('option');
|
||||
$testOptionNames = array('test_system_check1', 'test_system_check2');
|
||||
|
||||
$loadDataInfile = false;
|
||||
$errorMessage = null;
|
||||
try {
|
||||
$loadDataInfile = Db\BatchInsert::tableInsertBatch(
|
||||
$optionTable,
|
||||
array('option_name', 'option_value'),
|
||||
array(
|
||||
array($testOptionNames[0], '1'),
|
||||
array($testOptionNames[1], '2'),
|
||||
),
|
||||
$throwException = true,
|
||||
$charset = 'latin1'
|
||||
);
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = str_replace("\n", "<br/>", $ex->getMessage());
|
||||
}
|
||||
|
||||
// delete the temporary rows that were created
|
||||
Db::exec("DELETE FROM `$optionTable` WHERE option_name IN ('" . implode("','", $testOptionNames) . "')");
|
||||
|
||||
if ($loadDataInfile) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, 'LOAD DATA INFILE'));
|
||||
}
|
||||
|
||||
$comment = sprintf(
|
||||
'LOAD DATA INFILE<br/>%s<br/>%s',
|
||||
$this->translator->translate('Installation_LoadDataInfileUnavailableHelp', array(
|
||||
'LOAD DATA INFILE',
|
||||
'FILE',
|
||||
)),
|
||||
$this->translator->translate('Installation_LoadDataInfileRecommended')
|
||||
);
|
||||
|
||||
if ($errorMessage) {
|
||||
$comment .= sprintf(
|
||||
'<br/><strong>%s:</strong> %s<br/>%s',
|
||||
$this->translator->translate('General_Error'),
|
||||
$errorMessage,
|
||||
'Troubleshooting: <a target="_blank" rel="noreferrer noopener" href="https://matomo.org/faq/troubleshooting/#faq_194">FAQ on matomo.org</a>'
|
||||
);
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check that the memory limit is enough.
|
||||
*/
|
||||
class MemoryLimitCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $minimumMemoryLimit;
|
||||
|
||||
public function __construct(Translator $translator, $minimumMemoryLimit)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->minimumMemoryLimit = $minimumMemoryLimit;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckMemoryLimit');
|
||||
|
||||
SettingsServer::raiseMemoryLimitIfNecessary();
|
||||
|
||||
$memoryLimit = SettingsServer::getMemoryLimitValue();
|
||||
$comment = $memoryLimit . 'M';
|
||||
|
||||
if ($memoryLimit >= $this->minimumMemoryLimit) {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_WARNING;
|
||||
$comment .= sprintf(
|
||||
'<br />%s<br />%s',
|
||||
$this->translator->translate('Installation_SystemCheckMemoryLimitHelp'),
|
||||
$this->translator->translate('Installation_RestartWebServer')
|
||||
);
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, $status, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\Filesystem;
|
||||
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));
|
||||
}
|
||||
|
||||
$isPiwikInstalling = !Config::getInstance()->existsLocalConfig();
|
||||
if ($isPiwikInstalling) {
|
||||
$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));
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\Http;
|
||||
use Piwik\Translation\Translator;
|
||||
use Piwik\Url;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Check that mod_pagespeed is not enabled.
|
||||
*/
|
||||
class PageSpeedCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
public function __construct(Translator $translator, LoggerInterface $logger)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckPageSpeedDisabled');
|
||||
|
||||
if (! $this->isPageSpeedEnabled()) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
|
||||
}
|
||||
|
||||
$comment = $this->translator->translate('Installation_SystemCheckPageSpeedWarning', array(
|
||||
'(eg. Apache, Nginx or IIS)',
|
||||
));
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
|
||||
private function isPageSpeedEnabled()
|
||||
{
|
||||
$url = Url::getCurrentUrlWithoutQueryString() . '?module=Installation&action=getEmptyPageForSystemCheck';
|
||||
|
||||
try {
|
||||
$page = Http::sendHttpRequest($url,
|
||||
$timeout = 1,
|
||||
$userAgent = null,
|
||||
$destinationPath = null,
|
||||
$followDepth = 0,
|
||||
$acceptLanguage = false,
|
||||
$byteRange = false,
|
||||
|
||||
// Return headers
|
||||
$getExtendedInfo = true
|
||||
);
|
||||
} catch(\Exception $e) {
|
||||
$this->logger->info('Unable to test if mod_pagespeed is enabled: the request to {url} failed', array(
|
||||
'url' => $url,
|
||||
));
|
||||
// If the test failed, we assume Page speed is not enabled
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($page['headers']['X-Mod-Pagespeed']) || isset($page['headers']['X-Page-Speed']);
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.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 extensions.
|
||||
*/
|
||||
class PhpExtensionsCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckExtensions');
|
||||
|
||||
$result = new DiagnosticResult($label);
|
||||
$longErrorMessage = '';
|
||||
|
||||
$requiredExtensions = $this->getRequiredExtensions();
|
||||
|
||||
foreach ($requiredExtensions as $extension) {
|
||||
if (! extension_loaded($extension)) {
|
||||
$status = DiagnosticResult::STATUS_ERROR;
|
||||
$comment = $extension . ': ' . $this->translator->translate('Installation_RestartWebServer');
|
||||
$longErrorMessage .= '<p>' . $this->getHelpMessage($extension) . '</p>';
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
$comment = $extension;
|
||||
}
|
||||
|
||||
$result->addItem(new DiagnosticResultItem($status, $comment));
|
||||
}
|
||||
|
||||
$result->setLongErrorMessage($longErrorMessage);
|
||||
|
||||
return array($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getRequiredExtensions()
|
||||
{
|
||||
$requiredExtensions = array(
|
||||
'zlib',
|
||||
'SPL',
|
||||
'iconv',
|
||||
'json',
|
||||
'mbstring',
|
||||
'Reflection',
|
||||
);
|
||||
|
||||
return $requiredExtensions;
|
||||
}
|
||||
|
||||
private function getHelpMessage($missingExtension)
|
||||
{
|
||||
$messages = array(
|
||||
'zlib' => 'Installation_SystemCheckZlibHelp',
|
||||
'SPL' => 'Installation_SystemCheckSplHelp',
|
||||
'iconv' => 'Installation_SystemCheckIconvHelp',
|
||||
'json' => 'Installation_SystemCheckWarnJsonHelp',
|
||||
'mbstring' => 'Installation_SystemCheckMbstringHelp',
|
||||
'Reflection' => 'Required extension that is built in PHP, see http://www.php.net/manual/en/book.reflection.php',
|
||||
);
|
||||
|
||||
return $this->translator->translate($messages[$missingExtension]);
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.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 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',
|
||||
'create_function',
|
||||
'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',
|
||||
'create_function' => 'Installation_SystemCheckCreateFunctionHelp',
|
||||
'eval' => 'Installation_SystemCheckEvalHelp',
|
||||
'hash' => 'Installation_SystemCheckHashHelp',
|
||||
'gzcompress' => 'Installation_SystemCheckGzcompressHelp',
|
||||
'gzuncompress' => 'Installation_SystemCheckGzuncompressHelp',
|
||||
'pack' => 'Installation_SystemCheckPackHelp',
|
||||
);
|
||||
|
||||
return $this->translator->translate($messages[$missingFunction]);
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.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 some PHP INI settings.
|
||||
*/
|
||||
class PhpSettingsCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckSettings');
|
||||
|
||||
$result = new DiagnosticResult($label);
|
||||
|
||||
foreach ($this->getRequiredSettings() as $setting) {
|
||||
if (!$setting->check()) {
|
||||
$status = $setting->getErrorResult();
|
||||
$comment = sprintf(
|
||||
'%s <br/><br/><em>%s</em><br/><em>%s</em><br/>',
|
||||
$setting,
|
||||
$this->translator->translate('Installation_SystemCheckPhpSetting', array($setting)),
|
||||
$this->translator->translate('Installation_RestartWebServer')
|
||||
);
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
$comment = $setting;
|
||||
}
|
||||
|
||||
$result->addItem(new DiagnosticResultItem($status, $comment));
|
||||
}
|
||||
|
||||
return array($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequiredPhpSetting[]
|
||||
*/
|
||||
private function getRequiredSettings()
|
||||
{
|
||||
$requiredSettings[] = new RequiredPhpSetting('session.auto_start', 0);
|
||||
|
||||
$maxExecutionTime = new RequiredPhpSetting('max_execution_time', 0);
|
||||
$maxExecutionTime->addRequiredValue(30, '>=');
|
||||
$maxExecutionTime->setErrorResult(DiagnosticResult::STATUS_WARNING);
|
||||
$requiredSettings[] = $maxExecutionTime;
|
||||
|
||||
if ($this->isPhpVersionAtLeast56() && ! defined("HHVM_VERSION") && !$this->isPhpVersionAtLeast70()) {
|
||||
// always_populate_raw_post_data must be -1
|
||||
// removed in PHP 7
|
||||
$requiredSettings[] = new RequiredPhpSetting('always_populate_raw_post_data', -1);
|
||||
}
|
||||
|
||||
return $requiredSettings;
|
||||
}
|
||||
|
||||
private function isPhpVersionAtLeast56()
|
||||
{
|
||||
return version_compare(PHP_VERSION, '5.6', '>=');
|
||||
}
|
||||
|
||||
private function isPhpVersionAtLeast70()
|
||||
{
|
||||
return version_compare(PHP_VERSION, '7.0.0-dev', '>=');
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.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 version.
|
||||
*/
|
||||
class PhpVersionCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
global $piwik_minimumPHPVersion;
|
||||
|
||||
$actualVersion = PHP_VERSION;
|
||||
|
||||
$label = sprintf(
|
||||
'%s >= %s',
|
||||
$this->translator->translate('Installation_SystemCheckPhp'),
|
||||
$piwik_minimumPHPVersion
|
||||
);
|
||||
|
||||
if ($this->isPhpVersionValid($piwik_minimumPHPVersion, $actualVersion)) {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
$comment = $actualVersion;
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_ERROR;
|
||||
$comment = sprintf(
|
||||
'%s: %s',
|
||||
$this->translator->translate('General_Error'),
|
||||
$this->translator->translate('General_Required', array($label))
|
||||
);
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, $status, $comment));
|
||||
}
|
||||
|
||||
private function isPhpVersionValid($requiredVersion, $actualVersion)
|
||||
{
|
||||
return version_compare($requiredVersion, $actualVersion) <= 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.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 extensions that are not required but recommended.
|
||||
*/
|
||||
class RecommendedExtensionsCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckOtherExtensions');
|
||||
|
||||
$result = new DiagnosticResult($label);
|
||||
|
||||
$loadedExtensions = @get_loaded_extensions();
|
||||
$loadedExtensions = array_map(function ($extension) {
|
||||
return strtolower($extension);
|
||||
}, $loadedExtensions);
|
||||
|
||||
foreach ($this->getRecommendedExtensions() as $extension) {
|
||||
if (! in_array(strtolower($extension), $loadedExtensions)) {
|
||||
$status = DiagnosticResult::STATUS_WARNING;
|
||||
$comment = $extension . '<br/>' . $this->getHelpMessage($extension);
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
$comment = $extension;
|
||||
}
|
||||
|
||||
$result->addItem(new DiagnosticResultItem($status, $comment));
|
||||
}
|
||||
|
||||
return array($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getRecommendedExtensions()
|
||||
{
|
||||
return array(
|
||||
'json',
|
||||
'libxml',
|
||||
'dom',
|
||||
'SimpleXML',
|
||||
);
|
||||
}
|
||||
|
||||
private function getHelpMessage($missingExtension)
|
||||
{
|
||||
$messages = array(
|
||||
'json' => 'Installation_SystemCheckWarnJsonHelp',
|
||||
'libxml' => 'Installation_SystemCheckWarnLibXmlHelp',
|
||||
'dom' => 'Installation_SystemCheckWarnDomHelp',
|
||||
'SimpleXML' => 'Installation_SystemCheckWarnSimpleXMLHelp',
|
||||
);
|
||||
|
||||
return $this->translator->translate($messages[$missingExtension]);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.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 functions that are not required but recommended.
|
||||
*/
|
||||
class RecommendedFunctionsCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckOtherFunctions');
|
||||
|
||||
$result = new DiagnosticResult($label);
|
||||
|
||||
foreach ($this->getRecommendedFunctions() as $function) {
|
||||
if (! PhpFunctionsCheck::functionExists($function)) {
|
||||
$status = DiagnosticResult::STATUS_WARNING;
|
||||
$comment = $function . '<br/>' . $this->getHelpMessage($function);
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
$comment = $function;
|
||||
}
|
||||
|
||||
$result->addItem(new DiagnosticResultItem($status, $comment));
|
||||
}
|
||||
|
||||
return array($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getRecommendedFunctions()
|
||||
{
|
||||
return array(
|
||||
'shell_exec',
|
||||
'set_time_limit',
|
||||
'mail',
|
||||
'parse_ini_file',
|
||||
'glob',
|
||||
'gzopen',
|
||||
'md5_file',
|
||||
);
|
||||
}
|
||||
|
||||
private function getHelpMessage($function)
|
||||
{
|
||||
$messages = array(
|
||||
'shell_exec' => 'Installation_SystemCheckFunctionHelp',
|
||||
'set_time_limit' => 'Installation_SystemCheckTimeLimitHelp',
|
||||
'mail' => 'Installation_SystemCheckMailHelp',
|
||||
'parse_ini_file' => 'Installation_SystemCheckParseIniFileHelp',
|
||||
'glob' => 'Installation_SystemCheckGlobHelp',
|
||||
'gzopen' => 'Installation_SystemCheckZlibHelp',
|
||||
);
|
||||
|
||||
return $this->translator->translate($messages[$function]);
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
class RequiredPhpSetting
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
private $setting;
|
||||
|
||||
/** @var array */
|
||||
private $requiredValues;
|
||||
|
||||
/** @var string */
|
||||
private $errorResult = DiagnosticResult::STATUS_ERROR;
|
||||
|
||||
/**
|
||||
* @param string $setting
|
||||
* @param int $requiredValue
|
||||
* @param string $operator
|
||||
*/
|
||||
public function __construct($setting, $requiredValue, $operator = '=')
|
||||
{
|
||||
$this->setting = $setting;
|
||||
$this->addRequiredValue($requiredValue, $operator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $requiredValue
|
||||
* @param string $operator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addRequiredValue($requiredValue, $operator)
|
||||
{
|
||||
if(!is_int($requiredValue)){
|
||||
throw new \InvalidArgumentException('Required value must be an integer.');
|
||||
}
|
||||
|
||||
$this->requiredValues[] = array(
|
||||
'requiredValue' => $requiredValue,
|
||||
'operator' => $operator,
|
||||
'isValid' => null,
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $errorResult
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setErrorResult($errorResult)
|
||||
{
|
||||
if ($errorResult !== DiagnosticResult::STATUS_WARNING && $errorResult !== DiagnosticResult::STATUS_ERROR) {
|
||||
throw new \InvalidArgumentException('Error result must be either DiagnosticResult::STATUS_WARNING or DiagnosticResult::STATUS_ERROR.');
|
||||
}
|
||||
|
||||
$this->errorResult = $errorResult;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorResult()
|
||||
{
|
||||
return $this->errorResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks required values against php.ini value.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$currentValue = (int) ini_get($this->setting);
|
||||
|
||||
$return = false;
|
||||
foreach($this->requiredValues as $key => $requiredValue){
|
||||
$this->requiredValues[$key]['isValid'] = version_compare($currentValue, $requiredValue['requiredValue'], $requiredValue['operator']);
|
||||
|
||||
if($this->requiredValues[$key]['isValid']){
|
||||
$return = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$checks = array();
|
||||
foreach($this->requiredValues as $requiredValue){
|
||||
$checks[] = $requiredValue['operator'] . ' ' . $requiredValue['requiredValue'];
|
||||
}
|
||||
|
||||
return $this->setting . ' ' . implode(' OR ', $checks);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check that the PHP timezone setting is set.
|
||||
*/
|
||||
class TimezoneCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('SitesManager_Timezone');
|
||||
|
||||
if (SettingsServer::isTimezoneSupportEnabled()) {
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK));
|
||||
}
|
||||
|
||||
$comment = sprintf(
|
||||
'%s<br />%s.',
|
||||
$this->translator->translate('SitesManager_AdvancedTimezoneSupportNotFound'),
|
||||
'<a href="http://php.net/manual/en/datetime.installation.php" rel="noreferrer noopener" target="_blank">Timezone PHP documentation</a>'
|
||||
);
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check that the tracker is working correctly.
|
||||
*/
|
||||
class TrackerCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckTracker');
|
||||
|
||||
$trackerStatus = Common::getRequestVar('trackerStatus', 0, 'int');
|
||||
|
||||
if ($trackerStatus == 0) {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
$comment = '';
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_WARNING;
|
||||
$comment = sprintf(
|
||||
'%s<br />%s<br />%s',
|
||||
$trackerStatus,
|
||||
$this->translator->translate('Installation_SystemCheckTrackerHelp'),
|
||||
$this->translator->translate('Installation_RestartWebServer')
|
||||
);
|
||||
}
|
||||
|
||||
return array(DiagnosticResult::singleResult($label, $status, $comment));
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics\Diagnostic;
|
||||
|
||||
use Piwik\DbHelper;
|
||||
use Piwik\Filechecks;
|
||||
use Piwik\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Check the permissions for some directories.
|
||||
*/
|
||||
class WriteAccessCheck implements Diagnostic
|
||||
{
|
||||
/**
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* Path to the temp directory.
|
||||
* @var string
|
||||
*/
|
||||
private $tmpPath;
|
||||
|
||||
/**
|
||||
* @param Translator $translator
|
||||
* @param string $tmpPath Path to the temp directory.
|
||||
*/
|
||||
public function __construct(Translator $translator, $tmpPath)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->tmpPath = $tmpPath;
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$label = $this->translator->translate('Installation_SystemCheckWriteDirs');
|
||||
|
||||
$result = new DiagnosticResult($label);
|
||||
|
||||
$directories = Filechecks::checkDirectoriesWritable($this->getDirectories());
|
||||
|
||||
$error = false;
|
||||
foreach ($directories as $directory => $isWritable) {
|
||||
if ($isWritable) {
|
||||
$status = DiagnosticResult::STATUS_OK;
|
||||
} else {
|
||||
$status = DiagnosticResult::STATUS_ERROR;
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$result->addItem(new DiagnosticResultItem($status, $directory));
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$longErrorMessage = $this->translator->translate('Installation_SystemCheckWriteDirsHelp');
|
||||
$longErrorMessage .= '<ul>';
|
||||
foreach ($directories as $directory => $isWritable) {
|
||||
if (! $isWritable) {
|
||||
$longErrorMessage .= sprintf('<li><pre>chmod a+w %s</pre></li>', $directory);
|
||||
}
|
||||
}
|
||||
$longErrorMessage .= '</ul>';
|
||||
$result->setLongErrorMessage($longErrorMessage);
|
||||
}
|
||||
|
||||
return array($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getDirectories()
|
||||
{
|
||||
$directoriesToCheck = array(
|
||||
$this->tmpPath,
|
||||
$this->tmpPath . '/assets/',
|
||||
$this->tmpPath . '/cache/',
|
||||
$this->tmpPath . '/climulti/',
|
||||
$this->tmpPath . '/latest/',
|
||||
$this->tmpPath . '/logs/',
|
||||
$this->tmpPath . '/sessions/',
|
||||
$this->tmpPath . '/tcpdf/',
|
||||
$this->tmpPath . '/templates_c/',
|
||||
);
|
||||
|
||||
if (! DbHelper::isInstalled()) {
|
||||
// at install, need /config to be writable (so we can create config.ini.php)
|
||||
$directoriesToCheck[] = '/config/';
|
||||
}
|
||||
|
||||
return $directoriesToCheck;
|
||||
}
|
||||
}
|
118
msd2/tracking/piwik/plugins/Diagnostics/DiagnosticReport.php
Normal file
118
msd2/tracking/piwik/plugins/Diagnostics/DiagnosticReport.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics;
|
||||
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
||||
|
||||
/**
|
||||
* A diagnostic report contains all the results of all the diagnostics.
|
||||
*/
|
||||
class DiagnosticReport
|
||||
{
|
||||
/**
|
||||
* @var DiagnosticResult[]
|
||||
*/
|
||||
private $mandatoryDiagnosticResults;
|
||||
|
||||
/**
|
||||
* @var DiagnosticResult[]
|
||||
*/
|
||||
private $optionalDiagnosticResults;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $errorCount = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $warningCount = 0;
|
||||
|
||||
/**
|
||||
* @param DiagnosticResult[] $mandatoryDiagnosticResults
|
||||
* @param DiagnosticResult[] $optionalDiagnosticResults
|
||||
*/
|
||||
public function __construct(array $mandatoryDiagnosticResults, array $optionalDiagnosticResults)
|
||||
{
|
||||
$this->mandatoryDiagnosticResults = $mandatoryDiagnosticResults;
|
||||
$this->optionalDiagnosticResults = $optionalDiagnosticResults;
|
||||
|
||||
$this->computeErrorAndWarningCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasErrors()
|
||||
{
|
||||
return $this->getErrorCount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasWarnings()
|
||||
{
|
||||
return $this->getWarningCount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getErrorCount()
|
||||
{
|
||||
return $this->errorCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWarningCount()
|
||||
{
|
||||
return $this->warningCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DiagnosticResult[]
|
||||
*/
|
||||
public function getAllResults()
|
||||
{
|
||||
return array_merge($this->mandatoryDiagnosticResults, $this->optionalDiagnosticResults);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DiagnosticResult[]
|
||||
*/
|
||||
public function getMandatoryDiagnosticResults()
|
||||
{
|
||||
return $this->mandatoryDiagnosticResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DiagnosticResult[]
|
||||
*/
|
||||
public function getOptionalDiagnosticResults()
|
||||
{
|
||||
return $this->optionalDiagnosticResults;
|
||||
}
|
||||
|
||||
private function computeErrorAndWarningCount()
|
||||
{
|
||||
foreach ($this->getAllResults() as $result) {
|
||||
switch ($result->getStatus()) {
|
||||
case DiagnosticResult::STATUS_ERROR:
|
||||
$this->errorCount++;
|
||||
break;
|
||||
case DiagnosticResult::STATUS_WARNING:
|
||||
$this->warningCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Plugins\Diagnostics;
|
||||
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\Diagnostic;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\DiagnosticResult;
|
||||
|
||||
/**
|
||||
* Runs the Piwik diagnostics.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
class DiagnosticService
|
||||
{
|
||||
/**
|
||||
* @var Diagnostic[]
|
||||
*/
|
||||
private $mandatoryDiagnostics;
|
||||
|
||||
/**
|
||||
* @var Diagnostic[]
|
||||
*/
|
||||
private $optionalDiagnostics;
|
||||
|
||||
/**
|
||||
* @param Diagnostic[] $mandatoryDiagnostics
|
||||
* @param Diagnostic[] $optionalDiagnostics
|
||||
* @param Diagnostic[] $disabledDiagnostics
|
||||
*/
|
||||
public function __construct(array $mandatoryDiagnostics, array $optionalDiagnostics, array $disabledDiagnostics)
|
||||
{
|
||||
$this->mandatoryDiagnostics = $this->removeDisabledDiagnostics($mandatoryDiagnostics, $disabledDiagnostics);
|
||||
$this->optionalDiagnostics = $this->removeDisabledDiagnostics($optionalDiagnostics, $disabledDiagnostics);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DiagnosticReport
|
||||
*/
|
||||
public function runDiagnostics()
|
||||
{
|
||||
return new DiagnosticReport(
|
||||
$this->run($this->mandatoryDiagnostics),
|
||||
$this->run($this->optionalDiagnostics)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Diagnostic[] $diagnostics
|
||||
* @return DiagnosticResult[]
|
||||
*/
|
||||
private function run(array $diagnostics)
|
||||
{
|
||||
$results = array();
|
||||
|
||||
foreach ($diagnostics as $diagnostic) {
|
||||
$results = array_merge($results, $diagnostic->execute());
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function removeDisabledDiagnostics(array $diagnostics, array $disabledDiagnostics)
|
||||
{
|
||||
return array_filter($diagnostics, function (Diagnostic $diagnostic) use ($disabledDiagnostics) {
|
||||
return ! in_array($diagnostic, $disabledDiagnostics, true);
|
||||
});
|
||||
}
|
||||
}
|
65
msd2/tracking/piwik/plugins/Diagnostics/Diagnostics.php
Normal file
65
msd2/tracking/piwik/plugins/Diagnostics/Diagnostics.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics;
|
||||
|
||||
use Piwik\ArchiveProcessor\Rules;
|
||||
use Piwik\Notification;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin;
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\CronArchivingLastRunCheck;
|
||||
use Piwik\View;
|
||||
|
||||
class Diagnostics extends Plugin
|
||||
{
|
||||
const NO_DATA_ARCHIVING_NOT_RUN_NOTIFICATION_ID = 'DiagnosticsNoDataArchivingNotRun';
|
||||
|
||||
/**
|
||||
* @see Piwik\Plugin::registerEvents
|
||||
*/
|
||||
public function registerEvents()
|
||||
{
|
||||
return array(
|
||||
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
|
||||
'Visualization.onNoData' => ['function' => 'onNoData', 'before' => true],
|
||||
);
|
||||
}
|
||||
|
||||
public function getStylesheetFiles(&$stylesheets)
|
||||
{
|
||||
$stylesheets[] = "plugins/Diagnostics/stylesheets/configfile.less";
|
||||
}
|
||||
|
||||
public function onNoData(View $dataTableView)
|
||||
{
|
||||
if (!Piwik::isUserHasSomeAdminAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Rules::isBrowserTriggerEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$lastSuccessfulRun = CronArchivingLastRunCheck::getTimeSinceLastSuccessfulRun();
|
||||
if ($lastSuccessfulRun > CronArchivingLastRunCheck::SECONDS_IN_DAY) {
|
||||
$content = Piwik::translate('Diagnostics_NoDataForReportArchivingNotRun', [
|
||||
'<a href="https://matomo.org/docs/setup-auto-archiving/" target="_blank" rel="noreferrer noopener">',
|
||||
'</a>',
|
||||
]);
|
||||
|
||||
$notification = new Notification($content);
|
||||
$notification->priority = Notification::PRIORITY_HIGH;
|
||||
$notification->context = Notification::CONTEXT_INFO;
|
||||
$notification->flags = Notification::FLAG_NO_CLEAR;
|
||||
$notification->type = Notification::TYPE_TRANSIENT;
|
||||
$notification->raw = true;
|
||||
|
||||
$dataTableView->notifications[self::NO_DATA_ARCHIVING_NOT_RUN_NOTIFICATION_ID] = $notification;
|
||||
}
|
||||
}
|
||||
}
|
28
msd2/tracking/piwik/plugins/Diagnostics/Menu.php
Normal file
28
msd2/tracking/piwik/plugins/Diagnostics/Menu.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\Diagnostics;
|
||||
|
||||
use Piwik\Menu\MenuAdmin;
|
||||
use Piwik\Piwik;
|
||||
|
||||
/**
|
||||
* This class allows you to add, remove or rename menu items.
|
||||
* To configure a menu (such as Admin Menu, Reporting Menu, User Menu...) simply call the corresponding methods as
|
||||
* described in the API-Reference http://developer.piwik.org/api-reference/Piwik/Menu/MenuAbstract
|
||||
*/
|
||||
class Menu extends \Piwik\Plugin\Menu
|
||||
{
|
||||
public function configureAdminMenu(MenuAdmin $menu)
|
||||
{
|
||||
if (Piwik::hasUserSuperUserAccess()) {
|
||||
$menu->addDiagnosticItem('Diagnostics_ConfigFileTitle', $this->urlForAction('configfile'), $orderId = 30);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
45
msd2/tracking/piwik/plugins/Diagnostics/config/config.php
Normal file
45
msd2/tracking/piwik/plugins/Diagnostics/config/config.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Piwik\Plugins\Diagnostics\Diagnostic\CronArchivingLastRunCheck;
|
||||
|
||||
return array(
|
||||
// Diagnostics for everything that is required for Piwik to run
|
||||
'diagnostics.required' => array(
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\PhpVersionCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\DbAdapterCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\PhpExtensionsCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\PhpFunctionsCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\PhpSettingsCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\WriteAccessCheck'),
|
||||
),
|
||||
// Diagnostics for recommended features
|
||||
'diagnostics.optional' => array(
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\FileIntegrityCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\TrackerCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\MemoryLimitCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\TimezoneCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\HttpClientCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\PageSpeedCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\GdExtensionCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\RecommendedExtensionsCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\RecommendedFunctionsCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\NfsDiskCheck'),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\CronArchivingCheck'),
|
||||
DI\get(CronArchivingLastRunCheck::class),
|
||||
DI\get('Piwik\Plugins\Diagnostics\Diagnostic\LoadDataInfileCheck'),
|
||||
Di\get('Piwik\Plugins\Diagnostics\Diagnostic\DbOverSSLCheck'),
|
||||
Di\get('Piwik\Plugins\Diagnostics\Diagnostic\DbMaxPacket'),
|
||||
Di\get('Piwik\Plugins\Diagnostics\Diagnostic\ForceSSLCheck'),
|
||||
),
|
||||
// Allows other plugins to disable diagnostics that were previously registered
|
||||
'diagnostics.disabled' => array(),
|
||||
|
||||
'Piwik\Plugins\Diagnostics\DiagnosticService' => DI\object()
|
||||
->constructor(DI\get('diagnostics.required'), DI\get('diagnostics.optional'), DI\get('diagnostics.disabled')),
|
||||
|
||||
'Piwik\Plugins\Diagnostics\Diagnostic\MemoryLimitCheck' => DI\object()
|
||||
->constructorParameter('minimumMemoryLimit', DI\get('ini.General.minimum_memory_limit')),
|
||||
|
||||
'Piwik\Plugins\Diagnostics\Diagnostic\WriteAccessCheck' => DI\object()
|
||||
->constructorParameter('tmpPath', DI\get('path.tmp')),
|
||||
);
|
7
msd2/tracking/piwik/plugins/Diagnostics/lang/ar.json
Normal file
7
msd2/tracking/piwik/plugins/Diagnostics/lang/ar.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "ملف الضبط",
|
||||
"HideUnchanged": "يمكنك %1$s إخفاء كل القيم التي لم تتغير %2$s إذا كنت ترغب مشاهدة القيم المتغيرة فقط .",
|
||||
"Sections": "الأقسام"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/cs.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/cs.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Konfigurační soubor",
|
||||
"ConfigFileIntroduction": "Zde vidíte konfiguraci pro Matomo. Pokud Matomo běží v prostředí s vyvažováním zátěže, můžou se zobrazovaná data lišit podle toho, ze kterého serveru jsou natažena. Řádky se změněnou barvou pozadí značí změněné konfigurační hodnoty, které jsou specifikovány například v %1$s souboru.",
|
||||
"HideUnchanged": "Pokud chcete vidět pouze změněné hodnoty, můžete %1$snezměněné hodnoty skrýt%2$s.",
|
||||
"Sections": "Sekce"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/da.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/da.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Konfigurationsfil",
|
||||
"MysqlMaxPacketSize": "Maks. pakkestørrelse",
|
||||
"MysqlMaxPacketSizeWarning": "Det anbefales at sætte 'max_allowed_packet' i din MySQL-konfiguration til mindst %1$s. Den nuværende værdi er %2$s.",
|
||||
"Sections": "Sektioner"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/de.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/de.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Konfigurationsdatei",
|
||||
"MysqlMaxPacketSize": "Maximale Packetgröße",
|
||||
"MysqlMaxPacketSizeWarning": "Es wird empfohlen die 'max_allowed_packet' Größe in Ihrer MySQL Datenbank auf mindestens %1$s zu erhöhen. Aktuell ist %2$s eingestellt.",
|
||||
"ConfigFileIntroduction": "Hier können Sie die Matomo Konfiguration einsehen. Sollten Sie Matomo auf lastverteilten Systemen einsetzen könnte diese Seite unterschiedlich sein, abhängig vom Server auf dem die Seite geladen wurde. Zeilen mit einer anderen Hintergrundfarbe sind geänderte Konfigurationswerte, die beispielsweise in der Datei %1$s definiert wurden.",
|
||||
"HideUnchanged": "Falls Sie nur die geänderten Werte einsehen möchten, können Sie %1$salle unveränderten Werte ausblenden%2$s.",
|
||||
"Sections": "Sektionen",
|
||||
"CronArchivingLastRunCheck": "Letzter erfolgreicher Abschluss der Archivierung",
|
||||
"CronArchivingHasNotRun": "Die Archivierung wurde noch nicht erfolgreich abgeschlossen.",
|
||||
"CronArchivingHasNotRunInAWhile": "Die Archivierung ist zuletzt am %1$serfolgreich gelaufen, also vor %2$s.",
|
||||
"CronArchivingRunDetails": "Bitte überprüfen Sie, ob Sie einen Crontab eingerichtet haben, der den %1$s Konsolenbefehl aufruft, und ob Sie einen %2$s konfiguriert haben, um Fehler per E-Mail zu erhalten, wenn die Archivierung fehlschlägt. Sie können auch versuchen, den Konsolenbefehl auszuführen, um Ihre Berichte manuell zu archivieren: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "Der Archivierungsprozess wurde vor %1$serfolgreich abgeschlossen.",
|
||||
"BrowserTriggeredArchivingEnabled": "Für eine optimale Leistung und ein schnelles Matomo wird dringend empfohlen, einen Crontab einzurichten, um Ihre Berichte automatisch zu archivieren und das Auslösen durch den Browser in den Matomo-Einstellungen zu deaktivieren. %1$sErfahren Sie mehr.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "Die Archivierung Ihrer Berichte wurde in letzter Zeit nicht durchgeführt, %1$serfahren Sie mehr darüber, wie Sie Ihre Berichte erzeugen können.%2$s"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/el.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/el.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Αρχείο ρυθμίσεων",
|
||||
"MysqlMaxPacketSize": "Μέγιστο Μέγεθος Πακέτου",
|
||||
"MysqlMaxPacketSizeWarning": "Προτείνεται να ρυθμίσετε το μέγεθος του 'max_allowed_packet' στη βάση MySQL τουλάχιστον σε %1$s. Αυτή τη στιγμή είναι ρυθμισμένο σε %2$s.",
|
||||
"ConfigFileIntroduction": "Εδώ μπορείτε να δείτε τις ρυθμίσεις του Matomo. Αν εκτελείτε το Matomo σε περιβάλλον με διαμοιρασμό φόρτου, η σελίδα μπορεί να είναι διαφορετική, ανάλογα από ποιο διακομιστή έχει φορτωθεί. Οι γραμμές με διαφορετικό χρώμα υποβάθρου είναι οι τιμές ρυθμίσεων που άλλαξαν για παράδειγμα στο αρχείο ρυθμίσεων %1$s.",
|
||||
"HideUnchanged": "Αν επιθυμείτε να δείτε μόνο τις τιμές που άλλαξαν, μπορείτε να %1$sαποκρύψετε τις τιμές που παρέμειναν ίδιες%2$s.",
|
||||
"Sections": "Τμήματα",
|
||||
"CronArchivingLastRunCheck": "Τελευταία Επιτυχής Εκτέλεση Αρχειοθέτησης",
|
||||
"CronArchivingHasNotRun": "Η αρχειοθέτηση δεν εκτελέστηκε ακόμη με επιτυχία.",
|
||||
"CronArchivingHasNotRunInAWhile": "Η αρχειοθέτηση εκτελέστηκε με επιτυχία στις %1$s που είναι πριν από %2$s.",
|
||||
"CronArchivingRunDetails": "Παρακαλούμε ελέγξτε ότι έχετε ορίσει ένα crontab που καλεί την %1$sεντολή από κονσόλα και ότι έχετε παραμετροποιήσει ένα %2$s για να λαμβάνετε τα μηνύματα σφαλμάτων με e-mail αν η αρχειοθέτηση αποτύχει. Μπορείτε επίσης να εκτελέσετε χειροκίνητα την εντολή κονσόλας για να αρχειοθετήσετε τις αναφορές σας: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "Η διαδικασία αρχειοθέτησης ολοκληρώθηκε με επιτυχία πριν από %1$s.",
|
||||
"BrowserTriggeredArchivingEnabled": "Για βέλτιστη απόδοση και ένα γρήγορο Matomo, προτείνεται να παραμετροποιήσετε ένα crontab για την αυτόματη αρχειοθέτηση των αναφορών σας και να απενεργοποιήσετε την εκτέλεση μέσω του προγράμματος περιήγησης στις ρυθμίσεις του Matomo. %1$sΜάθετε περισσότερα.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "Η αρχειοθέτηση των αναφορών σας δεν εκτελέστηκε επιτυχώς. %1$sΜάθετε περισσότερα για το πως να δημιουργείτε τις αναφορές σας.%2$s"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/en.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/en.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Config file",
|
||||
"MysqlMaxPacketSize": "Max Packet Size",
|
||||
"MysqlMaxPacketSizeWarning": "It is recommended to configure a 'max_allowed_packet' size in your MySQL database of at least %1$s. Configured is currently %2$s.",
|
||||
"ConfigFileIntroduction": "Here you can view the Matomo configuration. If you are running Matomo in a load balanced environment the page might be different depending from which server this page is loaded. Rows with a different background color are changed config values that are specified for example in the %1$s file.",
|
||||
"HideUnchanged": "If you want to see only changed values you can %1$shide all unchanged values%2$s.",
|
||||
"Sections": "Sections",
|
||||
"CronArchivingLastRunCheck": "Last Successful Archiving Completion",
|
||||
"CronArchivingHasNotRun": "Archiving has not yet run successfully.",
|
||||
"CronArchivingHasNotRunInAWhile": "Archiving last ran successfully on %1$s which is %2$s ago.",
|
||||
"CronArchivingRunDetails": "Please check that you have setup a crontab calling the %1$s console command, and that you have configured a %2$s to receive errors by email if archiving fails. You can also try to run the console command to archive your reports manually: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "The archiving process completed successfully %1$s ago.",
|
||||
"BrowserTriggeredArchivingEnabled": "For optimal performance and a speedy Matomo, it is highly recommended to set up a crontab to automatically archive your reports, and to disable browser triggering in the Matomo settings. %1$sLearn more.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "The archiving of your reports hasn't been executed recently, %1$slearn more about how to generate your reports.%2$s"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/es.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/es.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Archivo de configuración",
|
||||
"MysqlMaxPacketSize": "Tamaño máximo del paquete",
|
||||
"MysqlMaxPacketSizeWarning": "Es recomendable configurar un tamaño de al menos %1$sen 'max_allowed_packet' en su base de datos MySQL. Actualmente está configurada en %2$s.",
|
||||
"ConfigFileIntroduction": "Aquí puede ver la configuración de Matomo. Si está ejecutando Matomo en un ecosistema balanceado puede que la página sea diferente sea por el servidor que la esté cargando. Las files con un color de fondo diferente son valores de configuración modificados que son especificados por ejemplo en el archivo %1$s.",
|
||||
"HideUnchanged": "Si desea ver solo los valores modificados puede %1$socultar todos los valores no modificados%2$s.",
|
||||
"Sections": "Secciones",
|
||||
"CronArchivingLastRunCheck": "Ultimo archivado completado exitosamente.",
|
||||
"CronArchivingHasNotRun": "El archivado aún no se ha ejecutado correctamente.",
|
||||
"CronArchivingHasNotRunInAWhile": "El último archivado se ejecutó exitosamente en %1$s el cual es %2$s.",
|
||||
"CronArchivingRunDetails": "Verifique que haya configurado un crontab llamando al comando %1$s de la consola, y que haya configurado un %2$s para recibir los errores por correo electrónico si falla el archivado. También puede intentar ejecutar el comando de la consola para archivar sus informes manualmente: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "El proceso de archivado se completó exitosamente hace %1$s.",
|
||||
"BrowserTriggeredArchivingEnabled": "Para un rendimiento óptimo y un Matomo veloz, se recomienda configurar un crontab para archivar automáticamente sus informes y deshabilitar la activación del navegador en la configuración de Matomo. %1$sAprender más.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "El archivado de sus informes no se han ejecutado ultimamente, %1$ssepa más cómo generar sus informes.%2$s"
|
||||
}
|
||||
}
|
6
msd2/tracking/piwik/plugins/Diagnostics/lang/et.json
Normal file
6
msd2/tracking/piwik/plugins/Diagnostics/lang/et.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Seadistuste fail",
|
||||
"Sections": "Sektsioonid"
|
||||
}
|
||||
}
|
6
msd2/tracking/piwik/plugins/Diagnostics/lang/fi.json
Normal file
6
msd2/tracking/piwik/plugins/Diagnostics/lang/fi.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Asetustiedosto",
|
||||
"Sections": "Osiot"
|
||||
}
|
||||
}
|
10
msd2/tracking/piwik/plugins/Diagnostics/lang/fr.json
Normal file
10
msd2/tracking/piwik/plugins/Diagnostics/lang/fr.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Fichier de configuration",
|
||||
"MysqlMaxPacketSize": "Taille maximale des paquets",
|
||||
"MysqlMaxPacketSizeWarning": "Il est important de configurer une taille 'max_allowed_packet' dans votre base de données MySQL d'au moins %1$s. %2$s configuré en ce moment.",
|
||||
"ConfigFileIntroduction": "Ici vous pouvez visualiser la configuration de Matomo. Si vous exécutez Matomo depuis un environnement où la charge est répartie, la page peut être différente en fonction du serveur depuis lequel la page est chargée. Les lignes avec une couleur de fond différentes représentent les valeurs de configuration modifiées qui sont spécifiées par exemple dans le fichier %1$s.",
|
||||
"HideUnchanged": "Si vous souhaitez afficher uniquement les valeurs modifiées, vous pouvez cliquer sur %1$smasquer toutes les valeurs inchangées%2$s.",
|
||||
"Sections": "Sections"
|
||||
}
|
||||
}
|
6
msd2/tracking/piwik/plugins/Diagnostics/lang/id.json
Normal file
6
msd2/tracking/piwik/plugins/Diagnostics/lang/id.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Berkas konfigurasi",
|
||||
"Sections": "Bagian"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/it.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/it.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "File di configurazione",
|
||||
"MysqlMaxPacketSize": "Dimensione Massima Pacchetto",
|
||||
"MysqlMaxPacketSizeWarning": "Si raccomanda di impostare la dimensione 'max_allowed_packet' nel tuo database MySQL ad almeno %1$s. Quella impostata al momento è %2$s.",
|
||||
"ConfigFileIntroduction": "Qui puoi vedere la configurazione di Matomo. Se Matomo viene eseguito in un ambiente a carico bilanciato, la pagina può apparire diversa a seconda del server da cui essa viene caricata. Righe con un colore di sfondo diverso hanno valori di configurazione diversi specificati per esempio nel file %1$s.",
|
||||
"HideUnchanged": "Se vuoi vedere soltanto i valori cambiati, puoi %1$snascondere tutti quelli che non sono cambiati%2$s.",
|
||||
"Sections": "Sezioni",
|
||||
"CronArchivingLastRunCheck": "Ultima Archiviazione Completata con Successo",
|
||||
"CronArchivingHasNotRun": "L'archiviazione non è ancora stata eseguita con successo.",
|
||||
"CronArchivingHasNotRunInAWhile": "L'ultima archiviazione è stata eseguita con successo il %1$s, cioè %2$s fa.",
|
||||
"CronArchivingRunDetails": "Si prega di verificare di avere impostato un crontab che richiama il comando di console %1$s, e di avere configurato un %2$s per ricevere i messaggi di errore tramite email se l'archiviazione fallisce. Puoi anche provare a eseguire manualmente il comando di console per archiviare i tuoi report: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "Il processo di archiviazione è stato completato con successo %1$s fa.",
|
||||
"BrowserTriggeredArchivingEnabled": "Per delle prestazioni ottimali e un Matomo veloce, è altamente raccomandato di impostare un crontab per archiviare automaticamente i tuoi report, e di disabilitare l'attivazione dal browser nelle impostazioni di Matomo. %1$sLeggi altro.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "L'archiviazione dei tuoi report non è stata eseguita di recente, %1$sleggi di più su come generare i tuoi report.%2$s"
|
||||
}
|
||||
}
|
10
msd2/tracking/piwik/plugins/Diagnostics/lang/ja.json
Normal file
10
msd2/tracking/piwik/plugins/Diagnostics/lang/ja.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "コンフィグファイル",
|
||||
"MysqlMaxPacketSize": "最大パケットサイズ",
|
||||
"MysqlMaxPacketSizeWarning": "少なくとも %1$s の MySQL データベースに 'max_allowed_packet' サイズを設定することをお勧めします。 設定は現在 %2$s です。",
|
||||
"ConfigFileIntroduction": "ここでは Matomo の設定を見ることができます。ロードバランスされた環境で Matomo を実行している場合、このページがロードされているサーバーによってページが異なる場合があります。背景色が異なる行は、たとえば %1$s ファイルで指定された設定値が変更されます。",
|
||||
"HideUnchanged": "変更された値だけを表示する場合は、%1$s変更されていない値をすべて非表示にすることができます。%2$s",
|
||||
"Sections": "セクション"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/nb.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/nb.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Konfigurasjonsfil",
|
||||
"ConfigFileIntroduction": "Her kan du se konfigurasjonen til Matomo. Hvis du kjører Matomo i et lastbalansert servermiljø, kan denne siden se ulik ut avhengig av hvilken server siden lastes fra. Rader med ulik bakgrunnsfarge er endrede konfigurasjonsverdier som er spesifisert i for eksempel %1$s.",
|
||||
"HideUnchanged": "Hvis du kun vil se de endrede verdiene, kan du %1$sskjule alle uendrede verdier%2$s.",
|
||||
"Sections": "Seksjoner"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/nl.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/nl.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Configuratiebestand",
|
||||
"ConfigFileIntroduction": "Hier kan je de Matomo configuratie bekijken. Wanneer de Matomo omgeving in load balanced omgeving draait kan het overzicht anders zijn wanneer deze vanaf een andere server wordt opgestart. Rijen met andere achtergrond kleur zijn gewijzigde configuratie waarden die bijvoorbeeld speciaal zijn voor in het %1$s bestand.",
|
||||
"HideUnchanged": "Wanneer je alleen de gewijzigde waarden wil zien %1$sverberg alle ongewijzigde waarden%2$s.",
|
||||
"Sections": "Secties"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/pl.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/pl.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Plik konfiguracyjny",
|
||||
"ConfigFileIntroduction": "Tu możesz zobaczyć konfigurację Matomo'a. Jeśli Matomo został uruchomiony na środowisku z load balancer'em strona może wyświetlać różne dane w zależności od serwera, który ją wygenerował. Rzędy z innym kolorem tła zawierają inne dane niż te zawarte w przykładowym %1$s pliku.",
|
||||
"HideUnchanged": "W celu zobaczenia tylko zmienionych wartości %1$sukryj niezmienione wartości%2$s.",
|
||||
"Sections": "Sekcje"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/pt-br.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/pt-br.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Arquivo de configuração",
|
||||
"ConfigFileIntroduction": "Aqui você pode ver a configuração do Matomo. Se você estiver executando Matomo em um ambiente de balanceamento de carga a página pode ser diferente, dependendo de qual servidor esta página é carregada. Linhas com uma cor de fundo diferente são alterados os valores de configuração que são especificadas por exemplo, no arquivo %1$s.",
|
||||
"HideUnchanged": "Se você quiser ver apenas valores alterados você pode %1$socultar todos os valores inalterados%2$s.",
|
||||
"Sections": "Seções"
|
||||
}
|
||||
}
|
10
msd2/tracking/piwik/plugins/Diagnostics/lang/pt.json
Normal file
10
msd2/tracking/piwik/plugins/Diagnostics/lang/pt.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Ficheiro de configuração",
|
||||
"MysqlMaxPacketSize": "Tamanho máximo do pacote",
|
||||
"MysqlMaxPacketSizeWarning": "É recomendável a configuração de um tamanho de pacote 'max_allowed_packet' na sua base de dados MySQL de, pelo menos, %1$s. Atualmente está configurado como %2$s.",
|
||||
"ConfigFileIntroduction": "Aqui, pode consultar a configuração do Matomo. Se estiver a executar o Matomo no ambiente distribuído, a páginas pode ser diferente dependendo do servidor a partir do qual esta página foi carregada. As linhas com uma cor de fundo diferente são valores de configuração alterados e diferentes dos especificados como exemplo, no ficheiro %1$s.",
|
||||
"HideUnchanged": "Se quiser ver apenas os valores alterados, pode %1$socultar todos os valores inalterados%2$s.",
|
||||
"Sections": "Secções"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/ro.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/ro.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Fişier configurări",
|
||||
"ConfigFileIntroduction": "Aici poţi vedea configurările Matomo. Dacă rulezi Matomo într-un mediu cu load-balancing pagina poate fi diferită în funcţie de serverul de pe care se încarcă. Liniile cu o culoare de fundal diferită valorile de configurare modificate specificate, de exemplu în fişierul %1$s",
|
||||
"HideUnchanged": "Dacă vrei să vezi doar valorile modificate poţi ascunde %1$s toate valorile neschimbate %2$s.",
|
||||
"Sections": "Secţiuni"
|
||||
}
|
||||
}
|
10
msd2/tracking/piwik/plugins/Diagnostics/lang/ru.json
Normal file
10
msd2/tracking/piwik/plugins/Diagnostics/lang/ru.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Файл конфигурации",
|
||||
"MysqlMaxPacketSize": "Максимальный размер пакета",
|
||||
"MysqlMaxPacketSizeWarning": "Для вашей базы данных рекомендовано установить размер 'max_allowed_packet' минимум %1$s. Сейчас он - %2$s.",
|
||||
"ConfigFileIntroduction": "Здесь вы можете посмотреть конфигурацию Matomo. Если вы запускаете Matomo в среде с балансированной нагрузкой, страница может быть различной в зависимости от сервера, с которого эта страница загружается. Ряды с разными цветами фона - это измененные значения конфигурации, которые описаны, например в файле %1$s.",
|
||||
"HideUnchanged": "Если вы хотите видеть только измененные значения, вы можете %1$sспрятать все неизмененные значения%2$s.",
|
||||
"Sections": "Разделы"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/sq.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/sq.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Kartelë formësimesh",
|
||||
"MysqlMaxPacketSize": "Maksimum Madhësie Paketi",
|
||||
"MysqlMaxPacketSizeWarning": "Këshillohet të formësoni te baza juaj e të dhënave MySQL një madhësi 'max_allowed_packet' size të paktën %1$s. Formësimi i tanishëm për të është %2$s.",
|
||||
"ConfigFileIntroduction": "Këtu mund të shihni formësimin e Matomo-s. Nëse Matomo-n e xhironi në një mjedis me ngarkesë të balancuar, faqja mund të jetë ndryshe, varet se nga cili shërbyes ngarkohet faqja. Rreshtat me një ngjyrë tjetër për sfondin përfaqësojnë vlera formësimi që janë dhënë si shembull te kartela %1$s.",
|
||||
"HideUnchanged": "Nëse dëshironi të shihni vetëm vlerat e ndryshuara, mund të %1$sfshihni krejt vlerat e pandryshuara%2$s.",
|
||||
"Sections": "Ndarje",
|
||||
"CronArchivingLastRunCheck": "Plotësimi i Fundit i Suksesshëm i Arkivimit",
|
||||
"CronArchivingHasNotRun": "Arkivimi ende s’është xhiruar me sukses.",
|
||||
"CronArchivingHasNotRunInAWhile": "Hera e fundit që arkivimi u bë me sukses qe më %1$s, që do të thotë %2$s më parë.",
|
||||
"CronArchivingRunDetails": "Ju lutemi, shihni të keni ujdisur një akt crontab për vënie në punë tëurdhrit %1$s të konsolës, dhe se keni formësuar një %2$s për të marrë me email njoftime gabimesh, nëse arkivimi dështon. Mund të provoni edhe të xhironi urdhër konsole për arkivim dorazi të raporteve tuaja: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "Procesi i arkivimit u plotësua me sukses %1$s më parë.",
|
||||
"BrowserTriggeredArchivingEnabled": "Për funksionimin më të mirë dhe një Matomo të shpejtë, këshillohet me forcë të ujdisni një akt crontab për arkivim automatik të raporteve tuaja, dhe të çaktivizoni që nga rregullimet e Matomo-s ngacmimin e shfletuesit. %1$sMësoni më tepër.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "Arkivimi i raporteve tuaja nuk ka ngjarë tani së fundi, %1$smësoni më tepër se si të prodhoni raportet tuaja.%2$s"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/sr.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/sr.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Datoteka sa podešavanjima",
|
||||
"ConfigFileIntroduction": "Ovde možete da vidite Matomo podešavanja. Ukoliko vaš Matomo radi u okruženju sa balansiranjem opterećenja, stranica možda izgčeda drugačije u zavisnosti sa kog servera je učitana. Redovi sa drugačijom bojom pozadine sadrže vrednosti koje su izmenjene u odnosu na primer iz fajla %1$s.",
|
||||
"HideUnchanged": "Ukoliko želite da vidite samo izmenjene vrednosti, možete da %1$ssakrijete neizmenjene vrednosti%2$s.",
|
||||
"Sections": "Sekcije"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/sv.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/sv.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Konfigurationsfil",
|
||||
"ConfigFileIntroduction": "Här kan du se Matomos konfiguration. Om du kör Matomo i en lastbalanserad miljö så kan sidan se annorlunda ut beroende på vilken server som sidan laddas ifrån. De rader som har en annorlunda bakgrundsfärg är ändrade konfigurationsvärden som specificeras i exempelvis filen %1$s.",
|
||||
"HideUnchanged": "Om du vill se endast ändrade värden så kan du %1$s dölja alla oförändrade värden%2$s.",
|
||||
"Sections": "Sektioner"
|
||||
}
|
||||
}
|
17
msd2/tracking/piwik/plugins/Diagnostics/lang/tr.json
Normal file
17
msd2/tracking/piwik/plugins/Diagnostics/lang/tr.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Ayar Dosyası",
|
||||
"MysqlMaxPacketSize": "En Büyük Paket Boyutu",
|
||||
"MysqlMaxPacketSizeWarning": "MySQL veritabanınız için 'max_allowed_packet' değerini en az %1$s olarak ayarlamanız önerilir. Şu anda %2$s olarak ayarlanmış.",
|
||||
"ConfigFileIntroduction": "Matomo ayarları bu bölümde görülebilir. Matomo yazılımını yük dengeleme yapılan bir ortamda kullanıyorsanız sayfadaki bilgiler yüklendiği sunucuya göre değişiklik gösterebilir. %1$s dosyasındaki örnek dosyada belirtilen değerlere göre değiştirilmiş olan satırlar farklı art alan renginde görüntülenir.",
|
||||
"HideUnchanged": "Yalnız değiştirilmiş değerlerin görüntülenmesi için %1$sdeğiştirilmemiş tüm değerleri gizleyin%2$s.",
|
||||
"Sections": "Bölümler",
|
||||
"CronArchivingLastRunCheck": "Son Tamamlanmış Arşivleme İşlemi",
|
||||
"CronArchivingHasNotRun": "Henüz tamamlanmış bir arşivleme işlemi yapılmamış.",
|
||||
"CronArchivingHasNotRunInAWhile": "Son tamamlanmış arşivleme işlemi %1$s tarihinde %2$s önce yapılmış.",
|
||||
"CronArchivingRunDetails": "Lütfen %1$s komutunu yürütecek bir zamanlanmış görev (cron) ve arşivleme işleminde sorun çıkarsa hata iletilerini e-posta ile almak için bir %2$s yapılandırmış olduğunuzdan emin olun. Raporlarınızı el ile arşivlemek için komut satırından şu komutu el ile yürütmeyi de deneyebilirsiniz: %3$s",
|
||||
"CronArchivingRanSuccessfullyXAgo": "Arşivleme işlemi %1$s önce tamamlanmış.",
|
||||
"BrowserTriggeredArchivingEnabled": "En iyi başarım ve daha hızlı bir Matomo kullanımı için raporlarınızı otomatik olarak arşivleyecek bir zamanlanmış görev yapılandırmanız ve Matomo ayarlarından web tarayıcı ile tetiklenen arşivleme özelliğini devre dışı bırakmanız önemle önerilir. %1$sAyrıntılı bilgi almak için buraya tıklayabilirsiniz.%2$s",
|
||||
"NoDataForReportArchivingNotRun": "Yakın zamanda raporlarınız arşivlenmemiş. %1$sRaporlarınızı üretmek hakkında ayrıntılı bilgi almak için buraya tıklayabilirsiniz.%2$s"
|
||||
}
|
||||
}
|
8
msd2/tracking/piwik/plugins/Diagnostics/lang/uk.json
Normal file
8
msd2/tracking/piwik/plugins/Diagnostics/lang/uk.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Файл конфігурації",
|
||||
"ConfigFileIntroduction": "Тут ви можете подивитися конфігурацію Matomo. Якщо ви запускаєте Matomo в середовищі зі збалансованим навантаження, сторінка може бути різною в залежності від сервера, з якого ця сторінка завантажується. Ряди з різними кольорами фону - це змінені значення конфігурації, які описані, наприклад в файлі %1$s.",
|
||||
"HideUnchanged": "Якщо ви хочете бачити тільки змінені значення, ви можете %1$sзаховати всі незмінені значення%2$s.",
|
||||
"Sections": "Розділи"
|
||||
}
|
||||
}
|
10
msd2/tracking/piwik/plugins/Diagnostics/lang/vi.json
Normal file
10
msd2/tracking/piwik/plugins/Diagnostics/lang/vi.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "Tập tin cấu hình",
|
||||
"MysqlMaxPacketSize": "Kích thước gói tối đa",
|
||||
"MysqlMaxPacketSizeWarning": "Bạn nên định cấu hình kích thước 'max_allowed_packet' trong cơ sở dữ liệu MySQL của bạn ít nhất %1$s. Cấu hình hiện tại là %2$s.",
|
||||
"ConfigFileIntroduction": "Tại đây bạn có thể xem cấu hình Matomo. Nếu bạn đang chạy Matomo trong môi trường cân bằng tải, trang có thể khác tùy thuộc vào máy chủ mà trang này được tải. Các hàng có màu nền khác nhau được thay đổi giá trị cấu hình được chỉ định ví dụ trong tệp %1$s.",
|
||||
"HideUnchanged": "Nếu bạn chỉ muốn xem các giá trị đã được thay đổi, bạn có thể %1$sẩn tất cả các giá trị không thay đổi%2$s.",
|
||||
"Sections": "Phân mục"
|
||||
}
|
||||
}
|
7
msd2/tracking/piwik/plugins/Diagnostics/lang/zh-cn.json
Normal file
7
msd2/tracking/piwik/plugins/Diagnostics/lang/zh-cn.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "配置文件",
|
||||
"HideUnchanged": "如果只想看改变的值可以%1$s,隐藏所有为改变的值%2$s。",
|
||||
"Sections": "部分"
|
||||
}
|
||||
}
|
10
msd2/tracking/piwik/plugins/Diagnostics/lang/zh-tw.json
Normal file
10
msd2/tracking/piwik/plugins/Diagnostics/lang/zh-tw.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Diagnostics": {
|
||||
"ConfigFileTitle": "設定檔",
|
||||
"MysqlMaxPacketSize": "最大封包大小",
|
||||
"MysqlMaxPacketSizeWarning": "推薦將 MySQL 資料庫中的「max_allowed_packet」值至少設定為 %1$s。目前的設定為 %2$s。",
|
||||
"ConfigFileIntroduction": "你可以在這裡查看 Matomo 的配置。如果你在負載平衡的環境中執行 Matomo,頁面可能會根據不同伺服器顯示不同的內容。不同背景顏色的列是和 %1$s 範例檔案中所指定的值不同的設定值。",
|
||||
"HideUnchanged": "如果你只想看有變更過值的設定,你可以%1$s隱藏未修改的值%2$s。",
|
||||
"Sections": "分區"
|
||||
}
|
||||
}
|
3
msd2/tracking/piwik/plugins/Diagnostics/plugin.json
Normal file
3
msd2/tracking/piwik/plugins/Diagnostics/plugin.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"description": "Performs diagnostics to check that Matomo is installed and runs correctly."
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
.diagnostics.configfile {
|
||||
.custom-value {
|
||||
background-color: @theme-color-background-tinyContrast;
|
||||
}
|
||||
|
||||
.defaultValue {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
td.name {
|
||||
max-width: 330px;
|
||||
word-wrap: break-word;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
td.value {
|
||||
word-wrap: break-word;
|
||||
max-width: 400px;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
td.description {
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
{% extends 'admin.twig' %}
|
||||
|
||||
{% macro humanReadableValue(value) %}
|
||||
{% if value is false %}
|
||||
false
|
||||
{% elseif value is true %}
|
||||
true
|
||||
{% elseif value is null %}
|
||||
{% elseif value is emptyString %}
|
||||
''
|
||||
{% else %}
|
||||
{{ value|join(', ') }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<div piwik-content-block
|
||||
content-title="{{ 'Diagnostics_ConfigFileTitle'|translate|e('html_attr') }}" feature="true">
|
||||
<p>
|
||||
{{ 'Diagnostics_ConfigFileIntroduction'|translate('<code>"config/config.ini.php"</code>')|raw }}
|
||||
{{ 'Diagnostics_HideUnchanged'|translate('<a ng-click="hideGlobalConfigValues=!hideGlobalConfigValues">', '</a>')|raw }}
|
||||
|
||||
<h3>{{ 'Diagnostics_Sections'|translate }}</h3>
|
||||
{% for category, values in allConfigValues %}
|
||||
<a href="#{{ category|e('html_attr') }}">{{ category }}</a><br />
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
<table class="diagnostics configfile" piwik-content-table>
|
||||
<tbody>
|
||||
{% for category, configValues in allConfigValues %}
|
||||
<tr><td colspan="3"><a name="{{ category|e('html_attr') }}"></a><h3>{{ category }}</h3></td></tr>
|
||||
|
||||
{% for key, configEntry in configValues %}
|
||||
<tr {% if configEntry.isCustomValue %}class="custom-value"{% else %}ng-hide="hideGlobalConfigValues"{% endif %}>
|
||||
<td class="name">{{ key }}{% if configEntry.value is iterable %}[]{% endif %}</td>
|
||||
<td class="value">
|
||||
{{ _self.humanReadableValue(configEntry.value) }}
|
||||
</td>
|
||||
<td class="description">
|
||||
{{ configEntry.description }}
|
||||
|
||||
{% if (configEntry.isCustomValue or configEntry.value is null) and configEntry.defaultValue is not null %}
|
||||
{% if configEntry.description %}<br />{% endif %}
|
||||
|
||||
{{ 'General_Default'|translate }}:
|
||||
<span class="defaultValue">{{ _self.humanReadableValue(configEntry.defaultValue) }}<span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user