[315] | 1 | <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ |
---|
| 2 | /***************************************************************\ |
---|
[320] | 3 | * This is 'Carnaval', a plugin for Dotclear 2 * |
---|
[315] | 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 * |
---|
[320] | 12 | * License along with 'Carnaval' (see COPYING.txt); * |
---|
[315] | 13 | * if not, write to the Free Software Foundation, Inc., * |
---|
| 14 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
| 15 | \***************************************************************/ |
---|
| 16 | |
---|
[557] | 17 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
[556] | 18 | |
---|
[315] | 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à |
---|
[319] | 34 | # Création de la nouvelle table |
---|
[315] | 35 | $s = new dbStruct($core->con,$core->prefix); |
---|
| 36 | |
---|
| 37 | $s->carnaval |
---|
[320] | 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) |
---|
[459] | 43 | ->comment_class('varchar',255,false) |
---|
[556] | 44 | ->comment_text_color('varchar',7,false) |
---|
[1621] | 45 | ->comment_background_color('varchar',7,false) |
---|
[320] | 46 | |
---|
[1621] | 47 | ->primary('pk_carnaval','class_id') |
---|
[320] | 48 | ->index('idx_class_blog_id','btree','blog_id') |
---|
| 49 | ; |
---|
[315] | 50 | |
---|
[1621] | 51 | # Schéma d'installation |
---|
[315] | 52 | $si = new dbStruct($core->con,$core->prefix); |
---|
[320] | 53 | $si->synchronize($s); |
---|
[315] | 54 | |
---|
[1621] | 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 | |
---|
[315] | 59 | $core->setVersion('carnaval',$m_version); |
---|
| 60 | return true; |
---|
[1621] | 61 | ?> |
---|