1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of periodical, 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 | |
---|
13 | if (!defined('DC_CONTEXT_ADMIN')){return;} |
---|
14 | |
---|
15 | $new_version = $core->plugins->moduleInfo('periodical','version'); |
---|
16 | $old_version = $core->getVersion('periodical'); |
---|
17 | |
---|
18 | if (version_compare($old_version,$new_version,'>=')) return; |
---|
19 | |
---|
20 | try { |
---|
21 | if (!$core->plugins->moduleExists('metadata')) |
---|
22 | { |
---|
23 | throw new Exception('Plugin called "periodical" requires metadata plugin'); |
---|
24 | } |
---|
25 | # Tables |
---|
26 | $s = new dbStruct($core->con,$core->prefix); |
---|
27 | |
---|
28 | # Table principale des sondages |
---|
29 | $s->periodical |
---|
30 | ->periodical_id ('bigint',0,false) |
---|
31 | ->blog_id('varchar',32,false) |
---|
32 | ->periodical_type ('varchar',32,false,"'post'") |
---|
33 | ->periodical_title ('varchar',255,false,"''") |
---|
34 | ->periodical_tz ('varchar',128,false,"'UTC'") |
---|
35 | ->periodical_curdt ('timestamp',0,false,'now()') |
---|
36 | ->periodical_enddt ('timestamp',0,false,'now()') |
---|
37 | ->periodical_pub_int ('varchar',32,false,"'day'") |
---|
38 | ->periodical_pub_nb ('smallint',0,false,1) |
---|
39 | |
---|
40 | ->primary('pk_periodical','periodical_id') |
---|
41 | ->index('idx_periodical_type','btree','periodical_type'); |
---|
42 | |
---|
43 | $si = new dbStruct($core->con,$core->prefix); |
---|
44 | $changes = $si->synchronize($s); |
---|
45 | |
---|
46 | # Settings |
---|
47 | $s =& $core->blog->settings; |
---|
48 | |
---|
49 | $s->setNameSpace('periodical'); |
---|
50 | $s->put('periodical_active',false,'boolean','Enable extension',false,true); |
---|
51 | $s->put('periodical_upddate',true,'boolean','Update post date',false,true); |
---|
52 | $s->put('periodical_updurl',false,'boolean','Update post url',false,true); |
---|
53 | $s->put('periodical_pub_order','post_dt asc','string','Order of publication',false,true); |
---|
54 | $s->setNameSpace('system'); |
---|
55 | |
---|
56 | # Version |
---|
57 | $core->setVersion('periodical',$new_version); |
---|
58 | |
---|
59 | return true; |
---|
60 | } |
---|
61 | catch (Exception $e) { |
---|
62 | $core->error->add($e->getMessage()); |
---|
63 | } |
---|
64 | return false; |
---|
65 | ?> |
---|