diff options
author | patdenice <patdenice@piwigo.org> | 2011-05-25 09:57:56 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-05-25 09:57:56 +0000 |
commit | 639a18d13fcede5f841aa67529ddd91a4acc1b5d (patch) | |
tree | 4a03369c0c460a3222187575dd6c436f92b98567 | |
parent | 663d72e06306108d1b06ae0919c6bf8325c2a9f5 (diff) |
feature:2250
Add obsolete_extensions.list file in install directory.
Incompatible plugins is checked through ajax.
git-svn-id: http://piwigo.org/svn/branches/2.2@11043 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/include/plugins.class.php | 24 | ||||
-rw-r--r-- | admin/plugins_list.php | 28 | ||||
-rw-r--r-- | admin/themes/default/template/plugins_list.tpl | 27 | ||||
-rw-r--r-- | install/obsolete_extensions.list | 5 |
4 files changed, 51 insertions, 33 deletions
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index 30242f01b..fc2191ff2 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -556,30 +556,20 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\''; function get_merged_extensions($version=PHPWG_VERSION) { - if (isset($_SESSION['merged_extensions']) and $_SESSION['merged_extensions']['~~expire~~'] > time()) - { - return $_SESSION['merged_extensions']; - } - - $_SESSION['merged_extensions'] = array('~~expire~~' => time() + 600); + $file = PHPWG_ROOT_PATH.'install/obsolete_extensions.list'; + $merged_extensions = array(); - if (fetchRemote(PHPWG_URL.'/download/merged_extensions.txt', $result)) + if (file_exists($file) and $obsolete_ext = file($file, FILE_IGNORE_NEW_LINES) and !empty($obsolete_ext)) { - $rows = explode("\n", $result); - foreach ($rows as $row) + foreach ($obsolete_ext as $ext) { - if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match)) + if (preg_match('/^(\d+) ?: ?(.*?)$/', $ext, $matches)) { - if (version_compare($version, $match[1], '>=')) - { - $extensions = explode(',', trim($match[2])); - $_SESSION['merged_extensions'] = array_merge($_SESSION['merged_extensions'], $extensions); - } + $merged_extensions[$matches[1]] = $matches[2]; } } } - - return $_SESSION['merged_extensions']; + return $merged_extensions; } /** diff --git a/admin/plugins_list.php b/admin/plugins_list.php index 1af2e239b..eae6f5988 100644 --- a/admin/plugins_list.php +++ b/admin/plugins_list.php @@ -62,25 +62,40 @@ if (isset($_GET['action']) and isset($_GET['plugin'])) //--------------------------------------------------------------------Tabsheet $plugins->set_tabsheet($page['page']); +//--------------------------------------------------------Incompatible Plugins +if (isset($_GET['incompatible_plugins'])) +{ + $incompatible_plugins = array(); + foreach ($plugins->get_incompatible_plugins() as $plugin => $version) + { + if ($plugin == '~~expire~~') continue; + array_push($incompatible_plugins, $plugin); + + } + echo json_encode($incompatible_plugins); + exit; +} + // +-----------------------------------------------------------------------+ // | start template output | // +-----------------------------------------------------------------------+ $plugins->sort_fs_plugins('name'); -$plugins->get_merged_extensions(); -$plugins->get_incompatible_plugins(); +$merged_extensions = $plugins->get_merged_extensions(); +$incompatible_plugins = $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]) + if (isset($incompatible_plugins[$plugin_id]) + and $fs_plugin['version'] != $incompatible_plugins[$plugin_id]) { // Incompatible plugins must be reinitilized - $plugins->get_incompatible_plugins(true); + unset($_SESSION['incompatible_plugins']); } $tpl_plugin = array( + 'ID' => $plugin_id, 'NAME' => $fs_plugin['name'], 'VISIT_URL' => $fs_plugin['uri'], 'VERSION' => $fs_plugin['version'], @@ -88,7 +103,6 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) 'AUTHOR' => $fs_plugin['author'], 'AUTHOR_URL' => @$fs_plugin['author uri'], 'U_ACTION' => sprintf($action_url, $plugin_id), - 'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]), ); if (isset($plugins->db_plugins_by_id[$plugin_id])) @@ -100,7 +114,7 @@ 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'])) + if (isset($fs_plugin['extension']) and isset($merged_extensions[$fs_plugin['extension']])) { switch($tpl_plugin['STATE']) { diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl index 618104ca5..ea9ac5108 100644 --- a/admin/themes/default/template/plugins_list.tpl +++ b/admin/themes/default/template/plugins_list.tpl @@ -1,17 +1,26 @@ {footer_script} var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; -incompatible_msg += '\n'; -incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; +var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; {literal} jQuery(document).ready(function() { jQuery('.incompatible').click(function() { return confirm(incompatible_msg); }); - jQuery('.warning').tipTip({ - 'delay' : 0, - 'fadeIn' : 200, - 'fadeOut' : 200 + jQuery.ajax({ + method: 'GET', + url: 'admin.php', + data: { page: 'plugins_list', incompatible_plugins: true }, + dataType: 'json', + success: function(data) { + for (i=0;i<data.length;i++) { + jQuery('#plugin_'+data[i]+' .pluginBoxNameCell') + .addClass('warning') + .attr('title', incompatible_msg) + .tipTip({'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200}); + jQuery('#plugin_'+data[i]+' .activate').attr('onClick', 'return confirm(incompatible_msg + activate_msg);'); + } + } }); }); {/literal}{/footer_script} @@ -44,10 +53,10 @@ jQuery(document).ready(function() { </legend> {foreach from=$plugins item=plugin name=plugins_loop} {if $plugin.STATE == $plugin_state} - <div class="pluginBox"> + <div class="pluginBox" id="plugin_{$plugin.ID}"> <table> <tr> - <td class="pluginBoxNameCell{if $plugin.INCOMPATIBLE} warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}{/if}"> + <td class="pluginBoxNameCell"> {$plugin.NAME} </td> <td>{$plugin.DESC}</td> @@ -58,7 +67,7 @@ jQuery(document).ready(function() { <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> {elseif $plugin_state == 'inactive'} - <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> + <a href="{$plugin.U_ACTION}&action=activate" class="activate">{'Activate'|@translate}</a> | <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> {elseif $plugin_state == 'uninstalled'} diff --git a/install/obsolete_extensions.list b/install/obsolete_extensions.list new file mode 100644 index 000000000..cc983e4cd --- /dev/null +++ b/install/obsolete_extensions.list @@ -0,0 +1,5 @@ +411: pwg_images_addSimple +396: albums +449: Photos +405: unTagged +440: bulk_manager
\ No newline at end of file |