mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 01:42:29 +02:00
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
This commit is contained in:
@@ -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'];
|
||||
}
|
||||
$file = PHPWG_ROOT_PATH.'install/obsolete_extensions.list';
|
||||
$merged_extensions = array();
|
||||
|
||||
$_SESSION['merged_extensions'] = array('~~expire~~' => time() + 600);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+21
-7
@@ -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'])
|
||||
{
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
411: pwg_images_addSimple
|
||||
396: albums
|
||||
449: Photos
|
||||
405: unTagged
|
||||
440: bulk_manager
|
||||
Reference in New Issue
Block a user