Dotclear

source: plugins/postWidgetText/_install.php @ 2755

Revision 2755, 2.3 KB checked in by JcDenis, 13 years ago (diff)

postWidgetText 0.6.1:

  • Fixed install on nightly build
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of postWidgetText, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009-2010 JC Denis and contributors
6# jcdenis@gdwd.com
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# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_CONTEXT_ADMIN')){return;}
14
15$new_version = $core->plugins->moduleInfo('postWidgetText','version');
16$old_version = $core->getVersion('postWidgetText');
17
18if (version_compare($old_version,$new_version,'>=')) return;
19
20try
21{
22     # Check DC version
23     if (version_compare(str_replace("-r","-p",DC_VERSION),'2.2-alpha','<'))
24     {
25          throw new Exception('postWidgetText requires Dotclear 2.2');
26     }
27     # Table is the same for plugins
28     # pollsFactory, postTask, postWidgetText
29     $s = new dbStruct($core->con,$core->prefix);
30     $s->post_option
31          ->option_id ('bigint',0,false)
32          ->post_id ('bigint',0,false)
33          ->option_creadt ('timestamp',0,false,'now()')
34          ->option_upddt ('timestamp',0,false,'now()')
35          ->option_type ('varchar',32,false,"''")
36          ->option_format ('varchar',32,false,"'xhtml'")
37          ->option_lang ('varchar',5,true,null)
38          ->option_title ('varchar',255,true,null)
39          ->option_content ('text',0,true,null)
40          ->option_content_xhtml ('text',0,false)
41         
42          ->index('idx_post_option_option','btree','option_id')
43          ->index('idx_post_option_post','btree','post_id')
44          ->index('idx_post_option_type','btree','option_type');
45     
46     $si = new dbStruct($core->con,$core->prefix);
47     $changes = $si->synchronize($s);
48     
49     # Settings
50     $core->blog->settings->addNamespace('postwidgettext');
51     $core->blog->settings->postwidgettext->put('postwidgettext_active',
52          true,'boolean','post widget text plugin enabled',false,true);
53     $core->blog->settings->postwidgettext->put('postwidgettext_importexport_active',
54          true,'boolean','activate import/export behaviors',false,true);
55     
56     # Transfert records from old table to the new one
57     if ($old_version !== null && version_compare($old_version,'0.5','<'))
58     {
59          require_once dirname(__FILE__).'/inc/patch.0.5.php';
60     }
61     
62     # Version
63     $core->setVersion('postWidgetText',$new_version);
64     
65     return true;
66}
67catch (Exception $e)
68{
69     $core->error->add($e->getMessage());
70     return false;
71}
72?>
Note: See TracBrowser for help on using the repository browser.

Sites map