diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-02-21 03:18:32 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-02-21 03:18:32 +0400 |
commit | 53a62982b8c537f679b4d699c993dc655915d82d (patch) | |
tree | 30e26d58b3d480c1437109bb7f0ce1d9c1a9ce77 /core | |
parent | 9742718f792c952961303c8db9768763b4ce6e6a (diff) |
During tests, we shall load plugins that are in the .gitmodule file (official plugins found in marketplace),
as well as loading those that are in the global.ini.php (official plugins bundled in piwik).
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/Manager.php | 28 | ||||
-rw-r--r-- | core/Session.php | 3 |
2 files changed, 25 insertions, 6 deletions
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 1a53da6365..e209e56166 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -16,9 +16,9 @@ use Piwik\Filesystem; 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; } } @@ -93,6 +98,19 @@ class Manager extends Singleton 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 * * @param array $plugins Plugins diff --git a/core/Session.php b/core/Session.php index 871ae1650a..7109dd0db2 100644 --- a/core/Session.php +++ b/core/Session.php @@ -39,7 +39,8 @@ class Session extends Zend_Session */ public static function start($options = false) { - if (self::$sessionStarted + if (headers_sent() + || self::$sessionStarted || (defined('PIWIK_ENABLE_SESSION_START') && !PIWIK_ENABLE_SESSION_START) ) { return; |