1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Carnaval a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2010 Me and contributors |
---|
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 | # |
---|
12 | # -- END LICENSE BLOCK ------------------------------------ |
---|
13 | |
---|
14 | if (!defined('DC_CONTEXT_ADMIN')) { exit; } |
---|
15 | |
---|
16 | # On lit la version du plugin |
---|
17 | $m_version = $core->plugins->moduleInfo('carnaval','version'); |
---|
18 | |
---|
19 | # On lit la version du plugin dans la table des versions |
---|
20 | $i_version = $core->getVersion('carnaval'); |
---|
21 | |
---|
22 | # La version dans la table est supérieure ou égale à |
---|
23 | # celle du module, on ne fait rien puisque celui-ci |
---|
24 | # est installé |
---|
25 | |
---|
26 | if (version_compare($i_version,$m_version,'>=')) { |
---|
27 | return; |
---|
28 | } |
---|
29 | |
---|
30 | # La procédure d'installation commence vraiment là |
---|
31 | # Création de la nouvelle table |
---|
32 | $s = new dbStruct($core->con,$core->prefix); |
---|
33 | |
---|
34 | $s->carnaval |
---|
35 | ->class_id('integer',0,false) |
---|
36 | ->blog_id('varchar',32, false) |
---|
37 | ->comment_author('varchar',255,false) |
---|
38 | ->comment_author_mail('varchar',255,false) |
---|
39 | ->comment_author_site('varchar',255,true) |
---|
40 | ->comment_class('varchar',255,false) |
---|
41 | ->comment_text_color('varchar',7,false) |
---|
42 | ->comment_background_color('varchar',7,false) |
---|
43 | |
---|
44 | ->primary('pk_carnaval','class_id') |
---|
45 | ->index('idx_class_blog_id','btree','blog_id') |
---|
46 | ; |
---|
47 | |
---|
48 | # Schema installation |
---|
49 | $si = new dbStruct($core->con,$core->prefix); |
---|
50 | $si->synchronize($s); |
---|
51 | |
---|
52 | $core->blog->settings->setNamespace('carnaval'); |
---|
53 | $s =& $core->blog->settings; |
---|
54 | $s->put('carnaval_active',false,'boolean','Carnaval activation flag',true,true); |
---|
55 | $s->put('carnaval_colors',false,'boolean','Use colors defined with Carnaval plugin',true,true); |
---|
56 | |
---|
57 | $core->setVersion('carnaval',$m_version); |
---|
58 | return true; |
---|
59 | ?> |
---|