Skip to content

Commit eb2a950

Browse files
committed
fix
fix
1 parent f51fe35 commit eb2a950

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

hook.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function plugin_treeview_install()
103103
KEY `name` (`name`)
104104
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
105105

106-
$DB->doQuery($query) or die($DB->error());
106+
$DB->doQuery($query);
107107

108108
$query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_treeview_preferences` (
109109
`id` int {$default_key_sign} NOT NULL auto_increment,
@@ -112,7 +112,7 @@ function plugin_treeview_install()
112112
PRIMARY KEY (`id`)
113113
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
114114

115-
$DB->doQuery($query) or die($DB->error());
115+
$DB->doQuery($query);
116116
}
117117

118118
// No autoload when plugin is not activated
@@ -142,7 +142,7 @@ function plugin_treeview_upgrade10to11()
142142
PRIMARY KEY (`ID`)
143143
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
144144

145-
$DB->doQuery($query) or die($DB->error());
145+
$DB->doQuery($query);
146146
}
147147
}
148148

@@ -162,7 +162,7 @@ function plugin_treeview_upgrade11to12()
162162
$query .= ' DROP `is_default`';
163163
}
164164

165-
$DB->doQuery($query) or die($DB->error());
165+
$DB->doQuery($query);
166166
}
167167
}
168168

@@ -204,7 +204,7 @@ function plugin_treeview_upgrade12to13()
204204
$query .= " CHANGE `locationName` `locationName` int NOT NULL default '0'";
205205
}
206206

207-
$DB->doQuery($query) or die($DB->error());
207+
$DB->doQuery($query);
208208
}
209209

210210
if ($DB->tableExists('glpi_plugin_treeview_profiles')) {
@@ -213,7 +213,7 @@ function plugin_treeview_upgrade12to13()
213213
if ($DB->fieldExists('glpi_plugin_treeview_profiles', 'ID')) {
214214
$query .= " CHANGE `ID` `id` int {$default_key_sign} NOT NULL auto_increment";
215215
}
216-
$DB->doQuery($query) or die($DB->error());
216+
$DB->doQuery($query);
217217
}
218218

219219
if ($DB->tableExists('glpi_plugin_treeview_preference')) {
@@ -230,7 +230,7 @@ function plugin_treeview_upgrade12to13()
230230
if ($DB->fieldExists('glpi_plugin_treeview_preferences', 'show')) {
231231
$query .= " CHANGE `show` `show_on_load` int NOT NULL default '0'";
232232
}
233-
$DB->doQuery($query) or die($DB->error());
233+
$DB->doQuery($query);
234234
}
235235
}
236236

@@ -242,7 +242,7 @@ function plugin_treeview_upgrade13to14()
242242

243243
if ($DB->tableExists('glpi_plugin_treeview_displayprefs')) {
244244
$query = 'RENAME TABLE `glpi_plugin_treeview_displayprefs` to `glpi_plugin_treeview_configs`';
245-
$DB->doQuery($query) or die($DB->error());
245+
$DB->doQuery($query);
246246
}
247247
}
248248

@@ -262,7 +262,7 @@ function plugin_treeview_uninstall()
262262

263263
foreach ($tables as $table) {
264264
$query = "DROP TABLE IF EXISTS `$table`;";
265-
$DB->doQuery($query) or die($DB->error());
265+
$DB->doQuery($query);
266266
}
267267

268268
unset($_SESSION['glpimenu']['plugins']['content']['plugintreeviewpreference']);

setup.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ function plugin_init_treeview()
111111
}
112112
}
113113

114+
function plugin_treeview_check_prerequisites()
115+
{
116+
if (!is_readable(__DIR__ . '/vendor/autoload.php') || !is_file(__DIR__ . '/vendor/autoload.php')) {
117+
echo "Run composer install --no-dev in the plugin directory<br>";
118+
return false;
119+
}
120+
121+
return true;
122+
}
123+
114124

115125
/**
116126
* Get the name and the version of the plugin - Needed

0 commit comments

Comments
 (0)