1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of dcFilterDuplicate, 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('dcFilterDuplicate','version'); |
---|
17 | $old_version = $core->getVersion('dcFilterDuplicate'); |
---|
18 | # Compare versions |
---|
19 | if (version_compare($old_version,$new_version,'>=')) {return;} |
---|
20 | # Install or update |
---|
21 | try { |
---|
22 | # Check DC version (dev on) |
---|
23 | if (!version_compare(DC_VERSION,'2.1.5','>=')) { |
---|
24 | throw new Exception('Plugin called dcFilterDuplicate requires Dotclear 2.1.5 or higher.'); |
---|
25 | } |
---|
26 | # Check DC version (new settings) |
---|
27 | if (version_compare(DC_VERSION,'2.2','>=')) { |
---|
28 | throw new Exception('Plugin called dcFilterDuplicate requires Dotclear up to 2.2.'); |
---|
29 | } |
---|
30 | # Settings |
---|
31 | $s = null; |
---|
32 | $s =& $core->blog->settings; |
---|
33 | $s->setNameSpace('dcFilterDuplicate'); |
---|
34 | $s->put('dcfilterduplicate_minlen',30,'integer','Minimum lenght of comment to filter',false,true); |
---|
35 | $s->setNameSpace('system'); |
---|
36 | # Version |
---|
37 | $core->setVersion('dcFilterDuplicate',$new_version); |
---|
38 | # All right baby |
---|
39 | return true; |
---|
40 | } |
---|
41 | catch (Exception $e) { |
---|
42 | $core->error->add($e->getMessage()); |
---|
43 | return false; |
---|
44 | } |
---|
45 | ?> |
---|