aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-05-25 10:54:59 +0000
committerpatdenice <patdenice@piwigo.org>2011-05-25 10:54:59 +0000
commitd8718a6d73cb203f3875f31dc38c2978e0484834 (patch)
tree08881e707cbb2730ac2daa38a5e1a429b67c10f3
parentd9fbe9bbe9a7686fd85e0ad6e3a21bdf07b87c5c (diff)
merge r11043 from branch 2.2 to trunk
feature:2250 Add obsolete_extensions.list file in install directory. Incompatible plugins is checked through ajax. git-svn-id: http://piwigo.org/svn/trunk@11047 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/include/plugins.class.php24
-rw-r--r--admin/plugins_installed.php22
-rw-r--r--admin/themes/default/template/plugins_list.tpl49
-rw-r--r--install/obsolete_extensions.list5
4 files changed, 61 insertions, 39 deletions
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php
index d1b8f5c5b..22e58857c 100644
--- a/admin/include/plugins.class.php
+++ b/admin/include/plugins.class.php
@@ -534,30 +534,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_installed.php b/admin/plugins_installed.php
index 4cefe45e4..26ba295e2 100644
--- a/admin/plugins_installed.php
+++ b/admin/plugins_installed.php
@@ -64,13 +64,26 @@ if (isset($_GET['action']) and isset($_GET['plugin']))
}
}
+//--------------------------------------------------------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();
$merged_plugins = false;
$tpl_plugins = array();
@@ -80,7 +93,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id])
{
// Incompatible plugins must be reinitilized
- $plugins->get_incompatible_plugins(true);
+ unset($_SESSION['incompatible_plugins']);
}
$tpl_plugin = array(
@@ -92,7 +105,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]))
@@ -104,7 +116,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$tpl_plugin['STATE'] = 'inactive';
}
- 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']]))
{
$plugins->perform_action('uninstall', $plugin_id);
$tpl_plugin['STATE'] = 'merged';
diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl
index 1f11865b2..c7480a9e7 100644
--- a/admin/themes/default/template/plugins_list.tpl
+++ b/admin/themes/default/template/plugins_list.tpl
@@ -3,8 +3,7 @@
{footer_script require='jquery.ajaxmanager'}
/* incompatible message */
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'}';
/* group action */
var pwg_token = '{$PWG_TOKEN}';
@@ -39,18 +38,36 @@ jQuery(document).ready(function() {
});
};
- /* incompatible message */
- jQuery('.incompatible a.incompatible').click(function() {
- return confirm(incompatible_msg);
+ /* incompatible plugins */
+ jQuery(document).ready(function() {
+ jQuery.ajax({
+ method: 'GET',
+ url: 'admin.php',
+ data: { page: 'plugins_installed', incompatible_plugins: true },
+ dataType: 'json',
+ success: function(data) {
+ for (i=0;i<data.length;i++) {
+ {/literal}
+ {if $plugin_display == 'complete'}
+ jQuery('#'+data[i]+' .pluginBoxNameCell').prepend('<a class="warning" title="'+incompatible_msg+'"></a>')
+ {else}
+ jQuery('#'+data[i]+' .pluginMiniBoxNameCell').prepend('<span class="warning" title="'+incompatible_msg+'"></span>')
+ {/if}
+ {literal}
+ jQuery('#'+data[i]).addClass('incompatible');
+ jQuery('#'+data[i]+' .activate').attr('onClick', 'return confirm(incompatible_msg + activate_msg);');
+ }
+ jQuery('.warning').tipTip({
+ 'delay' : 0,
+ 'fadeIn' : 200,
+ 'fadeOut' : 200,
+ 'maxWidth':'250px'
+ });
+ }
+ });
});
/* TipTips */
- jQuery('.warning').tipTip({
- 'delay' : 0,
- 'fadeIn' : 200,
- 'fadeOut' : 200,
- 'maxWidth':'250px'
- });
jQuery('.plugin-restore').tipTip({
'delay' : 0,
'fadeIn' : 200,
@@ -117,11 +134,10 @@ jQuery(document).ready(function() {
{/if}
{if $plugin_display == 'complete'}
- <div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}">
+ <div id="{$plugin.ID}" class="pluginBox">
<table>
<tr>
<td class="pluginBoxNameCell">
- {if $plugin.INCOMPATIBLE}<a class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></a>{/if}
{$plugin.NAME}
</td>
<td>{$plugin.DESC}</td>
@@ -133,7 +149,7 @@ jQuery(document).ready(function() {
| <a href="{$plugin.U_ACTION}&amp;action=restore" class="plugin-restore" title="{'Restore default configuration. You will lost your plugin settings!'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a>
{elseif $plugin.STATE == 'inactive'}
- <a href="{$plugin.U_ACTION}&amp;action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a>
+ <a href="{$plugin.U_ACTION}&amp;action=activate" class="activate">{'Activate'|@translate}</a>
| <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
{elseif $plugin.STATE == 'missing'}
@@ -165,9 +181,8 @@ jQuery(document).ready(function() {
{assign var='version' value=$plugin.VERSION}
{/if}
- <div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}">
+ <div id="{$plugin.ID}" class="pluginMiniBox">
<div class="pluginMiniBoxNameCell">
- {if $plugin.INCOMPATIBLE}<span class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></span>{/if}
{$plugin.NAME}
<a class="showInfo" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$plugin.DESC|@escape:'html'}">i</a>
</div>
@@ -178,7 +193,7 @@ jQuery(document).ready(function() {
| <a href="{$plugin.U_ACTION}&amp;action=restore" class="plugin-restore" title="{'Restore default configuration. You will lost all your settings !'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a>
{elseif $plugin.STATE == 'inactive'}
- <a href="{$plugin.U_ACTION}&amp;action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a>
+ <a href="{$plugin.U_ACTION}&amp;action=activate" class="activate">{'Activate'|@translate}</a>
| <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
{elseif $plugin.STATE == 'missing'}
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