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:
authorChristian Raue <christian.raue@gmail.com>2013-12-22 14:15:50 +0400
committerChristian Raue <christian.raue@gmail.com>2013-12-22 14:15:50 +0400
commit1ba62b546d0cf54fac121428f7f3e603f1509a2f (patch)
tree5932640a0bf56ddbfbc69b0ac48adb37fc564969
parentd9126d4398b090e6f07728b3eec1b3c0a6060ea2 (diff)
allow using Piwik when installed as a Composer dependency
-rwxr-xr-xconsole4
-rw-r--r--core/testMinimumPhpVersion.php4
-rw-r--r--index.php4
-rw-r--r--misc/translationTool.sh4
-rw-r--r--tests/PHPUnit/bootstrap.php4
5 files changed, 13 insertions, 7 deletions
diff --git a/console b/console
index deb024f405..d34c0a42dc 100755
--- a/console
+++ b/console
@@ -5,7 +5,9 @@ define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
-require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php';
+require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')
+ ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project
+ : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
diff --git a/core/testMinimumPhpVersion.php b/core/testMinimumPhpVersion.php
index e7dd79fd04..7e58e23404 100644
--- a/core/testMinimumPhpVersion.php
+++ b/core/testMinimumPhpVersion.php
@@ -46,9 +46,7 @@ if ($minimumPhpInvalid) {
To enjoy Piwik, you need remove <pre>ini_set</pre> from your <pre>disable_functions</pre> directive in php.ini, and restart your webserver.</p>";
}
- $autoloadPath = '/vendor/autoload.php';
- $autoloader = PIWIK_INCLUDE_PATH . $autoloadPath;
- if (!file_exists($autoloader)) {
+ if (!file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php') && !file_exists(PIWIK_INCLUDE_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() */) {
diff --git a/index.php b/index.php
index d4882019a4..892050501c 100644
--- a/index.php
+++ b/index.php
@@ -38,7 +38,9 @@ require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
session_cache_limiter('nocache');
@date_default_timezone_set('UTC');
-require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php';
+require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')
+ ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project
+ : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
if(!defined('PIWIK_PRINT_ERROR_BACKTRACE')) {
diff --git a/misc/translationTool.sh b/misc/translationTool.sh
index f6bda85521..5fb7671d8b 100644
--- a/misc/translationTool.sh
+++ b/misc/translationTool.sh
@@ -290,7 +290,9 @@ function setTranslationsForLanguage() {
require_once PIWIK_INCLUDE_PATH . "/libs/upgradephp/upgrade.php";
require_once PIWIK_INCLUDE_PATH . "/core/Loader.php";
- require_once PIWIK_INCLUDE_PATH . "/vendor/autoload.php";
+ require_once file_exists(PIWIK_INCLUDE_PATH . "/vendor/autoload.php")
+ ? PIWIK_INCLUDE_PATH . "/vendor/autoload.php" // Piwik is the main project
+ : PIWIK_INCLUDE_PATH . "/../../autoload.php"; // Piwik is installed as a dependency
use Piwik\Translate\Writer;
use Piwik\Translate\Validate\NoScripts;
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index 6d6f69dca5..5a7d925035 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -40,7 +40,9 @@ require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/UITest.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockPiwikOption.php';
-require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php';
+require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')
+ ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project
+ : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency
\Piwik\Profiler::setupProfilerXHProf( $mainRun = true );