Dotclear

source: plugins/activityReport/_install.php @ 1457

Revision 1457, 2.1 KB checked in by JcDenis, 14 years ago (diff)

activityReport 0.2:

  • First lab release
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of activityReport, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009 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('activityReport','version');
16$old_version = $core->getVersion('activityReport');
17
18if (version_compare($old_version,$new_version,'>=')) {return;}
19
20try
21{
22     # Table
23     $s = new dbStruct($core->con,$core->prefix);
24     $s->activity
25          ->activity_id ('bigint',0,false)
26          ->activity_type ('varchar',32,false,"'activityReport'")
27          ->blog_id ('varchar',32,true)
28          ->activity_group('varchar',32,false)
29          ->activity_action ('varchar',32,false)
30          ->activity_logs ('text',0,false)
31          ->activity_dt ('timestamp',0,false,'now()')
32          ->activity_blog_status ('smallint',0,false,0)
33          ->activity_super_status ('smallint',0,false,0)
34
35          ->primary('pk_activity','activity_id')
36          ->index('idx_activity_type','btree','activity_type')
37          ->index('idx_activity_blog_id','btree','blog_id')
38          ->index('idx_activity_action','btree','activity_group','activity_action')
39          ->index('idx_activity_blog_status','btree','activity_blog_status')
40          ->index('idx_activity_super_status','btree','activity_super_status');
41
42     $s->activity_setting
43          ->setting_id('varchar',64,false)
44          ->blog_id ('varchar',32,true)
45          ->setting_type('varchar',32,false)
46          ->setting_value('text',0,false)
47
48          ->unique('uk_activity_setting','setting_id','blog_id','setting_type')
49          ->index('idx_activity_setting_blog_id','btree','blog_id')
50          ->index('idx_activity_setting_type','btree','setting_type');
51
52     $si = new dbStruct($core->con,$core->prefix);
53     $changes = $si->synchronize($s);
54
55     # Version
56     $core->setVersion('activityReport',$new_version);
57
58     return true;
59}
60catch (Exception $e)
61{
62     $core->error->add($e->getMessage());
63}
64return false;
65?>
Note: See TracBrowser for help on using the repository browser.

Sites map