Dotclear

source: plugins/rateIt/_install.php @ 1458

Revision 1458, 4.7 KB checked in by JcDenis, 14 years ago (diff)

rateIt 0.9.5:

  • Fixed erreur 1071 in some MySQL servers
  • Added type meta equal to type tag
  • Added support for plugin activityReport
  • Fixed typo
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of rateIt, 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#
12# -- END LICENSE BLOCK ------------------------------------
13
14if (!defined('DC_CONTEXT_ADMIN')){return;}
15//*
16if ($core->plugins->moduleExists('rateItComment') 
17 || $core->plugins->moduleExists('rateItCategory')
18 || $core->plugins->moduleExists('rateItTag')
19 || $core->plugins->moduleExists('rateItGallery')) {
20     throw new Exception('You must uninstall rateItComment, rateItCategory, rateItTag, rateItGallery before installing rateIt 0.9.5 and higher');
21     return false;
22}
23//*/
24$new_version = $core->plugins->moduleInfo('rateIt','version');
25$old_version = $core->getVersion('rateIt');
26
27if (version_compare($old_version,$new_version,'>=')) return;
28
29try {
30     # Is DC 2.1.5 ?
31     if (!version_compare(DC_VERSION,'2.1.5','>=')) {
32
33          throw new Exception('rateIt requires Dotclear 2.1.5');
34     }
35     # Database
36     $s = new dbStruct($core->con,$core->prefix);
37     $s->rateit
38          ->blog_id ('varchar',32,false)
39          ->rateit_id ('varchar',192,false)
40          ->rateit_type('varchar',16,false)
41          ->rateit_note ('float',0,false)
42          ->rateit_quotient ('float',0,false)
43          ->rateit_ip ('varchar',48,false)
44          ->rateit_time ('timestamp',0,false,'now()')
45          ->primary('pk_rateit','blog_id','rateit_type','rateit_id','rateit_ip') //mysql error 1071 limit key to 768.
46          ->index('idx_rateit_blog_id','btree','blog_id')
47          ->index('idx_rateit_rateit_type','btree','rateit_type')
48          ->index('idx_rateit_rateit_id','btree','rateit_id')
49          ->index('idx_rateit_rateit_ip','btree','rateit_ip');
50
51     $si = new dbStruct($core->con,$core->prefix);
52     $changes = $si->synchronize($s);
53
54     $core->blog->settings->setNameSpace('rateit');
55
56     # Settings main
57     $core->blog->settings->put('rateit_active',false,'boolean','rateit plugin enabled',false,true);
58     $core->blog->settings->put('rateit_importexport_active',true,'boolean','rateit import/export enabled',false,true);
59     $core->blog->settings->put('rateit_quotient',5,'integer','rateit maximum note',false,true);
60     $core->blog->settings->put('rateit_digit',1,'integer','rateit note digits number',false,true);
61     $core->blog->settings->put('rateit_msgthanks','Thank you for having voted','string','rateit message when voted',false,true);
62     $core->blog->settings->put('rateit_userident',0,'integer','rateit use cookie and/or ip',false,true);
63     $core->blog->settings->put('rateit_dispubjs',false,'boolean','disable rateit public javascript',false,true);
64     $core->blog->settings->put('rateit_dispubcss',false,'boolean','disable rateit public css',false,true);
65     # Settings for posts
66     $core->blog->settings->put('rateit_post_active',true,'boolean','Enabled post rating',false,true);
67     $core->blog->settings->put('rateit_poststpl',false,'boolean','rateit template on post on post page',false,true);
68     $core->blog->settings->put('rateit_homepoststpl',false,'boolean','rateit template on post on home page',false,true);
69     $core->blog->settings->put('rateit_tagpoststpl',false,'boolean','rateit template on post on tag page',false,true);
70     $core->blog->settings->put('rateit_categorypoststpl',false,'boolean','rateit template on post on category page',false,true);
71     $core->blog->settings->put('rateit_categorylimitposts',false,'integer','rateit limit post vote to one category',false,true);
72     # Settings for comments
73     $core->blog->settings->put('rateit_comment_active',false,'boolean','Enable comments rating',false,true);
74     $core->blog->settings->put('rateit_commentstpl',true,'boolean','Use comments behavior',false,true);
75     # Settings for categories
76     $core->blog->settings->put('rateit_category_active',false,'boolean','rateit category addon enabled',false,true);
77     # Settings for tags
78     $core->blog->settings->put('rateit_tag_active',false,'boolean','rateit tag addon enabled',false,true);
79     # Settings for galleries
80     $core->blog->settings->put('rateit_gal_active',false,'boolean','rateit addon gallery enabled',false,true);
81     $core->blog->settings->put('rateit_galitem_active',false,'boolean','rateit addon gallery item enabled',false,true);
82     $core->blog->settings->put('rateit_galtpl',true,'boolean','rateit template galleries page',false,true);
83     $core->blog->settings->put('rateit_galitemtpl',true,'boolean','rateit template gallery items page',false,true);
84
85     $core->blog->settings->setNameSpace('system');
86
87     # Version
88     $core->setVersion('rateIt',$core->plugins->moduleInfo('rateIt','version'));
89
90     return true;
91}
92catch (Exception $e) {
93     $core->error->add($e->getMessage());
94}
95return false;
96?>
Note: See TracBrowser for help on using the repository browser.

Sites map