diff --git a/.gitmodules b/.gitmodules index fcb5bf9c8e6..26ff2ad7415 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,8 +25,8 @@ [submodule "plugins/TasksTimetable"] path = plugins/TasksTimetable url = https://github.com/piwik/plugin-TasksTimetable.git - branch = master + branch = master [submodule "plugins/LoginHttpAuth"] path = plugins/LoginHttpAuth url = https://github.com/piwik/plugin-LoginHttpAuth.git - branch = master + branch = master diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 1a53da63655..e209e56166f 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -16,9 +16,9 @@ use Piwik\Option; use Piwik\Plugin; use Piwik\Singleton; +use Piwik\Theme; use Piwik\Translate; use Piwik\Updater; -use Piwik\Theme; require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php'; @@ -72,12 +72,17 @@ class Manager extends Singleton 'LeftMenu' ); - public static function getPluginsToLoadDuringTests() + public function getPluginsToLoadDuringTests() { - $manager = \Piwik\Plugin\Manager::getInstance(); $toLoad = array(); - foreach($manager->readPluginsDirectory() as $plugin) { - if($manager->isPluginBundledWithCore($plugin)) { + foreach($this->readPluginsDirectory() as $plugin) { + $isPluginBundledWithCore = $this->isPluginBundledWithCore($plugin); + $isPluginOfficiallySupported = $this->isPluginOfficialAndNotBundledWithCore($plugin); + + // Do not enable other Login plugins + $isPluginOfficiallySupported = $isPluginOfficiallySupported && strpos($plugin, 'Login') === false; + + if($isPluginBundledWithCore || $isPluginOfficiallySupported) { $toLoad[] = $plugin; } } @@ -92,6 +97,19 @@ public function getCorePluginsDisabledByDefault() // If a plugin hooks onto at least an event starting with "Tracker.", we load the plugin during tracker const TRACKER_EVENT_PREFIX = 'Tracker.'; + /** + * @param $pluginName + * @return bool + */ + public function isPluginOfficialAndNotBundledWithCore($pluginName) + { + static $gitModules; + if(empty($gitModules)) { + $gitModules = file_get_contents(PIWIK_INCLUDE_PATH . '/.gitmodules'); + } + return false !== strpos($gitModules, "plugins/" . $pluginName); + } + /** * Update Plugins config * diff --git a/core/Session.php b/core/Session.php index 871ae1650a8..7109dd0db2f 100644 --- a/core/Session.php +++ b/core/Session.php @@ -39,7 +39,8 @@ public static function isFileBasedSessions() */ public static function start($options = false) { - if (self::$sessionStarted + if (headers_sent() + || self::$sessionStarted || (defined('PIWIK_ENABLE_SESSION_START') && !PIWIK_ENABLE_SESSION_START) ) { return; diff --git a/tests/PHPUnit/Core/ReleaseCheckListTest.php b/tests/PHPUnit/Core/ReleaseCheckListTest.php index 86166fa1e16..85ffbef354a 100644 --- a/tests/PHPUnit/Core/ReleaseCheckListTest.php +++ b/tests/PHPUnit/Core/ReleaseCheckListTest.php @@ -1,5 +1,6 @@ getCorePluginsDisabledByDefault()); - $isGitSubmodule = false !== strpos( file_get_contents(PIWIK_INCLUDE_PATH . '/.gitmodules'), "plugins/" . $pluginName); + $isGitSubmodule = Manager::getInstance()->isPluginOfficialAndNotBundledWithCore($pluginName); $enabled = in_array($pluginName, $pluginsBundledWithPiwik) || $isGitSubmodule || $pluginName == $manager::DEFAULT_THEME; $this->assertTrue( $enabled + $disabled === 1, @@ -302,4 +303,6 @@ private function checkFilesAreInFormat($files, $format) $this->fail("$format format failed for following icons $icons \n"); } } + + }