1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : Grum Plugin Classes - 3 |
---|
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 | |
---|
13 | GPC_Install : classe to manage plugin install |
---|
14 | |
---|
15 | --------------------------------------------------------------------------- */ |
---|
16 | |
---|
17 | if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
18 | |
---|
19 | include_once('gpc_version.inc.php'); // => Don't forget to update this file !! |
---|
20 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
21 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCore.class.inc.php'); |
---|
22 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); |
---|
23 | |
---|
24 | /* PGC class for install process */ |
---|
25 | class GPC_Install extends CommonPlugin |
---|
26 | { |
---|
27 | private $tablef; |
---|
28 | |
---|
29 | public function __construct($prefixeTable, $filelocation) |
---|
30 | { |
---|
31 | $this->setPluginName("Grum Plugin Classes"); |
---|
32 | $this->setPluginNameFiles("gpc"); |
---|
33 | parent::__construct($prefixeTable, $filelocation); |
---|
34 | GPCRequestBuilder::init($prefixeTable, $this->getPluginNameFiles()); |
---|
35 | } |
---|
36 | |
---|
37 | public function __destruct() |
---|
38 | { |
---|
39 | parent::__destruct(); |
---|
40 | } |
---|
41 | |
---|
42 | /* |
---|
43 | function for installation process |
---|
44 | return true if install process is ok, otherwise false |
---|
45 | */ |
---|
46 | public function install() |
---|
47 | { |
---|
48 | $this->initConfig(); |
---|
49 | $this->loadConfig(); |
---|
50 | $this->config['installed']=GPC_VERSION2; |
---|
51 | $this->saveConfig(); |
---|
52 | |
---|
53 | $result=GPCRequestBuilder::createTables(); |
---|
54 | return($result); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | /* |
---|
59 | function for uninstall process |
---|
60 | */ |
---|
61 | public function uninstall() |
---|
62 | { |
---|
63 | $registeredPlugin=GPCCore::getRegistered(); |
---|
64 | if(count($registeredPlugin)>0) |
---|
65 | { |
---|
66 | return(l10n("Some plugins are dependent on Grum Plugin Classes: before uninstall, you must first uninstall the plugins dependent")); |
---|
67 | } |
---|
68 | else |
---|
69 | { |
---|
70 | $this->deleteConfig(); |
---|
71 | GPCCore::deleteConfig(); |
---|
72 | GPCRequestBuilder::deleteConfig(); |
---|
73 | $result=GPCRequestBuilder::deleteTables(); |
---|
74 | return($result); |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | public function activate() |
---|
79 | { |
---|
80 | global $template, $user; |
---|
81 | |
---|
82 | $this->initConfig(); |
---|
83 | $this->loadConfig(); |
---|
84 | |
---|
85 | /* |
---|
86 | * if there is no version information available, assume the previous |
---|
87 | * installed release of the plugin is 3.1.0 |
---|
88 | */ |
---|
89 | if(!isset($this->config['installed'])) $this->config['installed']='03.01.00'; |
---|
90 | |
---|
91 | /* |
---|
92 | switch($this->config['installed']) |
---|
93 | { |
---|
94 | case '03.01.00': |
---|
95 | GPCRequestBuilder::updateTables($this->config['installed']); |
---|
96 | break; |
---|
97 | } |
---|
98 | */ |
---|
99 | GPCRequestBuilder::updateTables($this->config['installed']); |
---|
100 | |
---|
101 | |
---|
102 | $this->config['installed']=GPC_VERSION2; //update the installed release number |
---|
103 | $this->saveConfig(); |
---|
104 | |
---|
105 | return(true); |
---|
106 | } |
---|
107 | |
---|
108 | public function deactivate() |
---|
109 | { |
---|
110 | } |
---|
111 | |
---|
112 | } //class |
---|
113 | |
---|
114 | ?> |
---|