Dotclear

source: plugins/dcRevisions/_install.php @ 338:2d7dcf33cd6f

Revision 338:2d7dcf33cd6f, 1.8 KB checked in by sacha, 14 years ago (diff)

Added dcRevisions plugin

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of dcRevisions, a plugin for Dotclear.
4#
5# Copyright (c) 2010 Tomtom and contributors
6# http://blog.zenstyle.fr/
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$m_version = $core->plugins->moduleInfo('dcRevisions','version');
16$i_version = $core->getVersion('dcrevisions');
17
18if (version_compare($i_version,$m_version,'>=')) {
19     return;
20}
21
22$core->blog->settings->addNamespace('dcrevisions');
23$core->blog->settings->dcrevisions->put(
24     'enable',
25     false,
26     'boolean','Enable revisions',false,true
27);
28
29# --INSTALL AND UPDATE PROCEDURES--
30$s = new dbStruct($core->con,$core->prefix);
31
32$s->revision
33     ->revision_id                 ('bigint',0,false)
34     ->post_id                     ('bigint',0,false)
35     ->user_id                     ('varchar',32,false)
36     ->blog_id                     ('varchar',32,false)
37     ->revision_dt                 ('timestamp',0,false,'now()')
38     ->revision_tz                 ('varchar',128,false,"'UTC'")
39     ->revision_type               ('varchar',50,true,null)
40     ->revision_excerpt_diff       ('text',0,true,null)
41     ->revision_excerpt_xhtml_diff ('text',0,true,null)
42     ->revision_content_diff       ('text',0,true,null)
43     ->revision_content_xhtml_diff ('text',0,true,null)
44     ;
45
46$s->revision->primary('pk_revision','revision_id');
47
48$s->revision->index('idx_revision_post_id','btree','post_id');
49
50$s->revision->reference('fk_revision_post','post_id','post','post_id','cascade','cascade');
51$s->revision->reference('fk_revision_blog','blog_id','blog','blog_id','cascade','cascade');
52
53$si = new dbStruct($core->con,$core->prefix);
54
55try {
56     $changes = $si->synchronize($s);
57} catch (Exception $e) {
58     $core->error->add($e);
59}
60
61$core->setVersion('dcrevisions',$m_version);
62
63return true;
64
65?>
Note: See TracBrowser for help on using the repository browser.

Sites map