1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Meuh, |
---|
5 | # a plugin for DotClear2. |
---|
6 | # |
---|
7 | # Copyright (c) 2010 Bruno Hondelatte and contributors |
---|
8 | # |
---|
9 | # Licensed under the GPL version 2.0 license. |
---|
10 | # See LICENSE file or |
---|
11 | # http://www.gnu.org/licenses/gpl-2.0.txt |
---|
12 | # |
---|
13 | # -- END LICENSE BLOCK ------------------------------------ |
---|
14 | |
---|
15 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
16 | |
---|
17 | $version = $core->plugins->moduleInfo('meuh','version'); |
---|
18 | |
---|
19 | if (version_compare($core->getVersion('meuh'),$version,'>=')) { |
---|
20 | return; |
---|
21 | } |
---|
22 | |
---|
23 | /* Database schema |
---|
24 | -------------------------------------------------------- */ |
---|
25 | $s = new dbStruct($core->con,$core->prefix); |
---|
26 | |
---|
27 | $s->meuh |
---|
28 | ->blog_id ('varchar', 32, false) |
---|
29 | ->post_type ('varchar', 32, false, "'post'") |
---|
30 | ->post_url ('varchar', 255, false) |
---|
31 | ->meuh_url ('varchar', 255, false) |
---|
32 | ->meuh_count ('integer', 0, false,0) |
---|
33 | ->meuh_lastread ('timestamp', 0, false, 'now()') |
---|
34 | |
---|
35 | ->primary('pk_meuh','blog_id','post_type','meuh_url') |
---|
36 | |
---|
37 | ->index('idx_meuh_blog_id','btree','blog_id') |
---|
38 | |
---|
39 | ->reference('fk_meuh_blog','blog_id','blog','blog_id','cascade','cascade') |
---|
40 | ; |
---|
41 | |
---|
42 | # Schema installation |
---|
43 | $si = new dbStruct($core->con,$core->prefix); |
---|
44 | $changes = $si->synchronize($s); |
---|
45 | |
---|
46 | $core->setVersion('meuh',$version); |
---|
47 | return true; |
---|
48 | ?> |
---|