Dotclear

source: plugins/antispam/_install.php @ 3731:3770620079d4

Revision 3731:3770620079d4, 1.5 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

Simplify licence block at the beginning of each file

Line 
1<?php
2/**
3 * @brief antispam, a plugin for Dotclear 2
4 *
5 * @package Dotclear
6 * @subpackage Plugins
7 *
8 * @copyright Olivier Meunier & Association Dotclear
9 * @copyright GPL-2.0-only
10 */
11
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;
Note: See TracBrowser for help on using the repository browser.

Sites map