diff options
author | sgiehl <stefan@piwik.org> | 2015-11-07 21:31:19 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-11-19 01:39:27 +0300 |
commit | 9510f940319ff2e717dfd8a6b245c2b303fa8031 (patch) | |
tree | 938da21f487363384a8128a9ad560f89fd9db0df | |
parent | 8933a13d0aecf6c349e49a00cc0e79a50e8700c3 (diff) |
fix backward compatibility for Referrer.addSearchEngineUrls event
-rw-r--r-- | plugins/Referrers/SearchEngine.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/Referrers/SearchEngine.php b/plugins/Referrers/SearchEngine.php index 41542e1548..14009a9029 100644 --- a/plugins/Referrers/SearchEngine.php +++ b/plugins/Referrers/SearchEngine.php @@ -49,7 +49,7 @@ class SearchEngine extends Singleton private function loadDefinitions() { - if ($this->definitionList === null) { + if (empty($this->definitionList)) { // Read first from the auto-updated list in database $list = Option::get(self::OPTION_STORAGE_NAME); @@ -65,10 +65,30 @@ class SearchEngine extends Singleton Piwik::postEvent('Referrer.addSearchEngineUrls', array(&$this->definitionList)); + $this->convertLegacyDefinitions(); + return $this->definitionList; } /** + * @deprecated remove in 3.0 + */ + protected function convertLegacyDefinitions() + { + foreach ($this->definitionList as $url => $definition) { + if (!array_key_exists('name', $definition) && isset($definition[0]) && isset($definition[1])) { + $this->definitionList[$url] = array( + 'name' => $definition[0], + 'params' => $definition[1], + 'backlink' => @$definition[2], + 'charsets' => @$definition[3] + ); + } + } + + } + + /** * Parses the given YML string and caches the resulting definitions * * @param string $yml |