mirror of
https://github.com/unraid/webgui.git
synced 2026-04-29 22:39:20 -05:00
API for plugins to test and display a new version message
`<?if (plugin_update_available('commmunity.applications')):?>
$(function() {
showNotice('The plugin <b>community.applications</b> requires an
update!');
});
<?endif;?>`
This commit is contained in:
@@ -148,6 +148,9 @@ function showFooter(data, id) {
|
||||
if (id !== undefined) $('#'+id).remove();
|
||||
$('#copyright').prepend(data);
|
||||
}
|
||||
function showNotice(data) {
|
||||
$('#user-notice').html(data.replace(/<[ab]>(.*?)<\/[ab]>/,"<a href='/Plugins'>$1</a>"));
|
||||
}
|
||||
function notifier() {
|
||||
$.post('/webGui/include/Notify.php',{cmd:'get'},function(data) {
|
||||
if (data) {
|
||||
@@ -308,7 +311,7 @@ default:
|
||||
}
|
||||
echo "</span>• <span class='bitstream'>Dynamix webGui v";
|
||||
echo exec("/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin version /var/log/plugins/dynamix.plg");
|
||||
echo "</span></span><span id='countdown'></span><span id='copyright'>unRAID™ webGui © 2015, Lime Technology, Inc.";
|
||||
echo "</span></span><span id='countdown'></span><span id='user-notice' class='red-text'></span><span id='copyright'>unRAID™ webGui © 2015, Lime Technology, Inc.";
|
||||
if (isset($myPage['Author'])) {
|
||||
echo " | Page author: {$myPage['Author']}";
|
||||
if (isset($myPage['Version'])) echo ", version: {$myPage['Version']}";
|
||||
|
||||
@@ -32,4 +32,11 @@ function agent_fullname($agent, $state) {
|
||||
default : return $agent;
|
||||
}
|
||||
}
|
||||
|
||||
function plugin_update_available($plugin) {
|
||||
$script = '/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin';
|
||||
$local = file_exists("/var/log/plugins/$plugin.plg") ? exec("$script version /var/log/plugins/$plugin.plg") : "";
|
||||
$remote = file_exists("/tmp/plugins/$plugin.plg") ? exec("$script version /tmp/plugins/$plugin.plg") : "";
|
||||
return strcmp($remote,$local)>0;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user