Overview
Comment: | Corrections pour installation de plugin |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
9d0e5678d236a4769295b18b90f5f64a |
User & Date: | bohwaz on 2017-09-05 02:05:13 |
Other Links: | branch diff | manifest | tags |
Context
2017-09-05
| ||
02:05 | Ajout fonction pour créer un select dans un formulaire check-in: 982aad197f user: bohwaz tags: dev | |
02:05 | Corrections pour installation de plugin check-in: 9d0e5678d2 user: bohwaz tags: dev | |
2017-09-04
| ||
07:30 | Fix plugin install CSRF key check-in: f896a8268b user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Plugin.php from [bd0f6f93ec] to [01e5472ad8].
︙ | ︙ | |||
311 312 313 314 315 316 317 | // Signaux exclusifs, qui ne peuvent être attribués qu'à un seul plugin if (strpos($signal, 'boucle.') === 0) { $registered = $db->firstColumn('SELECT plugin FROM plugins_signaux WHERE signal = ? AND plugin != ?;', $signal, $this->id); if ($registered) { | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | // Signaux exclusifs, qui ne peuvent être attribués qu'à un seul plugin if (strpos($signal, 'boucle.') === 0) { $registered = $db->firstColumn('SELECT plugin FROM plugins_signaux WHERE signal = ? AND plugin != ?;', $signal, $this->id); if ($registered) { throw new \LogicException('Le signal ' . $signal . ' est exclusif et déjà associé au plugin "'.$registered.'"'); } } $st = $db->prepare('INSERT OR REPLACE INTO plugins_signaux VALUES (:signal, :plugin, :callback);'); $st->bindValue(':signal', $signal); $st->bindValue(':plugin', $this->id); $st->bindValue(':callback', $callable_name); |
︙ | ︙ | |||
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | throw new \RuntimeException('config.json invalide. Code erreur JSON: ' . json_last_error()); } $config = json_encode($config); } $db = DB::getInstance(); $db->insert('plugins', [ 'id' => $id, 'officiel' => (int)(bool)$official, 'nom' => $infos->nom, 'description'=> $infos->description, 'auteur' => $infos->auteur, 'url' => $infos->url, 'version' => $infos->version, 'menu' => (int)(bool)$infos->menu, 'config' => $config, ]); if (file_exists($path . '/install.php')) { $plugin = new Plugin($id); require $plugin->path() . '/install.php'; } return true; } /** * Renvoie la version installée d'un plugin ou FALSE s'il n'est pas installé * @param string $id Identifiant du plugin | > > > | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | throw new \RuntimeException('config.json invalide. Code erreur JSON: ' . json_last_error()); } $config = json_encode($config); } $db = DB::getInstance(); $db->begin(); $db->insert('plugins', [ 'id' => $id, 'officiel' => (int)(bool)$official, 'nom' => $infos->nom, 'description'=> $infos->description, 'auteur' => $infos->auteur, 'url' => $infos->url, 'version' => $infos->version, 'menu' => (int)(bool)$infos->menu, 'config' => $config, ]); if (file_exists($path . '/install.php')) { $plugin = new Plugin($id); require $plugin->path() . '/install.php'; } $db->commit(); return true; } /** * Renvoie la version installée d'un plugin ou FALSE s'il n'est pas installé * @param string $id Identifiant du plugin |
︙ | ︙ |
Modified src/www/admin/config/plugins.php from [946c67d622] to [b5fb4adb93].
︙ | ︙ | |||
9 10 11 12 13 14 15 | $form->check('install_plugin', [ 'plugin' => 'required', ]); if (!$form->hasErrors()) { try { | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | $form->check('install_plugin', [ 'plugin' => 'required', ]); if (!$form->hasErrors()) { try { Plugin::install(f('plugin'), false); Utils::redirect('/admin/config/plugins.php'); } catch (UserException $e) { $form->addError($e->getMessage()); } } |
︙ | ︙ |