diff options
Diffstat (limited to '')
-rw-r--r-- | admin/plugins_list.php | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/admin/plugins_list.php b/admin/plugins_list.php index 21e8ec3f2..1af2e239b 100644 --- a/admin/plugins_list.php +++ b/admin/plugins_list.php @@ -67,9 +67,19 @@ $plugins->set_tabsheet($page['page']); // +-----------------------------------------------------------------------+ $plugins->sort_fs_plugins('name'); +$plugins->get_merged_extensions(); +$plugins->get_incompatible_plugins(); +$merged_plugins = false; foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) { + if (isset($_SESSION['incompatible_plugins'][$plugin_id]) + and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id]) + { + // Incompatible plugins must be reinitilized + $plugins->get_incompatible_plugins(true); + } + $tpl_plugin = array( 'NAME' => $fs_plugin['name'], 'VISIT_URL' => $fs_plugin['uri'], @@ -77,7 +87,8 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) 'DESC' => $fs_plugin['description'], 'AUTHOR' => $fs_plugin['author'], 'AUTHOR_URL' => @$fs_plugin['author uri'], - 'U_ACTION' => sprintf($action_url, $plugin_id) + 'U_ACTION' => sprintf($action_url, $plugin_id), + 'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]), ); if (isset($plugins->db_plugins_by_id[$plugin_id])) @@ -89,34 +100,50 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) $tpl_plugin['STATE'] = 'uninstalled'; } + if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions'])) + { + switch($tpl_plugin['STATE']) + { + case 'active': $plugins->perform_action('deactivate', $plugin_id); + case 'inactive': $plugins->perform_action('uninstall', $plugin_id); + } + $tpl_plugin['STATE'] = 'merged'; + $tpl_plugin['DESC'] = l10n('THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'); + $merged_plugins = true; + } + $template->append('plugins', $tpl_plugin); } -$missing_plugin_ids = array_diff( - array_keys($plugins->db_plugins_by_id), - array_keys($plugins->fs_plugins) - ); +$template->append('plugin_states', 'active'); +$template->append('plugin_states', 'inactive'); +$template->append('plugin_states', 'uninstalled'); -foreach($missing_plugin_ids as $plugin_id) +if ($merged_plugins) { - $template->append( - 'plugins', - array( - 'NAME' => $plugin_id, - 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'], - 'DESC' => "ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW !", - 'U_ACTION' => sprintf($action_url, $plugin_id), - 'STATE' => 'missing', - ) - ); + $template->append('plugin_states', 'merged'); } -$template->append('plugin_states', 'active'); -$template->append('plugin_states', 'inactive'); -$template->append('plugin_states', 'uninstalled'); +$missing_plugin_ids = array_diff( + array_keys($plugins->db_plugins_by_id), + array_keys($plugins->fs_plugins) + ); if (count($missing_plugin_ids) > 0) { + foreach($missing_plugin_ids as $plugin_id) + { + $template->append( + 'plugins', + array( + 'NAME' => $plugin_id, + 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'], + 'DESC' => l10n('ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'), + 'U_ACTION' => sprintf($action_url, $plugin_id), + 'STATE' => 'missing', + ) + ); + } $template->append('plugin_states', 'missing'); } |