diff --git a/console b/console index deb024f4052..d34c0a42dca 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 e7dd79fd043..7e58e234042 100644 --- a/core/testMinimumPhpVersion.php +++ b/core/testMinimumPhpVersion.php @@ -46,9 +46,7 @@ To enjoy Piwik, you need remove
ini_setfrom your
disable_functionsdirective in php.ini, and restart your webserver."; } - $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" . "
curl -sS https://getcomposer.org/installer | php \n\n php composer.phar install\n\n"; if (DIRECTORY_SEPARATOR === '\\' /* ::isWindows() */) { diff --git a/index.php b/index.php index d4882019a42..892050501c0 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,9 @@ 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 f6bda855216..5fb7671d8b2 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 6d6f69dca52..5a7d9250355 100644 --- a/tests/PHPUnit/bootstrap.php +++ b/tests/PHPUnit/bootstrap.php @@ -40,7 +40,9 @@ 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 );