source: extensions/lmt/lmt_install.class.inc.php @ 7690

Last change on this file since 7690 was 7560, checked in by grum, 13 years ago

fix bug:1487 - LMT image not displayed with IE8
implement feature:1689 - Add possibility to search picture by licence

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : LMT
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
12  LMT_Install : classe to manage plugin install
13
14  --------------------------------------------------------------------------- */
15
16   include_once('lmt_version.inc.php'); // => Don't forget to update this file !!
17  @include_once('lmt_root.class.inc.php');
18  @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
19
20  /* lmt class for install process */
21  class LMT_Install extends LMT_root
22  {
23    private $tablef;
24    private $exportfile;
25
26    public function __construct($prefixeTable, $filelocation)
27    {
28      parent::__construct($prefixeTable, $filelocation);
29      $this->tablef= new GPCTables($this->tables);
30    }
31
32    public function __destruct()
33    {
34      unset($this->tablef);
35      unset($this->exportfile);
36      parent::__destruct();
37    }
38
39    /*
40        function for installation process
41        return true if install process is ok, otherwise false
42    */
43    public function install()
44    {
45      $this->initConfig();
46      $this->loadConfig();
47      $this->config['installed']=LMT_VERSION2;
48      $this->saveConfig();
49
50      $tables_def=array(
51"CREATE TABLE   `".$this->tables['images']."` (
52  `image_id` mediumint(8) unsigned NOT NULL default '0',
53  `licence_type` char(8) NOT NULL default 'cc-none',
54  `author_id` int UNSIGNED NOT NULL default '0',
55  PRIMARY KEY  (`image_id`),
56  KEY `by_licence` (`licence_type`),
57  KEY `by_author_id` (`author_id`)
58)
59ENGINE=MyISAM
60CHARACTER SET utf8 COLLATE utf8_general_ci",
61
62"CREATE TABLE `".$this->tables['licence_author']."` (
63  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
64  `text1` CHAR(25)  NOT NULL,
65  `text2` CHAR(25)  NOT NULL,
66  PRIMARY KEY (`id`)
67)
68ENGINE = MyISAM
69CHARACTER SET utf8 COLLATE utf8_general_ci",
70      );
71
72      $result=$this->tablef->create($tables_def);
73      GPCCore::register($this->getPluginName(), LMT_VERSION, LMT_GPC_NEEDED);
74
75      return($result);
76    }
77
78    /*
79        function for uninstall process
80    */
81    public function uninstall()
82    {
83      $this->deleteConfig();
84      $this->tablef->drop();
85      GPCCore::unregister($this->getPluginName());
86      return('');
87    }
88
89    public function activate()
90    {
91      global $template;
92
93      $this->initConfig();
94      $this->loadConfig();
95      $this->config['installed']=LMT_VERSION2;
96      $this->saveConfig();
97
98      GPCCore::register($this->getPluginName(), LMT_VERSION, LMT_GPC_NEEDED);
99      GPCRequestBuilder::register($this->getPluginName(), dirname($this->getFileLocation()).'/lmt_rb_callback.class.inc.php');
100      return('');
101    }
102
103    public function deactivate()
104    {
105      GPCRequestBuilder::unregister($this->getPluginName());
106    }
107  } //class
108
109?>
Note: See TracBrowser for help on using the repository browser.