diff options
author | patdenice <patdenice@piwigo.org> | 2011-04-07 09:47:01 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-04-07 09:47:01 +0000 |
commit | 4408b67309e968eae8e7cbe5363566a261e3ee4a (patch) | |
tree | dbbc6ee762a68375a685a53bde92985dacdb57ac /admin/plugins_list.php | |
parent | c01742afbd511991a663f71ebb304d22ca66be6f (diff) |
merge r10098,r10100,r10101,r10113,r10128,r10129 from trunk to branch 2.2
feature:2250
Incompatible plugins and obsolete plugins may not be activated.
Deactivate and uninstall obsolete plugins.
Add warning icon and tiptip
Add languages keys.
Add expire parameter.
Clean code.
Remove useless query for delete.
git-svn-id: http://piwigo.org/svn/branches/2.2@10131 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/plugins_list.php')
-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'); } |