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
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/Tracker/Visit/ReferrerSpamFilter.php6
-rw-r--r--core/bootstrap.php15
-rw-r--r--core/testMinimumPhpVersion.php3
3 files changed, 11 insertions, 13 deletions
diff --git a/core/Tracker/Visit/ReferrerSpamFilter.php b/core/Tracker/Visit/ReferrerSpamFilter.php
index 142546eaa2..534f713395 100644
--- a/core/Tracker/Visit/ReferrerSpamFilter.php
+++ b/core/Tracker/Visit/ReferrerSpamFilter.php
@@ -68,11 +68,7 @@ class ReferrerSpamFilter
$this->spammerList = unserialize($list);
} else {
// Fallback to reading the bundled list
- if (file_exists(PIWIK_INCLUDE_PATH . '/vendor/piwik/referrer-spam-blacklist/spammers.txt')) {
- $file = PIWIK_INCLUDE_PATH . '/vendor/piwik/referrer-spam-blacklist/spammers.txt'; // Piwik is the main project
- } else {
- $file = PIWIK_INCLUDE_PATH . '/../../piwik/referrer-spam-blacklist/spammers.txt'; // Piwik is installed as a dependency
- }
+ $file = PIWIK_VENDOR_PATH . '/piwik/referrer-spam-blacklist/spammers.txt';
$this->spammerList = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
}
diff --git a/core/bootstrap.php b/core/bootstrap.php
index ddb23c6016..44103a54b9 100644
--- a/core/bootstrap.php
+++ b/core/bootstrap.php
@@ -14,6 +14,14 @@ error_reporting(E_ALL | E_NOTICE);
@ini_set('xdebug.show_exception_trace', 0);
@ini_set('magic_quotes_runtime', 0);
+if (!defined('PIWIK_VENDOR_PATH')) {
+ if (is_dir(PIWIK_INCLUDE_PATH . '/vendor')) {
+ define('PIWIK_VENDOR_PATH', PIWIK_INCLUDE_PATH . '/vendor'); // Piwik is the main project
+ } else {
+ define('PIWIK_VENDOR_PATH', PIWIK_INCLUDE_PATH . '/../..'); // Piwik is installed as a Composer dependency
+ }
+}
+
// NOTE: the code above must be PHP 4 compatible
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
@@ -25,12 +33,7 @@ disableEaccelerator();
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
// Composer autoloader
-if (file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')) {
- $path = PIWIK_INCLUDE_PATH . '/vendor/autoload.php'; // Piwik is the main project
-} else {
- $path = PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency
-}
-require_once $path;
+require_once PIWIK_VENDOR_PATH . '/autoload.php';
/**
* Eaccelerator does not support closures and is known to be not comptabile with Piwik. Therefore we are disabling
diff --git a/core/testMinimumPhpVersion.php b/core/testMinimumPhpVersion.php
index e1fc84f5d3..f0c9bbd4cb 100644
--- a/core/testMinimumPhpVersion.php
+++ b/core/testMinimumPhpVersion.php
@@ -50,8 +50,7 @@ if ($minimumPhpInvalid) {
To use Piwik, please ask your web host to install php5-json or install it yourself, for example on debian system: <code>sudo apt-get install php5-json</code>. <br/>Then restart your webserver and refresh this page.</p>";
}
- if (!file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')
- && !file_exists(PIWIK_INCLUDE_PATH . '/../../autoload.php')) {
+ if (!file_exists(PIWIK_VENDOR_PATH . '/autoload.php')) {
$composerInstall = "In the piwik directory, run in the command line the following (eg. via ssh): \n\n"
. "<pre> curl -sS https://getcomposer.org/installer | php \n\n php composer.phar install\n\n</pre> ";
if (DIRECTORY_SEPARATOR === '\\' /* ::isWindows() */) {