mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 19:29:58 +03:00
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
This commit is contained in:
parent
d9fbe9bbe9
commit
d8718a6d73
4 changed files with 61 additions and 39 deletions
|
@ -534,30 +534,20 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
|
||||||
|
|
||||||
function get_merged_extensions($version=PHPWG_VERSION)
|
function get_merged_extensions($version=PHPWG_VERSION)
|
||||||
{
|
{
|
||||||
if (isset($_SESSION['merged_extensions']) and $_SESSION['merged_extensions']['~~expire~~'] > time())
|
$file = PHPWG_ROOT_PATH.'install/obsolete_extensions.list';
|
||||||
{
|
$merged_extensions = array();
|
||||||
return $_SESSION['merged_extensions'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['merged_extensions'] = array('~~expire~~' => time() + 600);
|
if (file_exists($file) and $obsolete_ext = file($file, FILE_IGNORE_NEW_LINES) and !empty($obsolete_ext))
|
||||||
|
|
||||||
if (fetchRemote(PHPWG_URL.'/download/merged_extensions.txt', $result))
|
|
||||||
{
|
{
|
||||||
$rows = explode("\n", $result);
|
foreach ($obsolete_ext as $ext)
|
||||||
foreach ($rows as $row)
|
|
||||||
{
|
{
|
||||||
if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match))
|
if (preg_match('/^(\d+) ?: ?(.*?)$/', $ext, $matches))
|
||||||
{
|
{
|
||||||
if (version_compare($version, $match[1], '>='))
|
$merged_extensions[$matches[1]] = $matches[2];
|
||||||
{
|
|
||||||
$extensions = explode(',', trim($match[2]));
|
|
||||||
$_SESSION['merged_extensions'] = array_merge($_SESSION['merged_extensions'], $extensions);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $merged_extensions;
|
||||||
return $_SESSION['merged_extensions'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 |
|
// | start template output |
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
$plugins->sort_fs_plugins('name');
|
$plugins->sort_fs_plugins('name');
|
||||||
$plugins->get_merged_extensions();
|
$merged_extensions = $plugins->get_merged_extensions();
|
||||||
$plugins->get_incompatible_plugins();
|
|
||||||
$merged_plugins = false;
|
$merged_plugins = false;
|
||||||
$tpl_plugins = array();
|
$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])
|
and $fs_plugin['version'] != $_SESSION['incompatible_plugins'][$plugin_id])
|
||||||
{
|
{
|
||||||
// Incompatible plugins must be reinitilized
|
// Incompatible plugins must be reinitilized
|
||||||
$plugins->get_incompatible_plugins(true);
|
unset($_SESSION['incompatible_plugins']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl_plugin = array(
|
$tpl_plugin = array(
|
||||||
|
@ -92,7 +105,6 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
|
||||||
'AUTHOR' => $fs_plugin['author'],
|
'AUTHOR' => $fs_plugin['author'],
|
||||||
'AUTHOR_URL' => @$fs_plugin['author uri'],
|
'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]))
|
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';
|
$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);
|
$plugins->perform_action('uninstall', $plugin_id);
|
||||||
$tpl_plugin['STATE'] = 'merged';
|
$tpl_plugin['STATE'] = 'merged';
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
{footer_script require='jquery.ajaxmanager'}
|
{footer_script require='jquery.ajaxmanager'}
|
||||||
/* incompatible message */
|
/* incompatible message */
|
||||||
var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}';
|
var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}';
|
||||||
incompatible_msg += '\n';
|
var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}';
|
||||||
incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}';
|
|
||||||
|
|
||||||
/* group action */
|
/* group action */
|
||||||
var pwg_token = '{$PWG_TOKEN}';
|
var pwg_token = '{$PWG_TOKEN}';
|
||||||
|
@ -39,18 +38,36 @@ jQuery(document).ready(function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* incompatible message */
|
/* incompatible plugins */
|
||||||
jQuery('.incompatible a.incompatible').click(function() {
|
jQuery(document).ready(function() {
|
||||||
return confirm(incompatible_msg);
|
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 */
|
/* TipTips */
|
||||||
jQuery('.warning').tipTip({
|
|
||||||
'delay' : 0,
|
|
||||||
'fadeIn' : 200,
|
|
||||||
'fadeOut' : 200,
|
|
||||||
'maxWidth':'250px'
|
|
||||||
});
|
|
||||||
jQuery('.plugin-restore').tipTip({
|
jQuery('.plugin-restore').tipTip({
|
||||||
'delay' : 0,
|
'delay' : 0,
|
||||||
'fadeIn' : 200,
|
'fadeIn' : 200,
|
||||||
|
@ -117,11 +134,10 @@ jQuery(document).ready(function() {
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $plugin_display == 'complete'}
|
{if $plugin_display == 'complete'}
|
||||||
<div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}">
|
<div id="{$plugin.ID}" class="pluginBox">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pluginBoxNameCell">
|
<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}
|
{$plugin.NAME}
|
||||||
</td>
|
</td>
|
||||||
<td>{$plugin.DESC}</td>
|
<td>{$plugin.DESC}</td>
|
||||||
|
@ -133,7 +149,7 @@ jQuery(document).ready(function() {
|
||||||
| <a href="{$plugin.U_ACTION}&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>
|
| <a href="{$plugin.U_ACTION}&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'}
|
{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=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
|
| <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
|
||||||
|
|
||||||
{elseif $plugin.STATE == 'missing'}
|
{elseif $plugin.STATE == 'missing'}
|
||||||
|
@ -165,9 +181,8 @@ jQuery(document).ready(function() {
|
||||||
{assign var='version' value=$plugin.VERSION}
|
{assign var='version' value=$plugin.VERSION}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}">
|
<div id="{$plugin.ID}" class="pluginMiniBox">
|
||||||
<div class="pluginMiniBoxNameCell">
|
<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}
|
{$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>
|
<a class="showInfo" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$plugin.DESC|@escape:'html'}">i</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -178,7 +193,7 @@ jQuery(document).ready(function() {
|
||||||
| <a href="{$plugin.U_ACTION}&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>
|
| <a href="{$plugin.U_ACTION}&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'}
|
{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=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
|
| <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
|
||||||
|
|
||||||
{elseif $plugin.STATE == 'missing'}
|
{elseif $plugin.STATE == 'missing'}
|
||||||
|
|
5
install/obsolete_extensions.list
Normal file
5
install/obsolete_extensions.list
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
411: pwg_images_addSimple
|
||||||
|
396: albums
|
||||||
|
449: Photos
|
||||||
|
405: unTagged
|
||||||
|
440: bulk_manager
|
Loading…
Add table
Add a link
Reference in a new issue