From 494d826ab4874ea85d55ce7e47b432abe35a4a5d Mon Sep 17 00:00:00 2001 From: mattab <matthieu.aubry@gmail.com> Date: Mon, 30 Sep 2013 19:11:35 +1300 Subject: [PATCH] Refs #4133 --- core/AssetManager.php | 8 +++-- core/CacheFile.php | 4 ++- core/Config.php | 32 +++++++++++++++++++ core/Db/BatchInsert.php | 2 ++ core/ExceptionHandler.php | 8 ++--- core/Filechecks.php | 3 ++ core/Filesystem.php | 2 +- core/Log.php | 3 +- core/Piwik.php | 2 -- core/ProxyHttp.php | 3 +- core/ReportRenderer.php | 2 ++ core/Session.php | 5 ++- core/SettingsPiwik.php | 26 +++++++++++++++ core/Twig.php | 5 ++- core/functions.php | 3 +- js/index.php | 4 +-- lang/ar.json | 1 - lang/bg.json | 1 - lang/cs.json | 1 - lang/da.json | 1 - lang/de.json | 1 - lang/el.json | 1 - lang/en.json | 1 - lang/es.json | 1 - lang/fa.json | 1 - lang/fr.json | 1 - lang/he.json | 1 - lang/hi.json | 1 - lang/id.json | 1 - lang/it.json | 1 - lang/ja.json | 1 - lang/ko.json | 1 - lang/nl.json | 1 - lang/pt-br.json | 1 - lang/ro.json | 1 - lang/ru.json | 1 - lang/sl.json | 1 - lang/sq.json | 1 - lang/sr.json | 1 - lang/sv.json | 1 - lang/ta.json | 1 - lang/th.json | 1 - lang/tr.json | 1 - lang/zh-cn.json | 1 - piwik.php | 2 ++ plugins/CoreAdminHome/CoreAdminHome.php | 3 +- plugins/CorePluginsAdmin/PluginInstaller.php | 4 +++ plugins/CoreUpdater/Controller.php | 11 +++++-- .../Visualizations/JqplotGraph/Evolution.php | 6 ++-- plugins/DBStats/DBStats.php | 2 +- plugins/ImageGraph/StaticGraph.php | 3 ++ .../templates/getVisitorProfilePopup.twig | 4 +-- plugins/PDFReports/config/tcpdf_config.php | 8 +++-- tests/PHPUnit/Core/LogTest.php | 13 ++++++-- tests/PHPUnit/Core/ServeStaticFileTest.php | 3 +- tests/PHPUnit/UI | 2 +- tests/travis/prepare.sh | 2 +- 57 files changed, 138 insertions(+), 65 deletions(-) diff --git a/core/AssetManager.php b/core/AssetManager.php index b5ae6a6a5f..c3c3101762 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -46,6 +46,8 @@ class AssetManager const CSS_IMPORT_EVENT = "AssetManager.getStylesheetFiles"; const JS_IMPORT_EVENT = "AssetManager.getJsFiles"; const MERGED_FILE_DIR = "tmp/assets/"; + const COMPRESSED_FILE_LOCATION = "/tmp/assets/"; + const CSS_IMPORT_DIRECTIVE = "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n"; const JS_IMPORT_DIRECTIVE = "<script type=\"text/javascript\" src=\"%s\"></script>\n"; const GET_CSS_MODULE_ACTION = "index.php?module=Proxy&action=getCss"; @@ -500,8 +502,9 @@ class AssetManager } // Tries to remove compressed version of the merged file. - // See Piwik::serverStaticFile() for more info on static file compression - $compressedFileLocation = PIWIK_USER_PATH . Piwik::COMPRESSED_FILE_LOCATION . $filename; + // See ProxyHttp::serverStaticFile() for more info on static file compression + $compressedFileLocation = PIWIK_USER_PATH . self::COMPRESSED_FILE_LOCATION . $filename; + $compressedFileLocation = SettingsPiwik::rewriteTmpPathWithHostname($compressedFileLocation); @unlink($compressedFileLocation . ".deflate"); @unlink($compressedFileLocation . ".gz"); @@ -538,6 +541,7 @@ class AssetManager private static function getMergedFileDirectory() { $mergedFileDirectory = PIWIK_USER_PATH . '/' . self::MERGED_FILE_DIR; + $mergedFileDirectory = SettingsPiwik::rewriteTmpPathWithHostname($mergedFileDirectory); if (!is_dir($mergedFileDirectory)) { Filesystem::mkdir($mergedFileDirectory); diff --git a/core/CacheFile.php b/core/CacheFile.php index 139beeaffc..9ee78168f5 100644 --- a/core/CacheFile.php +++ b/core/CacheFile.php @@ -48,7 +48,9 @@ class CacheFile */ public function __construct($directory, $timeToLiveInSeconds = 300) { - $this->cachePath = PIWIK_USER_PATH . '/tmp/cache/' . $directory . '/'; + $cachePath = PIWIK_USER_PATH . '/tmp/cache/' . $directory . '/'; + $this->cachePath = SettingsPiwik::rewriteTmpPathWithHostname($cachePath); + if ($timeToLiveInSeconds < self::MINIMUM_TTL) { $timeToLiveInSeconds = self::MINIMUM_TTL; } diff --git a/core/Config.php b/core/Config.php index d88709379a..c7536ac338 100644 --- a/core/Config.php +++ b/core/Config.php @@ -155,9 +155,41 @@ class Config */ public static function getLocalConfigPath() { + $path = self::getByDomainConfigPath(); + if($path) { + return $path; + } + return PIWIK_USER_PATH . '/config/config.ini.php'; } + public function getConfigHostnameIfSet() + { + if($this->getByDomainConfigPath() === false) { + return false; + } + return $this->getHostname(); + } + + protected static function getByDomainConfigPath() + { + $host = self::getHostname(); + $perHostFilename = $host . '.config.ini.php'; + $pathDomainConfig = PIWIK_USER_PATH . '/config/' . $perHostFilename; + if (Filesystem::isValidFilename($perHostFilename) + && file_exists($pathDomainConfig) + ) { + return $pathDomainConfig; + } + return false; + } + + protected static function getHostname() + { + $host = Url::getHost($checkIfTrusted = false); // Check trusted requires config file which is not ready yet + return $host; + } + /** * Is local configuration file writable? * diff --git a/core/Db/BatchInsert.php b/core/Db/BatchInsert.php index 019cd4d51c..cd339e215e 100644 --- a/core/Db/BatchInsert.php +++ b/core/Db/BatchInsert.php @@ -17,6 +17,7 @@ use Piwik\Config; use Piwik\Db; use Piwik\DbHelper; use Piwik\Piwik; +use Piwik\SettingsPiwik; use Piwik\SettingsServer; class BatchInsert @@ -60,6 +61,7 @@ class BatchInsert public static function tableInsertBatch($tableName, $fields, $values, $throwException = false) { $filePath = PIWIK_USER_PATH . '/' . AssetManager::MERGED_FILE_DIR . $tableName . '-' . Common::generateUniqId() . '.csv'; + $filePath = SettingsPiwik::rewriteTmpPathWithHostname($filePath); if (Db::get()->hasBulkLoader()) { try { diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 081e4601a8..26ecef6a00 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -10,12 +10,8 @@ */ namespace Piwik; -use Piwik\Common; -use Piwik\Piwik; -use Piwik\Plugin; -use Piwik\Log; -use Piwik\FrontController; use Piwik\API\ResponseBuilder; +use Piwik\Plugin; /** * Contains Piwik's uncaught exception handler and log file formatting for exception @@ -62,7 +58,7 @@ class ExceptionHandler } } - public static function exceptionHandler(Exception $exception) + public static function exceptionHandler(\Exception $exception) { Log::error($exception); } diff --git a/core/Filechecks.php b/core/Filechecks.php index 1c15cc5ea8..893e158d62 100644 --- a/core/Filechecks.php +++ b/core/Filechecks.php @@ -40,10 +40,13 @@ class Filechecks { $resultCheck = array(); foreach ($directoriesToCheck as $directoryToCheck) { + if (!preg_match('/^' . preg_quote(PIWIK_USER_PATH, '/') . '/', $directoryToCheck)) { $directoryToCheck = PIWIK_USER_PATH . $directoryToCheck; } + $directoryToCheck = SettingsPiwik::rewriteTmpPathWithHostname($directoryToCheck); + // Create an empty directory $isFile = strpos($directoryToCheck, '.') !== false; if (!$isFile && !file_exists($directoryToCheck)) { diff --git a/core/Filesystem.php b/core/Filesystem.php index 51bdc5fee8..5c7ea6d868 100644 --- a/core/Filesystem.php +++ b/core/Filesystem.php @@ -194,7 +194,7 @@ class Filesystem * @param boolean $deleteRootToo Delete specified top-level directory as well * @param Closure|false $beforeUnlink A closure to execute before unlinking. */ - public static function unlinkRecursive($dir, $deleteRootToo, $beforeUnlink = false) + public static function unlinkRecursive($dir, $deleteRootToo, \Closure $beforeUnlink = null) { if (!$dh = @opendir($dir)) { return; diff --git a/core/Log.php b/core/Log.php index 06755e41de..f3e566c12d 100644 --- a/core/Log.php +++ b/core/Log.php @@ -290,7 +290,8 @@ class Log if (is_dir($logPath)) { $logPath .= '/piwik.log'; } - $this->logToFilePath = $logPath; + + $this->logToFilePath = SettingsPiwik::rewriteTmpPathWithHostname($logPath); } private function createWriterByName($writerName) diff --git a/core/Piwik.php b/core/Piwik.php index 0d33e42a06..4977cb1dad 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -34,8 +34,6 @@ require_once PIWIK_INCLUDE_PATH . '/core/Translate.php'; */ class Piwik { - const COMPRESSED_FILE_LOCATION = '/tmp/assets/'; - /** * Piwik periods * @var array diff --git a/core/ProxyHttp.php b/core/ProxyHttp.php index 5bcde43de1..030443d801 100644 --- a/core/ProxyHttp.php +++ b/core/ProxyHttp.php @@ -91,7 +91,8 @@ class ProxyHttp // optional compression $compressed = false; $encoding = ''; - $compressedFileLocation = PIWIK_USER_PATH . Piwik::COMPRESSED_FILE_LOCATION . basename($file); + $compressedFileLocation = PIWIK_USER_PATH . AssetManager::COMPRESSED_FILE_LOCATION . basename($file); + $compressedFileLocation = SettingsPiwik::rewriteTmpPathWithHostname($compressedFileLocation); $phpOutputCompressionEnabled = ProxyHttp::isPhpOutputCompressed(); if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && !$phpOutputCompressionEnabled) { diff --git a/core/ReportRenderer.php b/core/ReportRenderer.php index 3287a6e97e..18ac8f9c51 100644 --- a/core/ReportRenderer.php +++ b/core/ReportRenderer.php @@ -147,6 +147,8 @@ abstract class ReportRenderer protected static function getOutputPath($filename) { $outputFilename = PIWIK_USER_PATH . '/tmp/assets/' . $filename; + $outputFilename = SettingsPiwik::rewriteTmpPathWithHostname($outputFilename); + @chmod($outputFilename, 0600); @unlink($outputFilename); return $outputFilename; diff --git a/core/Session.php b/core/Session.php index 221c62bac2..5f3c765a7a 100644 --- a/core/Session.php +++ b/core/Session.php @@ -128,9 +128,11 @@ class Session extends Zend_Session we recommend that you <a href='http://piwik.org/faq/how-to-install/#faq_133' target='_blank'>enable database session storage</a>."; } + $pathToSessions = Filechecks::getErrorMessageMissingPermissions(Filesystem::getPathToPiwikRoot() . '/tmp/sessions/'); + $pathToSessions = SettingsPiwik::rewriteTmpPathWithHostname($pathToSessions); $message = sprintf("Error: %s %s %s\n<pre>Debug: the original error was \n%s</pre>", Piwik_Translate('General_ExceptionUnableToStartSession'), - Filechecks::getErrorMessageMissingPermissions(Filesystem::getPathToPiwikRoot() . '/tmp/sessions/'), + $pathToSessions, $enableDbSessions, $e->getMessage() ); @@ -146,6 +148,7 @@ class Session extends Zend_Session */ public static function getSessionsDirectory() { + //tmp return PIWIK_USER_PATH . '/tmp/sessions'; } } diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index 19e9233891..51e7c006a8 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -166,4 +166,30 @@ class SettingsPiwik return $result; } + + /** + * If Piwik uses per-domain config file, also make tmp/ folder per-domain + * @param $path + * @return string + * @throws \Exception + */ + public static function rewriteTmpPathWithHostname($path) + { + $configByHost = Config::getInstance()->getConfigHostnameIfSet(); + if(empty($configByHost)) { + return $path; + } + + $tmp = '/tmp/'; + if(($posTmp = strrpos($path, $tmp)) === false) { + throw new Exception("The path $path was expected to contain the string /tmp/ "); + } + + $tmpToReplace = $tmp . $configByHost . '/'; + + // replace only the latest occurrence (in case path contains twice /tmp) + $path = substr_replace($path, $tmpToReplace, $posTmp, strlen($tmp)); + + return $path; + } } diff --git a/core/Twig.php b/core/Twig.php index 59fabb8a2e..0520d242d7 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -46,11 +46,14 @@ class Twig $chainLoader = new Twig_Loader_Chain(array($loader)); // Create new Twig Environment and set cache dir + $templatesCompiledPath = PIWIK_USER_PATH . '/tmp/templates_c'; + $templatesCompiledPath = SettingsPiwik::rewriteTmpPathWithHostname($templatesCompiledPath); + $this->twig = new Twig_Environment($chainLoader, array( 'debug' => true, // to use {{ dump(var) }} in twig templates 'strict_variables' => true, // throw an exception if variables are invalid - 'cache' => PIWIK_USER_PATH . '/tmp/templates_c', + 'cache' => $templatesCompiledPath, ) ); $this->twig->addExtension(new Twig_Extension_Debug()); diff --git a/core/functions.php b/core/functions.php index c706a17b6a..a34fdca893 100644 --- a/core/functions.php +++ b/core/functions.php @@ -262,8 +262,7 @@ namespace { // Bridge between pre Piwik2 serialized format and namespaced classes // Do not need to define these classes in tracker or archive - if(empty($GLOBALS['PIWIK_TRACKER_MODE']) - && !defined('PIWIK_MODE_ARCHIVE')) { + if(class_exists('\\Piwik\\DataTable\\Row\\DataTableSummaryRow')) { class Piwik_DataTable_Row_DataTableSummary extends \Piwik\DataTable\Row\DataTableSummaryRow { } diff --git a/js/index.php b/js/index.php index 5d8ec0a41b..b47cc5c2f3 100644 --- a/js/index.php +++ b/js/index.php @@ -25,8 +25,8 @@ define('PIWIK_DOCUMENT_ROOT', '..'); define('PIWIK_USER_PATH', '..'); require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; -require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php'; -require_once PIWIK_INCLUDE_PATH . '/core/ProxyHttp.php'; +require_once PIWIK_INCLUDE_PATH . '/core/functions.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; $file = '../piwik.js'; diff --git a/lang/ar.json b/lang/ar.json index 8a72d68625..dc5f43d60a 100644 --- a/lang/ar.json +++ b/lang/ar.json @@ -125,7 +125,6 @@ "LogoNotWriteable": "لاستخدام شعار مخصص، ستØتاج إلى صلاØيات الكتابة على ملÙات الشعار ÙÙŠ مجلد القالب: %s", "LogoUpload": "اختر شعاراً لرÙعه", "LogoUploadDescription": "الرجاء رÙع مل٠بصيغة %sØŒ بدون خلÙيات Ø´ÙاÙØ© بارتÙاع لا يقل عن %s بكسل.", - "MenuCommunity": "المجتمع", "MenuDiagnostic": "التشخيص", "MenuGeneralSettings": "الإعدادات العامة", "MenuManage": "الإدارة", diff --git a/lang/bg.json b/lang/bg.json index 6ba9bec0c3..29a4868f34 100644 --- a/lang/bg.json +++ b/lang/bg.json @@ -108,7 +108,6 @@ "LogoNotWriteable": "За да използвате изработеното лого Piwik изиÑква пиÑмен доÑтъп до файловете на логото в тематичната директориÑ: %s", "LogoUpload": "Изберете логото за качване", "LogoUploadDescription": "ÐœÐ¾Ð»Ñ ÐºÐ°Ñ‡Ð²Ð°Ð¹Ñ‚Ðµ файла в %s формати, без прозрачни фонове, Ñ Ð¼Ð¸Ð½Ð¸Ð¼Ð°Ð»Ð½Ð° виÑочина от %s пикÑела.", - "MenuCommunity": "ОбщноÑÑ‚", "MenuDiagnostic": "ДиагноÑтика", "MenuGeneralSettings": "ОÑновни наÑтройки", "MenuManage": "Управление", diff --git a/lang/cs.json b/lang/cs.json index ec8897ae6f..46e6ec7c89 100644 --- a/lang/cs.json +++ b/lang/cs.json @@ -97,7 +97,6 @@ "LatestStableRelease": "Poslednà stabilnà verze", "LogoUpload": "Vyberte logotyp", "LogoUploadDescription": "ProsÃm nahrajte soubor ve formátu %s bez transparentnÃho pozadà s minimálnà výškou %s pixelů.", - "MenuCommunity": "Komunita", "MenuDiagnostic": "Diagnostika", "MenuGeneralSettings": "Hlavnà nastavenÃ", "MenuManage": "Správa", diff --git a/lang/da.json b/lang/da.json index fb875862bf..f44d1cdcba 100644 --- a/lang/da.json +++ b/lang/da.json @@ -142,7 +142,6 @@ "LogoNotWriteable": "For at anvende et brugerdefineret logo, kræver Piwik skrive adgang til logofilerne i skabelonmappen: %s", "LogoUpload": "Vælg et logo til overførelse", "LogoUploadDescription": "Overfør en fil i formatet %s, ingen gennemsigtig baggrund og med en højde pÃ¥ minimum %s pixels.", - "MenuCommunity": "Fællesskab", "MenuDiagnostic": "Diagnosticering", "MenuGeneralSettings": "Generelle indstillinger", "MenuManage": "Administrere", diff --git a/lang/de.json b/lang/de.json index 5a8c341647..7df9f42be5 100644 --- a/lang/de.json +++ b/lang/de.json @@ -144,7 +144,6 @@ "LogoNotWriteable": "Um ein eigenes Logo in Piwik verwenden zu können, wird Schreibzugriff auf die Logo Dateien im themes Ordner benötigt: %s", "LogoUpload": "Wählen Sie ein Logo für den Upload", "LogoUploadDescription": "Es werden Logos in %s Formaten, ohne Transparenz und mit einer minimalen Höhe von %s Pixeln unterstützt.", - "MenuCommunity": "Community", "MenuDiagnostic": "Diagnose", "MenuGeneralSettings": "Allgemeine Einstellungen", "MenuManage": "Verwalten", diff --git a/lang/el.json b/lang/el.json index dd70ec246c..3c4c014a54 100644 --- a/lang/el.json +++ b/lang/el.json @@ -141,7 +141,6 @@ "LogoNotWriteable": "Για να χÏησιμοποιήσετε Îνα Ï€ÏοσαÏμοσμÎνο υπόβαθÏο, το Piwik απαιτεί δικαιώματα εγγÏαφής στα αÏχεία λογοτÏπου μÎσα στο φάκελο των θεμάτων: %s", "LogoUpload": "ΕπιλÎξτε Îνα Λογότυπο για αποστολή", "LogoUploadDescription": "Αποστείλτε Îνα αÏχείο σε μοÏφÎÏ‚ %s, χωÏίς διάφανο υπόβαθÏο, με ελάχιστο Ïψος %s εικονοστοιχεία (pixels).", - "MenuCommunity": "Κοινότητα", "MenuDiagnostic": "Διαγνωστικά", "MenuGeneralSettings": "ΓενικÎÏ‚ Ïυθμίσεις", "MenuManage": "ΔιαχείÏιση", diff --git a/lang/en.json b/lang/en.json index 10e45ba7b9..e38b5048e2 100644 --- a/lang/en.json +++ b/lang/en.json @@ -508,7 +508,6 @@ }, "CoreAdminHome": { "PluginDescription": "Administration area of Piwik.", - "MenuCommunity": "Community", "MenuDiagnostic": "Diagnostic", "MenuGeneralSettings": "General settings", "MenuManage": "Manage", diff --git a/lang/es.json b/lang/es.json index c972526af1..80c718203b 100644 --- a/lang/es.json +++ b/lang/es.json @@ -119,7 +119,6 @@ "LogoNotWriteable": "Para usar un logo personalizado Piwik necesita acceso de escritura a los archivos de logo en el directorio de temas: %s", "LogoUpload": "Seleccione un logo para subir", "LogoUploadDescription": "Por favor suba un archivo en %s formatos, sin transparencias, con una altura mÃnima de %s pÃxeles.", - "MenuCommunity": "comunidad", "MenuDiagnostic": "diagnóstico", "MenuGeneralSettings": "Configuración General", "MenuManage": "gestionar", diff --git a/lang/fa.json b/lang/fa.json index 4a2ded6945..f701b4d4ea 100644 --- a/lang/fa.json +++ b/lang/fa.json @@ -122,7 +122,6 @@ "LatestStableRelease": "آخرین نسخه نهایی", "LogoNotWriteable": "برای استÙاده از یک آرم سÙارشی پیویک به دسترسی نوشتن به Ùایل های آرم نیاز دارد Ú©Ù‡ در پوشه ÛŒ پوسته ها است: %s", "LogoUpload": "انتخاب آرم برای آپلود", - "MenuCommunity": "انجمن", "MenuDiagnostic": "برشناختی", "MenuGeneralSettings": "تنضیمات اصلی", "MenuManage": "مدیریت", diff --git a/lang/fr.json b/lang/fr.json index e593804035..ac4cd850a9 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -142,7 +142,6 @@ "LogoNotWriteable": "Pour utiliser un logo personnalisé Piwik a besoin d'un accès en écriture aux fichiers de logo dans les répertoires des thèmes: %s", "LogoUpload": "Sélectionnez le logo à télécharger", "LogoUploadDescription": "Veuillez télécharger un fichier dans un de ces formats %s, sans fond transparent et avec une hauteur minimale de %s pixels.", - "MenuCommunity": "Communauté", "MenuDiagnostic": "Diagnostique", "MenuGeneralSettings": "Paramètres généraux", "MenuManage": "Gérer", diff --git a/lang/he.json b/lang/he.json index eff8268d6b..c7c48fed14 100644 --- a/lang/he.json +++ b/lang/he.json @@ -65,7 +65,6 @@ "ImageTracking": "×ª×ž×•× ×ª מעקב", "LatestBetaRelease": "גרסת × ×¡×™×•×Ÿ ××—×¨×•× ×”", "LogoUpload": "בחירת קובץ לוגו", - "MenuCommunity": "קהילה", "MenuDiagnostic": "×בחון", "MenuGeneralSettings": "הגדרות כלליות", "MenuManage": "× ×™×”×•×œ", diff --git a/lang/hi.json b/lang/hi.json index a5d8b63a4f..c8a37d292e 100644 --- a/lang/hi.json +++ b/lang/hi.json @@ -140,7 +140,6 @@ "LogoNotWriteable": "à¤à¤• कसà¥à¤Ÿà¤® पà¥à¤°à¤¤à¥€à¤• चिनà¥â€à¤¹ Piwik उपयोग करने के लिठविषयों निरà¥à¤¦à¥‡à¤¶à¤¿à¤•à¤¾ के à¤à¥€à¤¤à¤° पà¥à¤°à¤¤à¥€à¤• चिनà¥â€à¤¹ फाइल करने के लिठउपयोग लिखने की आवशà¥à¤¯à¤•à¤¤à¤¾ है: %s", "LogoUpload": "अपलोड करने के लिठकिसी लोगो को चà¥à¤¨à¥‡à¤‚", "LogoUploadDescription": "%s पिकà¥à¤¸à¤² के à¤à¤• नà¥à¤¯à¥‚नतम ऊंचाई के साथ %s पà¥à¤°à¤¾à¤°à¥‚प में à¤à¤• फ़ाइल, कोई पारदरà¥à¤¶à¥€ पृषà¥à¤ à¤à¥‚मि, अपलोड करें.", - "MenuCommunity": "समà¥à¤ªà¥à¤°à¤¦à¤¾à¤¯", "MenuDiagnostic": "डायगà¥à¤¨à¥‹à¤¸à¥à¤Ÿà¤¿à¤•", "MenuGeneralSettings": "सामानà¥à¤¯ सेटिंगà¥à¤¸", "MenuManage": "नियंतà¥à¤°à¤¿à¤¤ करें", diff --git a/lang/id.json b/lang/id.json index 60bf646282..b95f95746c 100644 --- a/lang/id.json +++ b/lang/id.json @@ -141,7 +141,6 @@ "LogoNotWriteable": "Untuk menggunakan logo kustom, Piwik membutuhkan akses tulis ke file logo dalam direktori tema: %s", "LogoUpload": "Pilih Logo untuk diunggah", "LogoUploadDescription": "Silakan unggah berkas dalam format %s, tanpa latar belakang transparan, dengan ketinggian minimal %s piksel.", - "MenuCommunity": "Komunitas", "MenuDiagnostic": "Diagnosis", "MenuGeneralSettings": "Pengaturan Umum", "MenuManage": "Kelola", diff --git a/lang/it.json b/lang/it.json index 6f28eedd6e..ad0b680e03 100644 --- a/lang/it.json +++ b/lang/it.json @@ -145,7 +145,6 @@ "LogoNotWriteable": "Per usare un logo personalizzato Piwik richiede i permessi di scrittura della cartella dei temi: %s", "LogoUpload": "Seleziona un logo da caricare", "LogoUploadDescription": "Per favore carica un file in formato %s, senza trasparenza, con un minimo di %s pixel.", - "MenuCommunity": "Comunità ", "MenuDiagnostic": "Diagnostica", "MenuGeneralSettings": "Impostazioni generali", "MenuManage": "Gestione", diff --git a/lang/ja.json b/lang/ja.json index 79ef4892b2..0b4eaf91cd 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -141,7 +141,6 @@ "LogoNotWriteable": "カスタムãƒã‚´ã‚’使用ã™ã‚‹ã«ã¯themesディレクトリ:%s ã®ä¸ã®ãƒã‚´ãƒ•ã‚¡ã‚¤ãƒ«ã¸ã®æ›¸ãè¾¼ã¿æ¨©é™ãŒå¿…è¦ã§ã™ã€‚", "LogoUpload": "アップãƒãƒ¼ãƒ‰ã™ã‚‹ãƒã‚´ã‚’é¸æŠž", "LogoUploadDescription": "ファイル㯠%s フォーマットã€é€æ˜ŽèƒŒæ™¯ãªã—ã€æœ€å°é«˜ã• %s ピクセルã§ã‚¢ãƒƒãƒ—ãƒãƒ¼ãƒ‰ã—ã¦ãã ã•ã„。", - "MenuCommunity": "コミュニティ", "MenuDiagnostic": "診æ–", "MenuGeneralSettings": "全般ã®è¨å®š", "MenuManage": "管ç†", diff --git a/lang/ko.json b/lang/ko.json index c499967aab..8ef2e41d40 100644 --- a/lang/ko.json +++ b/lang/ko.json @@ -108,7 +108,6 @@ "LogoNotWriteable": "ë¡œê³ ë¥¼ ë³€ê²½í•˜ë ¤ë©´ themes ë””ë ‰í† ë¦¬ì˜ ë¡œê³ íŒŒì¼ì— 쓰기 ê¶Œí•œì´ ìžˆì–´ì•¼í•©ë‹ˆë‹¤: %s", "LogoUpload": "업로드 í• ë¡œê³ ì„ íƒ", "LogoUploadDescription": "파ì¼ì„ 업로드합니다. %s í¬ë§·ì´ë©° 투명 ë°°ê²½ì´ ì—†ê³ ìµœì†Œ 높ì´ê°€ %s 픽셀ì´ì–´ì•¼ 합니다.", - "MenuCommunity": "커뮤니티", "MenuDiagnostic": "진단", "MenuGeneralSettings": "ì¼ë°˜ ì„¤ì •", "MenuManage": "관리", diff --git a/lang/nl.json b/lang/nl.json index c5ab4b63fa..6901c666dd 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -142,7 +142,6 @@ "LogoNotWriteable": "Voor het gebruik van een aangepast logo heeft Piwik schrijfrechten nodig in de map met de logo-bestanden in de themes map: %s", "LogoUpload": "Selecteer een logo om te uploaden", "LogoUploadDescription": "Upload een bestand in de formaten %s, geen transparante achtergrond, met een minimum hoogte van %s pixels.", - "MenuCommunity": "Gemeenschap", "MenuDiagnostic": "Diagnose", "MenuGeneralSettings": "Algemene instellingen", "MenuManage": "Beheer", diff --git a/lang/pt-br.json b/lang/pt-br.json index dfb4683557..7d83aa62de 100644 --- a/lang/pt-br.json +++ b/lang/pt-br.json @@ -142,7 +142,6 @@ "LogoNotWriteable": "Para usar um logo personalizado o Piwik requer permissão de gravação ao diretório dos arquivos de temas: %s", "LogoUpload": "Selecione um logotipo para carregar", "LogoUploadDescription": "Faça upload de um arquivo no formato %s, sem nenhum fundo transparente e com uma altura mÃnima de %s pixels.", - "MenuCommunity": "Comunidade", "MenuDiagnostic": "Diagnostico", "MenuGeneralSettings": "Configurações Gerais", "MenuManage": "Gerenciar", diff --git a/lang/ro.json b/lang/ro.json index 1eb873dd22..860b86960a 100644 --- a/lang/ro.json +++ b/lang/ro.json @@ -93,7 +93,6 @@ "LatestBetaRelease": "Ultima versiune beta", "LatestStableRelease": "Ultima versiune stabilă", "LogoUpload": "Alege logo-ul pentru încărcare", - "MenuCommunity": "Comunitate", "MenuDiagnostic": "Diagnosticare", "MenuGeneralSettings": "Setări generale", "MenuManage": "Administrare", diff --git a/lang/ru.json b/lang/ru.json index 6f62b74fb1..17e6073fe9 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -138,7 +138,6 @@ "LogoNotWriteable": "Чтобы иÑпользовать пользовательÑкие лого, Piwik трубетÑÑ Ð¿Ñ€Ð°Ð²Ð° на запиÑÑŒ в папку Ð´Ð»Ñ Ð»Ð¾Ð³Ð¾: %s", "LogoUpload": "Выберите лого Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸", "LogoUploadDescription": "ПожалуйÑта, заливайте файлы форматов %s, прозрачный фон недопуÑтим, минимальное ограничение по выÑоте - %s пикÑелей.", - "MenuCommunity": "СообщеÑтво", "MenuDiagnostic": "ДиагноÑтика", "MenuGeneralSettings": "ОÑновные наÑтройки", "MenuManage": "Управление", diff --git a/lang/sl.json b/lang/sl.json index daaaa2e70b..47024262a3 100644 --- a/lang/sl.json +++ b/lang/sl.json @@ -72,7 +72,6 @@ "CustomLogoHelpText": "Piwik-ov logo lahko prilagodite po vaÅ¡ih željah. Spremembe bodo vidne tako v uporabniÅ¡kem vmesniku, kot v email poroÄilih.", "EmailServerSettings": "Nastavitev strežnika za email", "LogoUpload": "Izberite Logo za nalaganje", - "MenuCommunity": "Skupnost", "MenuDiagnostic": "Diagnostika", "MenuGeneralSettings": "SploÅ¡ne nastavitve", "MenuManage": "Upravljaj", diff --git a/lang/sq.json b/lang/sq.json index 858e797898..f743c859d1 100644 --- a/lang/sq.json +++ b/lang/sq.json @@ -100,7 +100,6 @@ "LogoNotWriteable": "Që të përdorni një logo Piwik të përshtatur ju nevojitet të keni leje shkrimi te kartelat e logos brenda drejtorisë së temës: %s", "LogoUpload": "Përzgjidhni një Logo për ta ngarkuar", "LogoUploadDescription": "Ju lutem, ngarkoni një kartelë në format %s, pa sfond të tejdukshëm, me një lartësi minimale %s piksela.", - "MenuCommunity": "Bashkësi", "MenuDiagnostic": "Diagnostikim", "MenuGeneralSettings": "Rregullime të përgjithshme", "MenuManage": "Administroni", diff --git a/lang/sr.json b/lang/sr.json index 30b2706e15..641123b95e 100644 --- a/lang/sr.json +++ b/lang/sr.json @@ -142,7 +142,6 @@ "LogoNotWriteable": "Da biste koristili svoj logo za Piwik, potrebno je da omogućite prava za pisanje logo fajlovima u okviru foldera za teme: %s", "LogoUpload": "Izaberite logo za kaÄenje", "LogoUploadDescription": "Molimo vas da datoteka bude u formatima %s, bez transparencije i sa minimalnom visinom od %s piksela.", - "MenuCommunity": "Zajednica", "MenuDiagnostic": "Dijagnostika", "MenuGeneralSettings": "Osnovna podeÅ¡avanja", "MenuManage": "Upravljanje", diff --git a/lang/sv.json b/lang/sv.json index 711bf52fb1..7e5a0ae448 100644 --- a/lang/sv.json +++ b/lang/sv.json @@ -122,7 +122,6 @@ "LogoNotWriteable": "För att kunna använda en anpassad logotyp för Piwik krävs skrivrättigheter till logotypfilerna i temakatalogen: %s", "LogoUpload": "Välj en logotyp att ladda upp", "LogoUploadDescription": "Vänligen ladda upp en fil i %s formatet, ingen transparent bakgrund, med en minsta höjd av %s pixlar.", - "MenuCommunity": "Community", "MenuDiagnostic": "Diagnostik", "MenuGeneralSettings": "Allmänna inställningar", "MenuManage": "Hantera", diff --git a/lang/ta.json b/lang/ta.json index c284eeb8e6..fd1f7ec602 100644 --- a/lang/ta.json +++ b/lang/ta.json @@ -65,7 +65,6 @@ "LatestBetaRelease": "தறà¯à®ªà¯‹à®¤à¯ˆà®¯ நிலையறà¯à®± வெளியீடà¯", "LatestStableRelease": "தறà¯à®ªà¯‹à®¤à¯ˆà®¯ நிலையான வெளியீடà¯", "LogoUpload": "à®®à¯à®¤à¯à®¤à®¿à®°à¯ˆà®¯à¯ˆ தேரà¯à®µà¯ செயà¯à®•", - "MenuCommunity": "சமூகமà¯", "MenuDiagnostic": "ஆயà¯à®¨à¯à®¤à®±à®¿à®¤à®²à¯", "MenuGeneralSettings": "பொத௠அமைபà¯à®ªà¯à®•à®³à¯", "MenuManage": "மேலாணà¯à®®à¯ˆ", diff --git a/lang/th.json b/lang/th.json index 2549fc507b..050866113e 100644 --- a/lang/th.json +++ b/lang/th.json @@ -68,7 +68,6 @@ "Administration": "à¸à¸²à¸£à¸ˆà¸±à¸”à¸à¸²à¸£à¸£à¸°à¸šà¸š", "EmailServerSettings": "à¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่าเซิร์ฟเวà¸à¸£à¹Œà¸à¸µà¹€à¸¡à¸¥à¹Œ", "LogoUpload": "เลืà¸à¸à¸£à¸¹à¸›à¹‚ลโà¸à¹‰à¸—ี่ต้à¸à¸‡à¸à¸²à¸£à¸à¸±à¸žà¹‚หลด", - "MenuCommunity": "คà¸à¸¡à¸¡à¸¹à¸™à¸´à¸•à¸µà¹‰", "MenuGeneralSettings": "ตั้งค่าทั่วไป", "MenuManage": "จัดà¸à¸²à¸£", "OptOutComplete": "เลืà¸à¸à¸—ี่จะไม่ครบถ้วนเมื่à¸à¸„ุณเยี่ยมชมเว็บไซต์นี้จะไม่ถูà¸à¸šà¸±à¸™à¸—ึà¸à¹‚ดยเครื่à¸à¸‡à¸¡à¸·à¸à¸§à¸´à¹€à¸„ราะห์เว็บ", diff --git a/lang/tr.json b/lang/tr.json index e92dd5892e..20205b9984 100644 --- a/lang/tr.json +++ b/lang/tr.json @@ -124,7 +124,6 @@ "LogoNotWriteable": "Logoyu deÄŸiÅŸtirmek için, Piwik için tema dizinindeki logo dosyalarına yazma hakkı gerekir: %s", "LogoUpload": "Yüklemek için logo seçiniz", "LogoUploadDescription": "Arka planı transparan olmayan dosyalarınızı %s formatlarında ve minimum yüksekliÄŸi %s olarak yükleyiniz.", - "MenuCommunity": "Topluluk", "MenuDiagnostic": "tehÅŸis", "MenuGeneralSettings": "Genel Ayarlar", "MenuManage": "yönetmek", diff --git a/lang/zh-cn.json b/lang/zh-cn.json index 17e247fde9..ad64ab2f0e 100644 --- a/lang/zh-cn.json +++ b/lang/zh-cn.json @@ -142,7 +142,6 @@ "LogoNotWriteable": "Piwik需è¦ä¸»é¢˜æ–‡ä»¶å¤¹å†…%s的写æƒé™åŽ»è‡ªå®šä¹‰æ‚¨çš„logo", "LogoUpload": "é€‰æ‹©ä¸€ä¸ªå›¾æ ‡ä¸Šä¼ ", "LogoUploadDescription": "è¯·ä¸Šä¼ %s æ ¼å¼çš„文件,ä¸è¦é€æ˜ŽèƒŒæ™¯ï¼Œæœ€ä½Žé«˜åº¦ %s åƒç´ 。", - "MenuCommunity": "社区", "MenuDiagnostic": "检测", "MenuGeneralSettings": "一般设置", "MenuManage": "管ç†", diff --git a/piwik.php b/piwik.php index 2f06ef42a1..2df92969df 100644 --- a/piwik.php +++ b/piwik.php @@ -42,6 +42,8 @@ require_once PIWIK_INCLUDE_PATH . '/core/Plugin.php'; require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; require_once PIWIK_INCLUDE_PATH . '/core/IP.php'; require_once PIWIK_INCLUDE_PATH . '/core/UrlHelper.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Url.php'; +require_once PIWIK_INCLUDE_PATH . '/core/SettingsPiwik.php'; require_once PIWIK_INCLUDE_PATH . '/core/Tracker.php'; require_once PIWIK_INCLUDE_PATH . '/core/Config.php'; require_once PIWIK_INCLUDE_PATH . '/core/Translate.php'; diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index da1dce264d..3583748b9d 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -81,8 +81,7 @@ class CoreAdminHome extends \Piwik\Plugin function addMenu() { Piwik_AddAdminSubMenu('CoreAdminHome_MenuManage', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 1); - Piwik_AddAdminSubMenu('CoreAdminHome_MenuCommunity', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 3); - Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 20); + Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 6); Piwik_AddAdminSubMenu('General_Settings', null, "", Piwik::isUserHasSomeAdminAccess(), $order = 5); Piwik_AddAdminSubMenu('General_Settings', 'CoreAdminHome_MenuGeneralSettings', array('module' => 'CoreAdminHome', 'action' => 'generalSettings'), diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php index cd664b3aef..ff58b45d9c 100644 --- a/plugins/CorePluginsAdmin/PluginInstaller.php +++ b/plugins/CorePluginsAdmin/PluginInstaller.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\CorePluginsAdmin; use Piwik\Filechecks; use Piwik\Filesystem; +use Piwik\SettingsPiwik; use Piwik\Unzip; /** @@ -34,6 +35,9 @@ class PluginInstaller $tmpPluginZip = PIWIK_USER_PATH . self::PATH_TO_DOWNLOAD . $this->pluginName . '.zip'; $tmpPluginFolder = PIWIK_USER_PATH . self::PATH_TO_DOWNLOAD . $this->pluginName; + $tmpPluginZip = SettingsPiwik::rewriteTmpPathWithHostname($tmpPluginZip); + $tmpPluginFolder = SettingsPiwik::rewriteTmpPathWithHostname($tmpPluginFolder); + $this->makeSureFoldersAreWritable(); $this->makeSurePluginNameIsValid(); $this->downloadPluginFromMarketplace($tmpPluginZip); diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index c5fd949d40..59b6645af0 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -21,6 +21,7 @@ use Piwik\Filesystem; use Piwik\Http; use Piwik\Piwik; use Piwik\Plugins\LanguagesManager\LanguagesManager; +use Piwik\SettingsPiwik; use Piwik\SettingsServer; use Piwik\Unzip; use Piwik\UpdateCheck; @@ -43,6 +44,7 @@ class Controller extends \Piwik\Controller private $warningMessages = array(); private $errorMessages = array(); private $deactivatedPlugins = array(); + private $pathPiwikZip = false; static protected function getLatestZipUrl($newVersion) { @@ -127,17 +129,22 @@ class Controller extends \Piwik\Controller private function oneClick_Download() { - $this->pathPiwikZip = PIWIK_USER_PATH . self::PATH_TO_EXTRACT_LATEST_VERSION . 'latest.zip'; + $pathPiwikZip = PIWIK_USER_PATH . self::PATH_TO_EXTRACT_LATEST_VERSION . 'latest.zip'; + $this->pathPiwikZip = SettingsPiwik::rewriteTmpPathWithHostname($pathPiwikZip); + Filechecks::dieIfDirectoriesNotWritable(array(self::PATH_TO_EXTRACT_LATEST_VERSION)); // we catch exceptions in the caller (i.e., oneClickUpdate) $url = self::getLatestZipUrl($this->newVersion) . '?cb=' . $this->newVersion; - $fetched = Http::fetchRemoteFile($url, $this->pathPiwikZip); + + Http::fetchRemoteFile($url, $this->pathPiwikZip); } private function oneClick_Unpack() { $pathExtracted = PIWIK_USER_PATH . self::PATH_TO_EXTRACT_LATEST_VERSION; + $pathExtracted = SettingsPiwik::rewriteTmpPathWithHostname($pathExtracted); + $this->pathRootExtractedPiwik = $pathExtracted . 'piwik'; if (file_exists($this->pathRootExtractedPiwik)) { diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php index 7e8237a6a3..c57677e3b4 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php @@ -91,9 +91,9 @@ class Evolution extends JqplotGraph $defaultLastN = self::getDefaultLastN($period); $originalDate = Common::getRequestVar('date', 'last' . $defaultLastN, 'string'); - if ($period != 'range') { // show evolution limit if the period is not a range - $view->show_limit_control = true; - + if ($period == 'range') { // show evolution limit if the period is not a range + $view->show_limit_control = false; + } else { // set the evolution_{$period}_last_n query param if (Range::parseDateRange($originalDate)) { // if a multiple period // overwrite last_n param using the date range diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index ba1dca5fbe..badc024058 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -43,7 +43,7 @@ class DBStats extends \Piwik\Plugin Piwik_AddAdminSubMenu('CoreAdminHome_MenuDiagnostic', 'DBStats_DatabaseUsage', array('module' => 'DBStats', 'action' => 'index'), Piwik::isUserIsSuperUser(), - $order = 9); + $order = 6); } /** diff --git a/plugins/ImageGraph/StaticGraph.php b/plugins/ImageGraph/StaticGraph.php index cd4786f090..f3be3b18be 100644 --- a/plugins/ImageGraph/StaticGraph.php +++ b/plugins/ImageGraph/StaticGraph.php @@ -16,6 +16,7 @@ use Piwik\Loader; use Piwik\Plugins\ImageGraph\API; use pData; use pImage; +use Piwik\SettingsPiwik; require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pDraw.class.php"; require_once PIWIK_INCLUDE_PATH . "/libs/pChart2.1.3/class/pImage.class.php"; @@ -243,6 +244,8 @@ abstract class StaticGraph protected static function getOutputPath($filename) { $outputFilename = PIWIK_USER_PATH . '/tmp/assets/' . $filename; + $outputFilename = SettingsPiwik::rewriteTmpPathWithHostname($outputFilename); + @chmod($outputFilename, 0600); @unlink($outputFilename); return $outputFilename; diff --git a/plugins/Live/templates/getVisitorProfilePopup.twig b/plugins/Live/templates/getVisitorProfilePopup.twig index 55625942d6..678edfd039 100644 --- a/plugins/Live/templates/getVisitorProfilePopup.twig +++ b/plugins/Live/templates/getVisitorProfilePopup.twig @@ -38,10 +38,10 @@ {%- if not loop.first %}, {% endif -%}{{- totalConversions }} <span class="visitor-profile-goal-name">{{ goals[idGoal]['name'] -}}</span> {%- endfor -%} ){% endif %}.</p> - {% if visitorData.totalEcommerceConversions is defined or visitorData.totalAbandonedCarts is defined %} + {% if visitorData.totalEcommerceConversions|default(0) > 0 or visitorData.totalAbandonedCarts|default(0) > 0%} <p> {{ 'Goals_Ecommerce'|translate }}: - {%- if visitorData.totalEcommerceConversions is defined %} {{ 'Live_EcommerceSummaryConversions'|translate('<strong>', visitorData.totalEcommerceConversions, visitorData.totalEcommerceRevenue|money(idSite), '</strong>', visitorData.totalEcommerceItems)|raw }} + {%- if visitorData.totalEcommerceConversions|default(0) > 0 %} {{ 'Live_EcommerceSummaryConversions'|translate('<strong>', visitorData.totalEcommerceConversions, visitorData.totalEcommerceRevenue|money(idSite), '</strong>', visitorData.totalEcommerceItems)|raw }} {%- endif -%} {%- if visitorData.totalAbandonedCarts|default(0) > 0 %} {{ 'Live_AbandonedCartSummary'|translate('<strong>', visitorData.totalAbandonedCarts, '</strong>', visitorData.totalAbandonedCartsItems, '<strong>', visitorData.totalAbandonedCartsRevenue|money(idSite), '</strong>')|raw }}{%- endif -%} </p> diff --git a/plugins/PDFReports/config/tcpdf_config.php b/plugins/PDFReports/config/tcpdf_config.php index f9b2de9a6f..3662df3099 100644 --- a/plugins/PDFReports/config/tcpdf_config.php +++ b/plugins/PDFReports/config/tcpdf_config.php @@ -16,8 +16,12 @@ */ define('K_PATH_MAIN', PIWIK_INCLUDE_PATH . '/libs/tcpdf/'); -define('K_PATH_CACHE', PIWIK_USER_PATH . '/tmp/tcpdf/'); -define('K_PATH_IMAGES', PIWIK_USER_PATH . '/tmp/tcpdf/'); + +$pathTmpTCPDF = PIWIK_USER_PATH . '/tmp/tcpdf/'; +$pathTmpTCPDF = \Piwik\SettingsPiwik::rewriteTmpPathWithHostname($pathTmpTCPDF); + +define('K_PATH_CACHE', $pathTmpTCPDF); +define('K_PATH_IMAGES', $pathTmpTCPDF); if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { diff --git a/tests/PHPUnit/Core/LogTest.php b/tests/PHPUnit/Core/LogTest.php index 1ae78c63a3..e3c3cde4ae 100644 --- a/tests/PHPUnit/Core/LogTest.php +++ b/tests/PHPUnit/Core/LogTest.php @@ -65,7 +65,7 @@ dummy backtrace' parent::setUp(); Config::getInstance()->log['string_message_format'] = self::STRING_MESSAGE_FORMAT; - Config::getInstance()->log['logger_file_path'] = self::getLogFileLocation(); + Config::getInstance()->log['logger_file_path'] = self::getDefaultLogFileLocation(); @unlink(self::getLogFileLocation()); Log::clearInstance(); Error::$debugBacktraceForTests = ExceptionHandler::$debugBacktraceForTests = "dummy backtrace"; @@ -258,6 +258,15 @@ dummy backtrace' public static function getLogFileLocation() { - return PIWIK_INCLUDE_PATH . '/tmp/logs/piwik.test.log'; + $path = self::getDefaultLogFileLocation(); + $path = \Piwik\SettingsPiwik::rewriteTmpPathWithHostname($path); + return $path; } + + protected static function getDefaultLogFileLocation() + { + $path = PIWIK_INCLUDE_PATH . '/tmp/logs/piwik.test.log'; + return $path; + } + } \ No newline at end of file diff --git a/tests/PHPUnit/Core/ServeStaticFileTest.php b/tests/PHPUnit/Core/ServeStaticFileTest.php index 40a65b02da..0776f1c9aa 100644 --- a/tests/PHPUnit/Core/ServeStaticFileTest.php +++ b/tests/PHPUnit/Core/ServeStaticFileTest.php @@ -477,7 +477,8 @@ class Test_Piwik_ServeStaticFile extends PHPUnit_Framework_TestCase private function getCompressedFileLocation() { - return PIWIK_PATH_TEST_TO_ROOT . Piwik::COMPRESSED_FILE_LOCATION . basename(TEST_FILE_LOCATION); + $path = PIWIK_PATH_TEST_TO_ROOT . \Piwik\AssetManager::COMPRESSED_FILE_LOCATION . basename(TEST_FILE_LOCATION); + return \Piwik\SettingsPiwik::rewriteTmpPathWithHostname($path); } private function removeCompressedFiles() diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI index a209d62a45..8b7ead5998 160000 --- a/tests/PHPUnit/UI +++ b/tests/PHPUnit/UI @@ -1 +1 @@ -Subproject commit a209d62a45911770c655f879f546a15348bdcafc +Subproject commit 8b7ead59986b18d2bbc4e0fd097838e5237490f0 diff --git a/tests/travis/prepare.sh b/tests/travis/prepare.sh index 8ba216da70..93bed0daf7 100755 --- a/tests/travis/prepare.sh +++ b/tests/travis/prepare.sh @@ -30,8 +30,8 @@ fi mkdir ./tmp/assets mkdir ./tmp/cache mkdir ./tmp/latest +mkdir ./tmp/logs mkdir ./tmp/sessions mkdir ./tmp/templates_c mkdir ./tmp/tcpdf -mkdir ./tmp/logs chmod a+rw ./tests/lib/geoip-files -- GitLab