forked from Piwigo/piwigo-autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaintain.inc.php
50 lines (42 loc) · 1.2 KB
/
maintain.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
function plugin_install($id, $version, &$errors)
{
if (version_compare(PHP_VERSION, '5.3') < 0)
{
$errors[] = "PHP 5.3 required";
return;
}
global $prefixeTable;
$q = '
CREATE TABLE `'.$prefixeTable.'suggestions` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`counter` INT NOT NULL DEFAULT 0,
`url` VARCHAR(255) DEFAULT NULL,
`level` tinyint unsigned NOT NULL default 0,
PRIMARY KEY (`id`) ,
UNIQUE INDEX `i_name` (`name` ASC) )';
pwg_query( create_table_add_character_set($q) );
$opts = array( 'excluded_tags'=>array(), 'excluded_albums'=>array() );
conf_update_param('rvac_opts', addslashes(serialize($opts)) );
$insert = array(
'name' => addslashes(l10n('Help')),
'url' => '$r/popuphelp.php?page=quick_search',
);
single_insert($prefixeTable.'suggestions', $insert);
}
function plugin_activate($id, $version, &$errors)
{
global $conf;
conf_update_param('rvac_version', @++$conf['rvac_version'] );
}
function plugin_uninstall()
{
global $prefixeTable;
$q = 'DROP TABLE IF EXISTS '.$prefixeTable.'suggestions';
pwg_query($q);
$q = 'DELETE FROM '.CONFIG_TABLE.'
WHERE param IN(\'rvac_opts\',\'rvac_version\')';
pwg_query($q);
}
?>