Dotclear

source: plugins/antispam/_install.php @ 0:54703be25dd6

Revision 0:54703be25dd6, 1.6 KB checked in by Dsls <dsls@…>, 14 years ago (diff)

2.3 branch (trunk) first checkin

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Antispam, a plugin for Dotclear 2.
5#
6# Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_CONTEXT_ADMIN')) { return; }
13
14$version = $core->plugins->moduleInfo('antispam','version');
15if (version_compare($core->getVersion('antispam'),$version,'>=')) {
16     return;
17}
18
19/* Database schema
20-------------------------------------------------------- */
21$s = new dbStruct($core->con,$core->prefix);
22
23$s->spamrule
24     ->rule_id      ('bigint',     0,   false)
25     ->blog_id      ('varchar',    32,  true)
26     ->rule_type    ('varchar',    16,  false,    "'word'")
27     ->rule_content ('varchar',    128, false)
28     
29     ->primary('pk_spamrule','rule_id')
30     ;
31
32$s->spamrule->index('idx_spamrule_blog_id','btree','blog_id');
33$s->spamrule->reference('fk_spamrule_blog','blog_id','blog','blog_id','cascade','cascade');
34
35if ($s->driver() == 'pgsql') {
36     $s->spamrule->index('idx_spamrule_blog_id_null','btree','(blog_id IS NULL)');
37}
38
39# Schema installation
40$si = new dbStruct($core->con,$core->prefix);
41$changes = $si->synchronize($s);
42
43# Creating default wordslist
44if ($core->getVersion('antispam') === null) {
45     $_o = new dcFilterWords($core);
46     $_o->defaultWordsList();
47     unset($_o);
48}
49
50$settings = new dcSettings($core,null);
51$settings->addNamespace('antispam');
52$settings->antispam->put('antispam_moderation_ttl',0,'integer','Antispam Moderation TTL (days)',false);
53
54$core->setVersion('antispam',$version);
55return true;
56?>
Note: See TracBrowser for help on using the repository browser.

Sites map