From 4dd3839c41e18d9724855e7955d8737b6f52dcd6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 10 May 2016 21:46:04 -0700 Subject: provide repository versions on admin summary page and an upgrade message if you're behind master --- Zotlabs/Module/Admin.php | 21 +++++++++++++++------ Zotlabs/Module/Siteinfo.php | 2 +- include/network.php | 15 +++++++++++++++ view/tpl/admin_summary.tpl | 11 +++++++++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 0e3ee68c4..94482b39d 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -107,7 +107,7 @@ class Admin extends \Zotlabs\Web\Controller { * @param App &$a * @return string */ - function get() { + function get() { logger('admin_content', LOGGER_DEBUG); @@ -229,18 +229,27 @@ class Admin extends \Zotlabs\Web\Controller { . '
PHP 5.3 has reached its End of Life (EOL) in August 2014.' . ' A list about current PHP versions can be found here.'; } - + + $vmaster = get_repository_version('master'); + $vdev = get_repository_version('dev'); + + $upgrade = ((version_compare(STD_VERSION,$vmaster) < 0) ? t('Your software should be updated') : ''); + + $t = get_markup_template('admin_summary.tpl'); return replace_macros($t, array( '$title' => t('Administration'), '$page' => t('Summary'), '$adminalertmsg' => $alertmsg, - '$queues' => $queues, + '$queues' => $queues, '$accounts' => array( t('Registered accounts'), $accounts), - '$pending' => array( t('Pending registrations'), $pending), + '$pending' => array( t('Pending registrations'), $pending), '$channels' => array( t('Registered channels'), $channels), - '$plugins' => array( t('Active plugins'), $plugins ), - '$version' => array( t('Version'), STD_VERSION), + '$plugins' => array( t('Active plugins'), $plugins ), + '$version' => array( t('Version'), STD_VERSION), + '$vmaster' => array( t('Repository version (master)'), $vmaster), + '$vdev' => array( t('Repository version (dev)'), $vdev), + '$upgrade' => $upgrade, '$build' => get_config('system', 'db_version') )); } diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php index ccca6ab43..c65277004 100644 --- a/Zotlabs/Module/Siteinfo.php +++ b/Zotlabs/Module/Siteinfo.php @@ -13,7 +13,7 @@ class Siteinfo extends \Zotlabs\Web\Controller { - function get() { + function get() { if(! get_config('system','hidden_version_siteinfo')) { $version = sprintf( t('Version %s'), \Zotlabs\Project\System::get_project_version()); diff --git a/include/network.php b/include/network.php index 395641b73..9f68d3df3 100644 --- a/include/network.php +++ b/include/network.php @@ -2128,3 +2128,18 @@ function deliverable_singleton($channel_id,$xchan) { return false; } + + +function get_repository_version($branch = 'master') { + + $path = "https://raw.githubusercontent.com/redmatrix/hubzilla/$branch/boot.php"; + + $x = z_fetch_url($path); + if($x['success']) { + $y = preg_match('/define(.*?)STD_VERSION(.*?)([0-9.].*)\'/',$x['body'],$matches); + if($y) + return $matches[3]; + } + return '?.?'; + +} diff --git a/view/tpl/admin_summary.tpl b/view/tpl/admin_summary.tpl index 259640849..ca94b0ef7 100755 --- a/view/tpl/admin_summary.tpl +++ b/view/tpl/admin_summary.tpl @@ -2,6 +2,9 @@

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

{{if $adminalertmsg}} +{{/if}} +{{if $upgrade}} + {{/if}}
{{$queues.label}}
@@ -29,4 +32,12 @@
{{$version.0}}
{{$version.1}} - {{$build}}
+
+
{{$vmaster.0}}
+
{{$vmaster.1}}
+
+
+
{{$vdev.0}}
+
{{$vdev.1}}
+
\ No newline at end of file -- cgit v1.2.3