-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhook.php
More file actions
75 lines (60 loc) · 2.07 KB
/
Copy pathhook.php
File metadata and controls
75 lines (60 loc) · 2.07 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Fonction d'installation du plugin
* @return boolean
*/
function plugin_searchandcreate_install() {
include 'inc/config.class.php';
PluginSearchandcreateConfig::install();
if (! TableExists ( "glpi_plugin_searchandcreate_keywords" )) {
/* table pour stoquer les mots-clés
id
item_type type d'objet auquel correspondent les mots-clés
item_id id de l'item associé aux mots-clés
keywords mots-clés
*/
$query = "CREATE TABLE `glpi_plugin_searchandcreate_keywords` (
`id` int(11) NOT NULL auto_increment,
`item_type` varchar(250) NOT NULL collate utf8_unicode_ci,
`item_id` int(11) NOT NULL default '0',
`keywords` varchar(20000) collate utf8_unicode_ci default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$DB->query ( $query ) or die ( $DB->error () );
}
if (! TableExists ( "glpi_plugin_searchandcreate_favorites" )) {
/* table pour stoquer les favoris
id
user_id utilisateur auquel appartient le favori
item_type type d'objet auquel correspondent les mots-clés
item_id id de l'item associé aux mots-clés
order classement du favori
*/
$query = "CREATE TABLE `glpi_plugin_searchandcreate_favorites` (
`id` int(11) NOT NULL auto_increment,
`users_id` int(11) NOT NULL COMMENT 'RELATION to glpi_users (id)',
`itilcategories_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$DB->query ( $query ) or die ( $DB->error () );
}
return true;
}
/**
* Fonction de désinstallation du plugin
* @return boolean
*/
function plugin_searchandcreate_uninstall()
{
include 'inc/config.class.php';
PluginSearchandcreateConfig::install();
global $DB;
$tables = array(
"glpi_plugin_searchandcreate_keywords",
"glpi_plugin_searchandcreate_favorites"
);
foreach($tables as $table) {
$DB->query("DROP TABLE IF EXISTS `$table`;");
}
return true;
}