1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of filesAlias, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2009-2010 Osku and contributors |
---|
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 | # |
---|
12 | # -- END LICENSE BLOCK ------------------------------------ |
---|
13 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
14 | |
---|
15 | $version = $core->plugins->moduleInfo('filesAlias','version'); |
---|
16 | |
---|
17 | if (version_compare($core->getVersion('filesAlias'),$version,'>=')) { |
---|
18 | return; |
---|
19 | } |
---|
20 | |
---|
21 | /* Database schema |
---|
22 | -------------------------------------------------------- */ |
---|
23 | $s = new dbStruct($core->con,$core->prefix); |
---|
24 | |
---|
25 | $s->filesalias |
---|
26 | ->blog_id('varchar',32,false) |
---|
27 | ->filesalias_url('varchar',255,false) |
---|
28 | ->filesalias_destination('varchar',255,false) |
---|
29 | ->filesalias_position('smallint',0,false,1) |
---|
30 | ->filesalias_disposable('smallint',0,false,0) |
---|
31 | |
---|
32 | ->primary('pk_filesalias','blog_id','filesalias_url') |
---|
33 | |
---|
34 | ->index('idx_filesalias_blog_id','btree','blog_id') |
---|
35 | ->index('idx_filesalias_blog_id_filesalias_position','btree','blog_id','filesalias_position') |
---|
36 | |
---|
37 | ->reference('fk_filesalias_blog','blog_id','blog','blog_id','cascade','cascade') |
---|
38 | ; |
---|
39 | |
---|
40 | # Schema installation |
---|
41 | $si = new dbStruct($core->con,$core->prefix); |
---|
42 | $changes = $si->synchronize($s); |
---|
43 | |
---|
44 | $core->blog->settings->setNamespace('filesalias'); |
---|
45 | $s =& $core->blog->settings; |
---|
46 | $s->put('filesalias_prefix','pub','string','Medias alias URL prefix',true,true); |
---|
47 | |
---|
48 | $core->setVersion('filesAlias',$version); |
---|
49 | return true; |
---|
50 | ?> |
---|