Fix installazione plugins

This commit is contained in:
pek5892 2024-06-12 12:27:03 +02:00
parent 00988a4871
commit 77526c63ce
1 changed files with 52 additions and 19 deletions

View File

@ -144,26 +144,59 @@ if (file_exists($extraction_dir.'/VERSION')) {
copyr(dirname($file->getRealPath()), base_dir().'/'.$directory.'/'.$info['directory']); copyr(dirname($file->getRealPath()), base_dir().'/'.$directory.'/'.$info['directory']);
// Eventuale registrazione nel database // Eventuale registrazione nel database
if (empty($installed)) { if (basename($file->getRealPath()) == 'PLUGIN') {
$dbo->insert($table, array_merge($insert, [ if (empty($installed)) {
'directory' => $info['directory'], $dbo->insert($table, array_merge($insert, [
'name' => $info['name'], 'directory' => $info['directory'],
'options' => $info['options'], 'name' => $info['name'],
'version' => $info['version'], 'options' => $info['options'],
'compatibility' => $info['compatibility'], 'idmodule_from' => $insert['idmodule_from'],
'order' => 100, 'idmodule_to' => $insert['idmodule_to'],
'default' => 0, 'position' => $insert['position'],
'enabled' => 1, 'version' => $info['version'],
])); 'compatibility' => $info['compatibility'],
$id_record = $dbo->lastInsertedID(); 'order' => 100,
$dbo->insert($table.'_lang', array_merge($insert_lang, [ 'default' => 0,
'title' => !empty($info['title']) ? $info['title'] : $info['name'], 'enabled' => 1,
'id_record' => $id_record, ]));
'id_lang' => Models\Locale::getDefault()->id, $id_record = $dbo->lastInsertedID();
])); $dbo->insert($table.'_lang', array_merge($insert_lang, [
flash()->error(tr('Installazione completata!')); 'title' => !empty($info['title']) ? $info['title'] : $info['name'],
'id_record' => $id_record,
'id_lang' => Models\Locale::getDefault()->id,
]));
flash()->error(tr('Installazione completata!'));
} else {
flash()->error(tr('Aggiornamento completato!'));
}
} else { } else {
flash()->error(tr('Aggiornamento completato!')); if (empty($installed)) {
$dbo->insert($table, array_merge($insert, [
'directory' => $info['directory'],
'name' => $info['name'],
'options' => $info['options'],
'version' => $info['version'],
'compatibility' => $info['compatibility'],
'id_module' => $insert['id_module'],
'is_record' => $insert['is_record'],
'icon' => $insert['icon'],
'filename' => $insert_lang['filename'],
'order' => 100,
'default' => 0,
'enabled' => 1,
]));
$id_record = $dbo->lastInsertedID();
$dbo->insert($table.'_lang', array_merge($insert_lang, [
'title' => !empty($info['title']) ? $info['title'] : $info['name'],
'id_record' => $id_record,
'id_lang' => Models\Locale::getDefault()->id,
]));
flash()->error(tr('Installazione completata!'));
} else {
flash()->error(tr('Aggiornamento completato!'));
}
} }
} }
} }