1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : Advanced Search Engine |
---|
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 | ASE_Install : classe to manage plugin install |
---|
13 | |
---|
14 | --------------------------------------------------------------------------- */ |
---|
15 | |
---|
16 | include_once('ase_version.inc.php'); // => Don't forget to update this file !! |
---|
17 | include_once('ase_root.class.inc.php'); |
---|
18 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); |
---|
19 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); |
---|
20 | |
---|
21 | /* ASE class for install process */ |
---|
22 | class ASE_Install extends ASE_root |
---|
23 | { |
---|
24 | |
---|
25 | public function __construct($prefixeTable, $filelocation) |
---|
26 | { |
---|
27 | parent::__construct($prefixeTable, $filelocation); |
---|
28 | } |
---|
29 | |
---|
30 | public function __destruct() |
---|
31 | { |
---|
32 | parent::__destruct(); |
---|
33 | } |
---|
34 | |
---|
35 | /* |
---|
36 | function for installation process |
---|
37 | return true if install process is ok, otherwise false |
---|
38 | */ |
---|
39 | public function install() |
---|
40 | { |
---|
41 | $this->initConfig(); |
---|
42 | $this->loadConfig(); |
---|
43 | $this->config['installed']=ASE_VERSION2; |
---|
44 | $this->config['newInstall']='y'; |
---|
45 | $this->saveConfig(); |
---|
46 | |
---|
47 | GPCCore::register($this->getPluginName(), ASE_VERSION, ASE_GPC_NEEDED); |
---|
48 | return(true); |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | /* |
---|
53 | function for uninstall process |
---|
54 | */ |
---|
55 | public function uninstall() |
---|
56 | { |
---|
57 | $this->deleteConfig(); |
---|
58 | GPCCore::unregister($this->getPluginName()); |
---|
59 | return(''); |
---|
60 | } |
---|
61 | |
---|
62 | public function activate() |
---|
63 | { |
---|
64 | $this->initConfig(); |
---|
65 | $this->loadConfig(); |
---|
66 | |
---|
67 | /* |
---|
68 | * migration code |
---|
69 | */ |
---|
70 | switch($this->config['installed']) |
---|
71 | { |
---|
72 | // actually, there no migration possible from previous release |
---|
73 | default: |
---|
74 | // nothing to do... |
---|
75 | break; |
---|
76 | } |
---|
77 | |
---|
78 | $this->config['installed']=ASE_VERSION2; |
---|
79 | $this->saveConfig(); |
---|
80 | |
---|
81 | GPCCore::register($this->getPluginName(), ASE_VERSION, ASE_GPC_NEEDED); |
---|
82 | GPCRequestBuilder::register('ASETag', dirname($this->getFileLocation()).'/ase_rb_callback_tag.class.inc.php'); |
---|
83 | GPCRequestBuilder::register('ASEDate', dirname($this->getFileLocation()).'/ase_rb_callback_date.class.inc.php'); |
---|
84 | GPCRequestBuilder::register('ASECategory', dirname($this->getFileLocation()).'/ase_rb_callback_category.class.inc.php'); |
---|
85 | GPCRequestBuilder::register('ASEKeyword', dirname($this->getFileLocation()).'/ase_rb_callback_keyword.class.inc.php'); |
---|
86 | GPCRequestBuilder::register('ASERate', dirname($this->getFileLocation()).'/ase_rb_callback_rate.class.inc.php'); |
---|
87 | |
---|
88 | GPCRequestBuilder::unregister('ASEHD'); // need to be keeped to be able to unregister it... |
---|
89 | return(''); |
---|
90 | } |
---|
91 | |
---|
92 | public function deactivate() |
---|
93 | { |
---|
94 | GPCRequestBuilder::unregister('ASETag'); |
---|
95 | GPCRequestBuilder::unregister('ASEDate'); |
---|
96 | GPCRequestBuilder::unregister('ASECategory'); |
---|
97 | GPCRequestBuilder::unregister('ASEKeyword'); |
---|
98 | GPCRequestBuilder::unregister('ASERate'); |
---|
99 | |
---|
100 | GPCRequestBuilder::unregister('ASEHD'); // need to be keeped to be able to unregister it... |
---|
101 | } |
---|
102 | |
---|
103 | } //class |
---|
104 | |
---|
105 | ?> |
---|