From 85249df54ec8acfcf8eb7d71df5a616ae09d0e42 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Thu, 27 Jul 2023 18:29:30 -0400 Subject: [PATCH] Merging #5409 from 1.2.x branch --- CHANGELOG | 1 + lib/plugins.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 39d976b626..0b3a2a8015 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -136,6 +136,7 @@ Cacti CHANGELOG -issue#5390: Fix SQL error when saving DS template -issue#5392: Template import should not end with php error -issue#5403: Cacti Log regular expression filters can not calculate 'does not match' properly +-issue#5409: Enabling a plugin can have no response -issue#5413: Rows Per Page - Not all options are available -issue#5414: Plugins are unable to modify fields in the setting 'Change Device Settings' -issue#5417: Cacti mailer log message misses 'bcc' addresses in log notification diff --git a/lib/plugins.php b/lib/plugins.php index b68f3c3d55..26b8c5daeb 100644 --- a/lib/plugins.php +++ b/lib/plugins.php @@ -737,6 +737,12 @@ function api_plugin_install($plugin) { $author = $info['author']; $version = $info['version']; + } elseif (strpos($plugin, 'plugin_') !== false) { + raise_message('directory_error', __('The Plugin directory \'%s\' needs to be renamed to remove \'plugin_\' from the name before it can be installed.', $plugin), MESSAGE_LEVEL_ERROR); + return false; + } else { + raise_message('version_error', __('The Plugin in the directory \'%s\' does not include an version function \'%s()\'. This function must exist for the plugin to be installed.', $plugin, $function), MESSAGE_LEVEL_ERROR); + return false; } db_execute_prepared('INSERT INTO plugin_config @@ -763,6 +769,9 @@ function api_plugin_install($plugin) { WHERE directory = ?', array($plugin)); } + } else { + raise_message('install_error', __('The Plugin in the directory \'%s\' does not include an install function \'%s()\'. This function must exist for the plugin to be installed.', $plugin, $function), MESSAGE_LEVEL_ERROR); + return false; } api_plugin_replicate_config();