one click updates

This commit is contained in:
Mike Macgirvin 2022-10-10 22:07:54 +11:00
parent 297aa52014
commit 595b5a3f20
2 changed files with 57 additions and 47 deletions

View file

@ -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')
]);
}

View file

@ -1,51 +1,55 @@
<div class="generic-content-wrapper" id='adminpage'>
<div class="section-title-wrapper"><h1>{{$title}} - {{$page}}</h1></div>
<div class="section-content-wrapper">
<div class="section-title-wrapper"><h1>{{$title}} - {{$page}}</h1></div>
<div class="section-content-wrapper">
{{if $adminalertmsg}}
<p class="alert alert-warning" role="alert">{{$adminalertmsg}}</p>
<p class="alert alert-warning" role="alert">{{$adminalertmsg}}</p>
{{/if}}
{{if $upgrade}}
<p class="alert alert-warning" role="alert">{{$upgrade}}</p>
<div class="alert alert-warning" role="alert">{{$upgrade}}</div>
{{if $can_upgrade}}
<center><a href="admin?upgrade=true" class="btn btn-std btn-primary" style="color: #FFF;">{{$update}}</a></center>
{{/if}}
</div>
{{/if}}
<dl>
<dt>{{$queues.label}}</dt>
<dd>{{$queues.queue}}</dd>
</dl>
<dl>
<dt>{{$accounts.0}}</dt>
<dd>{{foreach from=$accounts.1 item=acc name=account}}<span title="{{$acc.label}}">{{$acc.val}} {{$acc.label}}</span>{{if !$smarty.foreach.account.last}} / {{/if}}{{/foreach}}</dd>
</dl>
<dl>
<dt>{{$pending.0}}</dt>
<dd>{{$pending.1}}</dt>
</dl>
<dl>
<dt>{{$channels.0}}</dt>
<dd>{{foreach from=$channels.1 item=ch name=chan}}<span title="{{$ch.label}}">{{$ch.val}} {{$ch.label}}</span>{{if !$smarty.foreach.chan.last}} / {{/if}}{{/foreach}}</dd>
</dl>
{{if $plugins}}
<dl>
<dt>{{$plugins.0}}</dt>
<dd>
{{foreach $plugins.1 as $p}} {{$p}} {{/foreach}}
</dd>
</dl>
{{/if}}
<dl>
<dt>{{$version.0}}</dt>
<dd>{{$version.1}} - {{$build}}</dd>
</dl>
{{if $vmaster.1}}
<dl>
<dt>{{$vmaster.0}}</dt>
<dd>{{$vmaster.1}}</dd>
</dl>
{{/if}}
{{if $vdev.1}}
<dl>
<dt>{{$vdev.0}}</dt>
<dd>{{$vdev.1}}</dd>
</dl>
{{/if}}
</div>
</div>
<dl>
<dt>{{$queues.label}}</dt>
<dd>{{$queues.queue}}</dd>
</dl>
<dl>
<dt>{{$accounts.0}}</dt>
<dd>{{foreach from=$accounts.1 item=acc name=account}}<span title="{{$acc.label}}">{{$acc.val}} {{$acc.label}}</span>{{if !$smarty.foreach.account.last}} / {{/if}}{{/foreach}}</dd>
</dl>
<dl>
<dt>{{$pending.0}}</dt>
<dd>{{$pending.1}}</dt>
</dl>
<dl>
<dt>{{$channels.0}}</dt>
<dd>{{foreach from=$channels.1 item=ch name=chan}}<span title="{{$ch.label}}">{{$ch.val}} {{$ch.label}}</span>{{if !$smarty.foreach.chan.last}} / {{/if}}{{/foreach}}</dd>
</dl>
{{if $plugins}}
<dl>
<dt>{{$plugins.0}}</dt>
<dd>
{{foreach $plugins.1 as $p}} {{$p}} {{/foreach}}
</dd>
</dl>
{{/if}}
<dl>
<dt>{{$version.0}}</dt>
<dd>{{$version.1}} - {{$build}}</dd>
</dl>
{{if $vmaster.1}}
<dl>
<dt>{{$vmaster.0}}</dt>
<dd>{{$vmaster.1}}</dd>
</dl>
{{/if}}
{{if $vdev.1}}
<dl>
<dt>{{$vdev.0}}</dt>
<dd>{{$vdev.1}}</dd>
</dl>
{{/if}}
</div>
</div>