diff options
author | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-12-16 01:24:44 +0300 |
---|---|---|
committer | vipsoft <vipsoft@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-12-16 01:24:44 +0300 |
commit | b7f28a11e34e159a37c4763df6eb40ebe449468f (patch) | |
tree | 4b9c7e92896ee482e1f496425f9da11fabefb7e0 | |
parent | 3f567b58e55140ca02072152a2641ae1d4888cb1 (diff) |
mandatory vs optional update
-rw-r--r-- | core/Updates/0.5.2.php | 43 | ||||
-rw-r--r-- | core/Updates/0.5.3.php | 22 | ||||
-rw-r--r-- | core/Updates/0.5.4.php | 65 |
3 files changed, 65 insertions, 65 deletions
diff --git a/core/Updates/0.5.2.php b/core/Updates/0.5.2.php deleted file mode 100644 index c75be269f9..0000000000 --- a/core/Updates/0.5.2.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Piwik - Open source web analytics - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later - * @version $Id$ - * - * @category Piwik - * @package Updates - */ - -/** - * @package Updates - */ -class Piwik_Updates_0_5_2 implements Piwik_iUpdate -{ - static function update() - { - $config = Zend_Registry::get('config'); - $salt = Piwik_Common::generateUniqId(); - try { - if(isset($config->superuser->salt)) - { - return; - } - - if(is_writable( Piwik_Config::getDefaultUserConfigPath() )) - { - $superuser_info = $config->superuser->toArray(); - $superuser_info['salt'] = $salt; - $config->superuser = $superuser_info; - $config->__destruct(); - - Piwik::createConfigObject(); - - return; - } - } catch(Exception $e) { } - - throw new Piwik_Updater_UpdateErrorException("Edit config.ini.php and add below <code>[superuser]</code> the following line <br/><code>salt = $salt</code>"); - } -} diff --git a/core/Updates/0.5.3.php b/core/Updates/0.5.3.php deleted file mode 100644 index 0ecbba2b73..0000000000 --- a/core/Updates/0.5.3.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * @package Updates - */ -class Piwik_Updates_0_5_3 implements Piwik_iUpdate -{ - static function update() - { - $config = Zend_Registry::get('config'); - try { - if(is_writable( Piwik_Config::getDefaultUserConfigPath() )) { - $plugins = $config->Plugins->toArray(); - $plugins[] = 'MultiSites'; - $config->Plugins = $plugins; - $config->__destruct(); - Piwik::createConfigObject(); - return; - } - } catch(Exception $e) { } - throw new Piwik_Updater_UpdateErrorException("You can now enable the new MultiSites plugin in the Plugins screen in the Piwik admin!"); - } -}
\ No newline at end of file diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php new file mode 100644 index 0000000000..543cb65e6b --- /dev/null +++ b/core/Updates/0.5.4.php @@ -0,0 +1,65 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @category Piwik + * @package Updates + */ + +/** + * @package Updates + */ +class Piwik_Updates_0_5_4 implements Piwik_iUpdate +{ + static function update() + { + $config = Zend_Registry::get('config'); + $salt = Piwik_Common::generateUniqId(); + if(!isset($config->superuser->salt)) + { + try { + if(is_writable( Piwik_Config::getDefaultUserConfigPath() )) + { + $superuser_info = $config->superuser->toArray(); + $superuser_info['salt'] = $salt; + $config->superuser = $superuser_info; + + $config->__destruct(); + Piwik::createConfigObject(); + } + else + { + throw new Exception('mandatory update failed'); + } + } catch(Exception $e) { + throw new Piwik_Updater_UpdateErrorException("Edit config.ini.php and add below <code>[superuser]</code> the following line <br/><code>salt = $salt</code>"); + } + } + + $config = Zend_Registry::get('config'); + $plugins = $config->Plugins->toArray(); + if(!in_array('MultiSites', $plugins)) + { + try { + if(is_writable( Piwik_Config::getDefaultUserConfigPath() )) + { + $plugins[] = 'MultiSites'; + $config->Plugins = $plugins; + + $config->__destruct(); + Piwik::createConfigObject(); + } + else + { + throw new Exception('optional update failed'); + } + } catch(Exception $e) { + throw new Exception("You can now enable the new MultiSites plugin in the Plugins screen in the Piwik admin!"); + } + } + } +} |