blob: 07b8942da5ec206e89b454cb5efe46b529e85736 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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" href="?module=Proxy&action=redirect&url=http://piwik.org/faq/"> FAQ on piwik.org</a>';
return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
}
}
|