diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-01-11 02:48:50 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-01-11 02:54:13 +0400 |
commit | fb5454b703d00d50fb90fb7ddd0aa58656728093 (patch) | |
tree | fc5626edf1701b9c35baa1c5965a5dc5487067ba /core/Updates/2.0.3-b7.php | |
parent | 15853da8b03f0ab7a858a2335e9dbd62b7db4116 (diff) |
Fixes #4493, move DoNotTrack & AnonymizeIP logic to PrivacyManager plugin. Includes modification to EventDipatcher to allow generic callbacks in getListHooksRegistered method.
Diffstat (limited to 'core/Updates/2.0.3-b7.php')
-rw-r--r-- | core/Updates/2.0.3-b7.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/core/Updates/2.0.3-b7.php b/core/Updates/2.0.3-b7.php new file mode 100644 index 0000000000..06669b4a47 --- /dev/null +++ b/core/Updates/2.0.3-b7.php @@ -0,0 +1,66 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + * @category Piwik + * @package Piwik + */ + +namespace Piwik\Updates; + +use Piwik\Common; +use Piwik\Site; +use Piwik\Updater; +use Piwik\Updates; +use Piwik\Filesystem; + +use Piwik\Plugins\PrivacyManager\DoNotTrackHeaderChecker; +use Piwik\Plugins\PrivacyManager\IPAnonymizer; + +/** + * @package Updates + */ +class Updates_2_0_3_b7 extends Updates +{ + static function update() + { + $errors = array(); + + try { + // enable DoNotTrack check in PrivacyManager if DoNotTrack plugin was enabled + if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('DoNotTrack')) { + DoNotTrackHeaderChecker::activate(); + } + + // enable IP anonymization if AnonymizeIP plugin was enabled + if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('AnonymizeIP')) { + IPAnonymizer::activate(); + } + } catch (Exception $ex) { + // pass + } + + // disable & delete old plugins + $oldPlugins = array('DoNotTrack', 'AnonymizeIP'); + foreach ($oldPlugins as $plugin) { + \Piwik\Plugin\Manager::getInstance()->deactivatePlugin($plugin); + + $dir = PIWIK_INCLUDE_PATH . "/plugins/$plugin"; + + if (file_exists($dir)) { + Filesystem::unlinkRecursive($dir, true); + } + + if (file_exists($dir)) { + $errors[] = "Please delete this directory manually (eg. using your FTP software): $dir \n"; + } + + } + if(!empty($errors)) { + throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors)); + } + } +} |