Dotclear

source: plugins/dcFilterDuplicate/_install.php @ 1981

Revision 1981, 1.5 KB checked in by JcDenis, 14 years ago (diff)

dcFilterDuplicate 0.2:

  • Fixed trigger blogs
  • Enabled min length of comment to filter
  • Prepared DC 2.2 Break
  • Added versioning
Line 
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
13if (!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
19if (version_compare($old_version,$new_version,'>=')) {return;}
20# Install or update
21try {
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}
41catch (Exception $e) {
42     $core->error->add($e->getMessage());
43     return false;
44}
45?>
Note: See TracBrowser for help on using the repository browser.

Sites map