1 | <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ |
---|
2 | /***************************************************************\ |
---|
3 | * This is 'Carnaval', a plugin for Dotclear 2 * |
---|
4 | * * |
---|
5 | * Copyright (c) 2007-2008 * |
---|
6 | * Osku and contributors. * |
---|
7 | * * |
---|
8 | * This is an open source software, distributed under the GNU * |
---|
9 | * General Public License (version 2) terms and conditions. * |
---|
10 | * * |
---|
11 | * You should have received a copy of the GNU General Public * |
---|
12 | * License along with 'Carnaval' (see COPYING.txt); * |
---|
13 | * if not, write to the Free Software Foundation, Inc., * |
---|
14 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
15 | \***************************************************************/ |
---|
16 | |
---|
17 | if (!defined('DC_CONTEXT_ADMIN')) { exit; } |
---|
18 | |
---|
19 | # On lit la version du plugin |
---|
20 | $m_version = $core->plugins->moduleInfo('carnaval','version'); |
---|
21 | |
---|
22 | # On lit la version du plugin dans la table des versions |
---|
23 | $i_version = $core->getVersion('carnaval'); |
---|
24 | |
---|
25 | # La version dans la table est supérieure ou égale à |
---|
26 | # celle du module, on ne fait rien puisque celui-ci |
---|
27 | # est installé |
---|
28 | |
---|
29 | if (version_compare($i_version,$m_version,'>=')) { |
---|
30 | return; |
---|
31 | } |
---|
32 | |
---|
33 | # La procédure d'installation commence vraiment là |
---|
34 | # Création de la nouvelle table |
---|
35 | $s = new dbStruct($core->con,$core->prefix); |
---|
36 | |
---|
37 | $s->carnaval |
---|
38 | ->class_id('integer',0,false) |
---|
39 | ->blog_id('varchar',32, false) |
---|
40 | ->comment_author('varchar',255,false) |
---|
41 | ->comment_author_mail('varchar',255,false) |
---|
42 | ->comment_author_site('varchar',255,true) |
---|
43 | ->comment_class('varchar',255,false) |
---|
44 | ->comment_text_color('varchar',7,false) |
---|
45 | ->comment_background_color('varchar',7,false) |
---|
46 | |
---|
47 | ->primary('pk_carnaval','class_id') |
---|
48 | ->index('idx_class_blog_id','btree','blog_id') |
---|
49 | ; |
---|
50 | |
---|
51 | # Schema installation |
---|
52 | $si = new dbStruct($core->con,$core->prefix); |
---|
53 | $si->synchronize($s); |
---|
54 | |
---|
55 | if (!files::deltree(DC_TPL_CACHE.DIRECTORY_SEPARATOR.'cbtpl')) { |
---|
56 | throw new Exception(__('To finish installation, please delete the whole cache/cbtpl directory.')); |
---|
57 | } |
---|
58 | |
---|
59 | $core->setVersion('carnaval',$m_version); |
---|
60 | return true; |
---|
61 | ?> |
---|