Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/global.ini.php2
-rw-r--r--core/IP.php7
-rw-r--r--core/Plugin/Controller.php5
-rw-r--r--core/Plugin/Manager.php20
-rw-r--r--core/Tracker.php3
-rw-r--r--core/Url.php8
-rw-r--r--index.php1
-rwxr-xr-xtests/PHPUnit/IntegrationTestCase.php8
-rw-r--r--tests/PHPUnit/proxy/index.php4
9 files changed, 44 insertions, 14 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index cd7ec40906..4b71c6fd77 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -470,7 +470,7 @@ password = ; Proxy password: optional; if specified, username is mandatory
[log]
; possible values for log: screen, database, file
-log_writers[] = file
+log_writers[] = screen
; log level, everything logged w/ this level or one of greater severity
; will be logged. everything else will be ignored. possible values are:
diff --git a/core/IP.php b/core/IP.php
index 6e8e1d13e6..0b3d152ee7 100644
--- a/core/IP.php
+++ b/core/IP.php
@@ -368,10 +368,15 @@ class IP
*/
public static function getNonProxyIpFromHeader($default, $proxyHeaders)
{
- $proxyIps = @Config::getInstance()->General['proxy_ips'];
+ $proxyIps = array();
+ $config = Config::getInstance()->General;
+ if(isset($config['proxy_ips'])) {
+ $proxyIps = $config['proxy_ips'];
+ }
if (!is_array($proxyIps)) {
$proxyIps = array();
}
+
$proxyIps[] = $default;
// examine proxy headers
diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php
index a8125e47de..f16d4c694b 100644
--- a/core/Plugin/Controller.php
+++ b/core/Plugin/Controller.php
@@ -456,8 +456,9 @@ abstract class Controller
$view->logoSVG = \Piwik\Plugins\API\API::getInstance()->getSVGLogoUrl();
$view->hasSVGLogo = \Piwik\Plugins\API\API::getInstance()->hasSVGLogo();
- $view->enableFrames = PiwikConfig::getInstance()->General['enable_framed_pages']
- || @PiwikConfig::getInstance()->General['enable_framed_logins'];
+ $general = PiwikConfig::getInstance()->General;
+ $view->enableFrames = $general['enable_framed_pages']
+ || (isset($general['enable_framed_logins']) && $general['enable_framed_logins']);
if (!$view->enableFrames) {
$view->setXFrameOptions('sameorigin');
}
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php
index 0bf348460a..0591dd0ff8 100644
--- a/core/Plugin/Manager.php
+++ b/core/Plugin/Manager.php
@@ -564,6 +564,26 @@ class Manager extends Singleton
/**
+ * Returns the name of all plugins found in this Piwik instance
+ * (including those not enabled)
+ *
+ * Used in tests
+ *
+ * @return array
+ */
+ public static function getAllPluginsNames()
+ {
+ $pluginsToLoad = array_merge(
+ PiwikConfig::getInstance()->Plugins['Plugins'],
+ self::getInstance()->readPluginsDirectory(),
+ self::getInstance()->getCorePluginsDisabledByDefault()
+ );
+ $pluginsToLoad = array_values(array_unique($pluginsToLoad));
+ return $pluginsToLoad;
+ }
+
+
+ /**
* Loads the plugin filename and instantiates the plugin with the given name, eg. UserCountry
* Do NOT give the class name ie. UserCountry, but give the plugin name ie. UserCountry
*
diff --git a/core/Tracker.php b/core/Tracker.php
index f4618ee3b3..8ea8d2b669 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -806,7 +806,8 @@ class Tracker
self::setPluginsNotToLoad($pluginsDisabled);
// we load 'DevicesDetection' in tests only (disabled by default)
- self::setPluginsToLoad(array('DevicesDetection'));
+ $allPluginsFound = \Piwik\Plugin\Manager::getInstance()->getAllPluginsNames();
+ self::setPluginsToLoad( $allPluginsFound );
}
/**
diff --git a/core/Url.php b/core/Url.php
index 6a4f4a4ad7..ff38faff9c 100644
--- a/core/Url.php
+++ b/core/Url.php
@@ -289,7 +289,13 @@ class Url
*/
static public function getCurrentHost($default = 'unknown', $checkTrustedHost = true)
{
- $hostHeaders = @Config::getInstance()->General['proxy_host_headers'];
+ $hostHeaders = array();
+
+ $config = Config::getInstance()->General;
+ if(isset($config['proxy_host_headers'])) {
+ $hostHeaders = $config['proxy_host_headers'];
+ }
+
if (!is_array($hostHeaders)) {
$hostHeaders = array();
}
diff --git a/index.php b/index.php
index ba74026dce..c669fe7f6a 100644
--- a/index.php
+++ b/index.php
@@ -50,7 +50,6 @@ if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) {
ExceptionHandler::setUp();
}
-
if (!defined('PIWIK_ENABLE_DISPATCH') || PIWIK_ENABLE_DISPATCH) {
$controller = FrontController::getInstance();
$controller->init();
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index 3157367bc4..f590a6a9e2 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -101,13 +101,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
public static function loadAllPlugins()
{
$pluginsManager = \Piwik\Plugin\Manager::getInstance();
-
- $pluginsToLoad = array_merge(
- Config::getInstance()->Plugins['Plugins'],
- $pluginsManager->readPluginsDirectory(),
- $pluginsManager->getCorePluginsDisabledByDefault()
- );
- $pluginsToLoad = array_values(array_unique($pluginsToLoad));
+ $pluginsToLoad = $pluginsManager->getAllPluginsNames();
$pluginsManager->loadPlugins($pluginsToLoad);
}
diff --git a/tests/PHPUnit/proxy/index.php b/tests/PHPUnit/proxy/index.php
index 59dbab1ec5..c0c0c6166d 100644
--- a/tests/PHPUnit/proxy/index.php
+++ b/tests/PHPUnit/proxy/index.php
@@ -22,6 +22,10 @@ define('PIWIK_ENABLE_DISPATCH', false);
include PIWIK_INCLUDE_PATH . '/index.php';
$controller = \Piwik\FrontController::getInstance();
+
+// Load all plugins that are found so UI tests are really testing real world use case
+\Piwik\Config::getInstance()->Plugins['Plugins'] = \Piwik\Plugin\Manager::getInstance()->getAllPluginsNames();
+
$controller->init();
$controller->dispatch();