From 595b5a3f209ab0cd3bf10611e42fb63efe5d2b41 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 10 Oct 2022 22:07:54 +1100 Subject: [PATCH] one click updates --- Code/Module/Admin.php | 8 +++- view/tpl/admin_summary.tpl | 96 ++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/Code/Module/Admin.php b/Code/Module/Admin.php index 0880fa1d4..f05803ecb 100644 --- a/Code/Module/Admin.php +++ b/Code/Module/Admin.php @@ -44,6 +44,10 @@ class Admin extends Controller if (argc() > 1) { $this->sm->call('init'); } + if ($_GET['upgrade']) { + exec("util/udall > upgrade.log"); + goaway(z_root() . '/admin'); + } } @@ -165,7 +169,7 @@ class Admin extends Controller $vrelease = get_repository_version('release'); $vdev = get_repository_version('dev'); $upgrade = ((version_compare(STD_VERSION, $vrelease) < 0) ? t('Your software should be updated') : ''); - + $git_cmd = exec('which git'); $t = Theme::get_template('admin_summary.tpl'); return replace_macros($t, [ '$title' => t('Administration'), @@ -180,6 +184,8 @@ class Admin extends Controller '$vmaster' => [t('Repository version (release)'), $vrelease], '$vdev' => [t('Repository version (dev)'), $vdev], '$upgrade' => $upgrade, + '$update' => t('Update'), + '$can_upgrade' => is_dir('.git') && $git_cmd, '$build' => Config::Get('system', 'db_version') ]); } diff --git a/view/tpl/admin_summary.tpl b/view/tpl/admin_summary.tpl index a70e21586..a59be6cc1 100755 --- a/view/tpl/admin_summary.tpl +++ b/view/tpl/admin_summary.tpl @@ -1,51 +1,55 @@
-

{{$title}} - {{$page}}

-
+

{{$title}} - {{$page}}

+
{{if $adminalertmsg}} - + {{/if}} {{if $upgrade}} - + + {{if $can_upgrade}} +
{{$update}}
+ {{/if}} +
{{/if}} -
-
{{$queues.label}}
-
{{$queues.queue}}
-
-
-
{{$accounts.0}}
-
{{foreach from=$accounts.1 item=acc name=account}}{{$acc.val}} {{$acc.label}}{{if !$smarty.foreach.account.last}} / {{/if}}{{/foreach}}
-
-
-
{{$pending.0}}
-
{{$pending.1}} -
-
-
{{$channels.0}}
-
{{foreach from=$channels.1 item=ch name=chan}}{{$ch.val}} {{$ch.label}}{{if !$smarty.foreach.chan.last}} / {{/if}}{{/foreach}}
-
- {{if $plugins}} -
-
{{$plugins.0}}
-
- {{foreach $plugins.1 as $p}} {{$p}} {{/foreach}} -
-
- {{/if}} -
-
{{$version.0}}
-
{{$version.1}} - {{$build}}
-
- {{if $vmaster.1}} -
-
{{$vmaster.0}}
-
{{$vmaster.1}}
-
- {{/if}} - {{if $vdev.1}} -
-
{{$vdev.0}}
-
{{$vdev.1}}
-
- {{/if}} -
-
\ No newline at end of file +
+
{{$queues.label}}
+
{{$queues.queue}}
+
+
+
{{$accounts.0}}
+
{{foreach from=$accounts.1 item=acc name=account}}{{$acc.val}} {{$acc.label}}{{if !$smarty.foreach.account.last}} / {{/if}}{{/foreach}}
+
+
+
{{$pending.0}}
+
{{$pending.1}} +
+
+
{{$channels.0}}
+
{{foreach from=$channels.1 item=ch name=chan}}{{$ch.val}} {{$ch.label}}{{if !$smarty.foreach.chan.last}} / {{/if}}{{/foreach}}
+
+ {{if $plugins}} +
+
{{$plugins.0}}
+
+ {{foreach $plugins.1 as $p}} {{$p}} {{/foreach}} +
+
+ {{/if}} +
+
{{$version.0}}
+
{{$version.1}} - {{$build}}
+
+ {{if $vmaster.1}} +
+
{{$vmaster.0}}
+
{{$vmaster.1}}
+
+ {{/if}} + {{if $vdev.1}} +
+
{{$vdev.0}}
+
{{$vdev.1}}
+
+ {{/if}} + +