1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of dcAdvancedCleaner, a plugin for Dotclear 2. |
---|
4 | # |
---|
5 | # Copyright (c) 2009 JC Denis and contributors |
---|
6 | # jcdenis@gdwd.com |
---|
7 | # |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | |
---|
13 | if (!defined('DC_CONTEXT_ADMIN')){return;} |
---|
14 | |
---|
15 | # Get new version |
---|
16 | $new_version = $core->plugins->moduleInfo('dcAdvancedCleaner','version'); |
---|
17 | $old_version = $core->getVersion('dcAdvancedCleaner'); |
---|
18 | |
---|
19 | # Compare versions |
---|
20 | if (version_compare($old_version,$new_version,'>=')) {return;} |
---|
21 | |
---|
22 | # Install or update |
---|
23 | try |
---|
24 | { |
---|
25 | # Check DC version (dev on) |
---|
26 | if (!version_compare(DC_VERSION,'2.1.6','>=')) |
---|
27 | { |
---|
28 | throw new Exception('Plugin called dcAdvancedCleaner requires Dotclear 2.1.6 or higher.'); |
---|
29 | } |
---|
30 | # Check DC version (new settings) |
---|
31 | if (version_compare(DC_VERSION,'2.2','>=')) |
---|
32 | { |
---|
33 | throw new Exception('Plugin called dcAdvancedCleaner requires Dotclear up to 2.2.'); |
---|
34 | } |
---|
35 | |
---|
36 | # Settings |
---|
37 | $s = null; |
---|
38 | $s =& $core->blog->settings; |
---|
39 | $s->setNameSpace('dcAdvancedCleaner'); |
---|
40 | $s->put('dcadvancedcleaner_behavior_active',true,'boolean','',false,true); |
---|
41 | $s->put('dcadvancedcleaner_dcproperty_hide',true,'boolean','',false,true); |
---|
42 | $s->setNameSpace('system'); |
---|
43 | |
---|
44 | # Version |
---|
45 | $core->setVersion('dcAdvancedCleaner',$new_version); |
---|
46 | |
---|
47 | return true; |
---|
48 | } |
---|
49 | catch (Exception $e) |
---|
50 | { |
---|
51 | $core->error->add($e->getMessage()); |
---|
52 | return false; |
---|
53 | } |
---|
54 | ?> |
---|