From 778c83bf25e3d1318414b99f629452505e9a2c36 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 9 Oct 2017 20:54:18 +0200 Subject: [PATCH 01/20] show a notification in the admin panel if a newer version is available --- mod/admin.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mod/admin.php b/mod/admin.php index 4f0622532..1e3005ea0 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -615,6 +615,17 @@ function admin_page_summary(App $a) { $showwarning = true; $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the command php include/dbstructure.php toinnodb of your Friendica installation for an automatic conversion.
'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); } + // Check if github.com/friendica/master/VERSION is higher then + // the local version of Friendica. + $gitversion = Cache::get("git_friendica_version"); + if (! isset($gitversion)) { + $gitversion = dbesc(trim(fetch_url("https://raw.githubusercontent.com/friendica/friendica/master/VERSION"))); + Cache::set("git_friendica_version", $gitversion, CACHE_WEEK); + } + if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { + $warningtext[] = t('There is a new version of friendica available.'); + $showwarning = true; + } if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) { require_once("include/dbstructure.php"); From 79add903feb4316b55fba11f08c89be07dd2e8a6 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 9 Oct 2017 20:57:24 +0200 Subject: [PATCH 02/20] wording --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index 1e3005ea0..cdf5fa163 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -623,7 +623,7 @@ function admin_page_summary(App $a) { Cache::set("git_friendica_version", $gitversion, CACHE_WEEK); } if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { - $warningtext[] = t('There is a new version of friendica available.'); + $warningtext[] = t('There is a new version of Friendica available for download.'); $showwarning = true; } From 1928217f83d93c36b80344e2f3700fe76adaa493 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 9 Oct 2017 21:18:06 +0200 Subject: [PATCH 03/20] added config wrapper around new option, opt-in --- mod/admin.php | 21 +++++++++++++-------- view/templates/admin_site.tpl | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index cdf5fa163..59ee4d18f 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -617,14 +617,16 @@ function admin_page_summary(App $a) { } // Check if github.com/friendica/master/VERSION is higher then // the local version of Friendica. - $gitversion = Cache::get("git_friendica_version"); - if (! isset($gitversion)) { - $gitversion = dbesc(trim(fetch_url("https://raw.githubusercontent.com/friendica/friendica/master/VERSION"))); - Cache::set("git_friendica_version", $gitversion, CACHE_WEEK); - } - if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { - $warningtext[] = t('There is a new version of Friendica available for download.'); - $showwarning = true; + if (Config::get('system', 'check_new_version')) { + $gitversion = Cache::get("git_friendica_version"); + if (! isset($gitversion)) { + $gitversion = dbesc(trim(fetch_url("https://raw.githubusercontent.com/friendica/friendica/master/VERSION"))); + Cache::set("git_friendica_version", $gitversion, CACHE_WEEK); + } + if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { + $warningtext[] = t('There is a new version of Friendica available for download.'); + $showwarning = true; + } } if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) { @@ -819,6 +821,7 @@ function admin_page_site_post(App $a) { $private_addons = ((x($_POST,'private_addons')) ? True : False); $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False); $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False); + $check_new_version = ((x($_POST,'check_new_version')) ? True : False); $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False); $no_openid = !((x($_POST,'no_openid')) ? True : False); @@ -978,6 +981,7 @@ function admin_page_site_post(App $a) { set_config('system', 'enotify_no_content', $enotify_no_content); set_config('system', 'disable_embedded', $disable_embedded); set_config('system', 'allow_users_remote_self', $allow_users_remote_self); + set_config('system', 'check_new_version', $check_new_version); set_config('system', 'block_extended_register', $no_multi_reg); set_config('system', 'no_openid', $no_openid); @@ -1211,6 +1215,7 @@ function admin_page_site(App $a) { '$private_addons' => array('private_addons', t("Disallow public access to addons listed in the apps menu."), get_config('config','private_addons'), t("Checking this box will restrict addons listed in the apps menu to members only.")), '$disable_embedded' => array('disable_embedded', t("Don't embed private images in posts"), get_config('system','disable_embedded'), t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.")), '$allow_users_remote_self' => array('allow_users_remote_self', t('Allow Users to set remote_self'), get_config('system','allow_users_remote_self'), t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')), + '$check_new_version' => array('check_new_version', t('Check for new versions'), get_config('system','check_new_version'), t('If this is activated, once weekly github will be checked if there is a new version of Friendica available.')), '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")), '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")), '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")), diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 715b422de..a80c580a8 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -110,6 +110,7 @@ {{include file="field_checkbox.tpl" field=$private_addons}} {{include file="field_checkbox.tpl" field=$disable_embedded}} {{include file="field_checkbox.tpl" field=$allow_users_remote_self}} + {{include file="field_checkbox.tpl" field=$check_new_version}}

{{$advanced}}

From 22efc4833c83d2ffd74a6b26a241a676dad0381d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 08:14:56 +0100 Subject: [PATCH 04/20] call checkversion from cron jobs, LOW prio --- include/checkversion.php | 34 ++++++++++++++++++++++++++++++++++ include/cron.php | 3 +++ 2 files changed, 37 insertions(+) create mode 100644 include/checkversion.php diff --git a/include/checkversion.php b/include/checkversion.php new file mode 100644 index 000000000..8993a1cff --- /dev/null +++ b/include/checkversion.php @@ -0,0 +1,34 @@ + Date: Sat, 4 Nov 2017 08:15:28 +0100 Subject: [PATCH 05/20] settings for checkversion --- mod/admin.php | 17 ++++++++++------- view/templates/admin_site.tpl | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 59ee4d18f..ea87dbb03 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -616,13 +616,9 @@ function admin_page_summary(App $a) { $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the command php include/dbstructure.php toinnodb of your Friendica installation for an automatic conversion.
'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); } // Check if github.com/friendica/master/VERSION is higher then - // the local version of Friendica. + // the local version of Friendica. Check is opt-in, source may be master or devel branch if (Config::get('system', 'check_new_version')) { - $gitversion = Cache::get("git_friendica_version"); - if (! isset($gitversion)) { - $gitversion = dbesc(trim(fetch_url("https://raw.githubusercontent.com/friendica/friendica/master/VERSION"))); - Cache::set("git_friendica_version", $gitversion, CACHE_WEEK); - } + $gitversion = Config::get('system','git_friendica_version'); if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { $warningtext[] = t('There is a new version of Friendica available for download.'); $showwarning = true; @@ -981,7 +977,7 @@ function admin_page_site_post(App $a) { set_config('system', 'enotify_no_content', $enotify_no_content); set_config('system', 'disable_embedded', $disable_embedded); set_config('system', 'allow_users_remote_self', $allow_users_remote_self); - set_config('system', 'check_new_version', $check_new_version); + set_config('system', 'check_new_version_url', $check_new_version_url); set_config('system', 'block_extended_register', $no_multi_reg); set_config('system', 'no_openid', $no_openid); @@ -1151,6 +1147,12 @@ function admin_page_site(App $a) { SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)") ); + $check_git_version_choices = array( + "none" => t("Don't check"), + "https://raw.githubusercontent.com/friendica/friendica/master/VERSION" => t("check the stable version"), + "https://raw.githubusercontent.com/friendica/friendica/develop/VERSION" => t("check the development version") + ); + if ($a->config['hostname'] == "") { $a->config['hostname'] = $a->get_hostname(); } @@ -1246,6 +1248,7 @@ function admin_page_site(App $a) { '$nodeinfo' => array('nodeinfo', t("Publish server information"), get_config('system','nodeinfo'), t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See the-federation.info for details.")), + '$checknreversionurl' => array('check_new_version_url', t("Check upstream version"), get_config('system', 'check_new_version_url'), t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices), '$suppress_tags' => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")), '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")), '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")), diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index a80c580a8..78695054b 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -127,6 +127,7 @@ {{include file="field_input.tpl" field=$basepath}} {{include file="field_checkbox.tpl" field=$suppress_tags}} {{include file="field_checkbox.tpl" field=$nodeinfo}} + {{include file="field_select.tpl" field=$checknewversionurl}}

{{$portable_contacts}}

From 33ad8117ce07d6195b024df56de33a2c21e3b360 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 08:22:42 +0100 Subject: [PATCH 06/20] this setting is not used anymore --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index ea87dbb03..4f92c8154 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -617,7 +617,7 @@ function admin_page_summary(App $a) { } // Check if github.com/friendica/master/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be master or devel branch - if (Config::get('system', 'check_new_version')) { + if (! Config::get('system', 'check_new_version_url', 'none') == 'none' ) { $gitversion = Config::get('system','git_friendica_version'); if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { $warningtext[] = t('There is a new version of Friendica available for download.'); From 87c39cc396bfe3e32baa16840f87c67364a4ce63 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 08:23:56 +0100 Subject: [PATCH 07/20] this setting is not used anymore --- mod/admin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index 4f92c8154..1a3a235a7 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -817,7 +817,6 @@ function admin_page_site_post(App $a) { $private_addons = ((x($_POST,'private_addons')) ? True : False); $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False); $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False); - $check_new_version = ((x($_POST,'check_new_version')) ? True : False); $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False); $no_openid = !((x($_POST,'no_openid')) ? True : False); From 08977cbc6ba3ce965d93e38f39894701a44e3512 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 08:32:34 +0100 Subject: [PATCH 08/20] this setting is not used anymore --- mod/admin.php | 1 - 1 file changed, 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index 1a3a235a7..65aeaeb86 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1216,7 +1216,6 @@ function admin_page_site(App $a) { '$private_addons' => array('private_addons', t("Disallow public access to addons listed in the apps menu."), get_config('config','private_addons'), t("Checking this box will restrict addons listed in the apps menu to members only.")), '$disable_embedded' => array('disable_embedded', t("Don't embed private images in posts"), get_config('system','disable_embedded'), t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.")), '$allow_users_remote_self' => array('allow_users_remote_self', t('Allow Users to set remote_self'), get_config('system','allow_users_remote_self'), t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')), - '$check_new_version' => array('check_new_version', t('Check for new versions'), get_config('system','check_new_version'), t('If this is activated, once weekly github will be checked if there is a new version of Friendica available.')), '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")), '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")), '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")), From b6f1a0be5a6e20c83e93c4d32865e6e5f622f691 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 08:34:47 +0100 Subject: [PATCH 09/20] and it is not used in the template anymore as well --- view/templates/admin_site.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 78695054b..987da171a 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -110,7 +110,6 @@ {{include file="field_checkbox.tpl" field=$private_addons}} {{include file="field_checkbox.tpl" field=$disable_embedded}} {{include file="field_checkbox.tpl" field=$allow_users_remote_self}} - {{include file="field_checkbox.tpl" field=$check_new_version}}

{{$advanced}}

From 53f83dc0a1016be7dcbb009f8320519ea1770ca8 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 09:31:57 +0100 Subject: [PATCH 10/20] typo --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index 65aeaeb86..9f432f5fc 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1246,7 +1246,7 @@ function admin_page_site(App $a) { '$nodeinfo' => array('nodeinfo', t("Publish server information"), get_config('system','nodeinfo'), t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See the-federation.info for details.")), - '$checknreversionurl' => array('check_new_version_url', t("Check upstream version"), get_config('system', 'check_new_version_url'), t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices), + '$checknewversionurl' => array('check_new_version_url', t("Check upstream version"), get_config('system', 'check_new_version_url'), t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices), '$suppress_tags' => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")), '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")), '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")), From 6ee747dee82dd652c0c6e4e26250fafb905773d1 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 4 Nov 2017 09:48:20 +0100 Subject: [PATCH 11/20] missed something --- mod/admin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/admin.php b/mod/admin.php index 9f432f5fc..20f7768a0 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -856,6 +856,7 @@ function admin_page_site_post(App $a) { $proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False); $only_tag_search = ((x($_POST,'only_tag_search')) ? True : False); $rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0); + $check_new_version_url = ((x($_POST, 'check_new_version_url')) ? notags(trim($_POST['check_new_version_url'])) : 'none'); $worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4); $worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False); $worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False); From 3c60e6f1839e600cca4d6f0719b316a408686d28 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 5 Nov 2017 07:10:46 +0100 Subject: [PATCH 12/20] missing value --- include/checkversion.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/checkversion.php b/include/checkversion.php index 8993a1cff..ee6c04a55 100644 --- a/include/checkversion.php +++ b/include/checkversion.php @@ -26,7 +26,7 @@ function checkversion_run () { return; } $gitversion = dbesc(trim(fetch_url($checkurl))); - Config::set('system', 'git_friendica_version'); + Config::set('system', 'git_friendica_version', $gitversion); logger('checkversion: end'); From 0d0751fce3b03bbe791d1c2fb65090ec179f0da2 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 5 Nov 2017 07:45:49 +0100 Subject: [PATCH 13/20] comparison works now --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index 20f7768a0..c41bcdc4a 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -617,7 +617,7 @@ function admin_page_summary(App $a) { } // Check if github.com/friendica/master/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be master or devel branch - if (! Config::get('system', 'check_new_version_url', 'none') == 'none' ) { + if (Config::get('system', 'check_new_version_url', 'none') != 'none' ) { $gitversion = Config::get('system','git_friendica_version'); if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { $warningtext[] = t('There is a new version of Friendica available for download.'); From a1fcff67f2f0f8cd8fa04edc5ee4c3ae8f4a9761 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 5 Nov 2017 08:46:41 +0100 Subject: [PATCH 14/20] added some EN docs --- doc/Settings.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/Settings.md b/doc/Settings.md index e30b48929..a0b33d76d 100644 --- a/doc/Settings.md +++ b/doc/Settings.md @@ -164,6 +164,12 @@ However these aren't looked upon favourably in the security community because th If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites. +#### Check upstream version + +If this option is enabled your Friendica node will check the upstream version once per day from the github repository. +You can select if the stable version or the development version should be checked out. +If there is a new version published, you will get notified in the admin panel summary page. + ### Auto Discovered Contact Directory ### Performance From 1f9b52f2bf62a00add5b62b21e2dd009246345ef Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 6 Nov 2017 17:45:33 +0100 Subject: [PATCH 15/20] code corrections --- include/checkversion.php | 2 +- include/cron.php | 2 +- mod/admin.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/checkversion.php b/include/checkversion.php index ee6c04a55..6cd34b2ce 100644 --- a/include/checkversion.php +++ b/include/checkversion.php @@ -22,7 +22,7 @@ function checkversion_run () { $checkurl = Config::get('system', 'check_new_version_url', 'none'); // check for new versions at all? - if ( $checkurl == 'none' ) { + if ($checkurl == 'none' ) { return; } $gitversion = dbesc(trim(fetch_url($checkurl))); diff --git a/include/cron.php b/include/cron.php index f65e5851b..8842d3bdf 100644 --- a/include/cron.php +++ b/include/cron.php @@ -81,7 +81,7 @@ function cron_run(&$argv, &$argc){ dba::delete('workerqueue', array('`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 12 HOUR')); // check upstream version? - proc_run(PRIORITY_LOW, 'include/checkversion.php'); + Worker::add(PRIORITY_LOW, 'checkversion'); } // Poll contacts diff --git a/mod/admin.php b/mod/admin.php index c41bcdc4a..dba180c12 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -619,7 +619,7 @@ function admin_page_summary(App $a) { // the local version of Friendica. Check is opt-in, source may be master or devel branch if (Config::get('system', 'check_new_version_url', 'none') != 'none' ) { $gitversion = Config::get('system','git_friendica_version'); - if ( version_compare(FRIENDICA_VERSION, $gitversion)<0) { + if (version_compare(FRIENDICA_VERSION, $gitversion)<0) { $warningtext[] = t('There is a new version of Friendica available for download.'); $showwarning = true; } @@ -856,7 +856,7 @@ function admin_page_site_post(App $a) { $proxy_disabled = ((x($_POST,'proxy_disabled')) ? True : False); $only_tag_search = ((x($_POST,'only_tag_search')) ? True : False); $rino = ((x($_POST,'rino')) ? intval($_POST['rino']) : 0); - $check_new_version_url = ((x($_POST, 'check_new_version_url')) ? notags(trim($_POST['check_new_version_url'])) : 'none'); + $check_new_version_url = ((x($_POST, 'check_new_version_url')) ? notags(trim($_POST['check_new_version_url'])) : 'none'); $worker_queues = ((x($_POST,'worker_queues')) ? intval($_POST['worker_queues']) : 4); $worker_dont_fork = ((x($_POST,'worker_dont_fork')) ? True : False); $worker_fastlane = ((x($_POST,'worker_fastlane')) ? True : False); From 143e7fc6b707f377d383a498999ce712d04dd102 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 6 Nov 2017 18:05:42 +0100 Subject: [PATCH 16/20] dont use the entire url as option --- include/checkversion.php | 2 +- mod/admin.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/checkversion.php b/include/checkversion.php index 6cd34b2ce..0567a5954 100644 --- a/include/checkversion.php +++ b/include/checkversion.php @@ -25,7 +25,7 @@ function checkversion_run () { if ($checkurl == 'none' ) { return; } - $gitversion = dbesc(trim(fetch_url($checkurl))); + $gitversion = dbesc(trim(fetch_url("https://raw.githubusercontent.com/friendica/friendica/".$checkurl."/VERSION"))); Config::set('system', 'git_friendica_version', $gitversion); logger('checkversion: end'); diff --git a/mod/admin.php b/mod/admin.php index dba180c12..303747c81 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1149,8 +1149,8 @@ function admin_page_site(App $a) { $check_git_version_choices = array( "none" => t("Don't check"), - "https://raw.githubusercontent.com/friendica/friendica/master/VERSION" => t("check the stable version"), - "https://raw.githubusercontent.com/friendica/friendica/develop/VERSION" => t("check the development version") + "master" => t("check the stable version"), + "develop" => t("check the development version") ); if ($a->config['hostname'] == "") { From 7881fd7dc9c5afbd5ec09878729d7b366083fbc2 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 6 Nov 2017 18:20:39 +0100 Subject: [PATCH 17/20] std foo --- mod/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 303747c81..e4f205e5c 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -619,7 +619,7 @@ function admin_page_summary(App $a) { // the local version of Friendica. Check is opt-in, source may be master or devel branch if (Config::get('system', 'check_new_version_url', 'none') != 'none' ) { $gitversion = Config::get('system','git_friendica_version'); - if (version_compare(FRIENDICA_VERSION, $gitversion)<0) { + if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) { $warningtext[] = t('There is a new version of Friendica available for download.'); $showwarning = true; } @@ -1247,7 +1247,7 @@ function admin_page_site(App $a) { '$nodeinfo' => array('nodeinfo', t("Publish server information"), get_config('system','nodeinfo'), t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See the-federation.info for details.")), - '$checknewversionurl' => array('check_new_version_url', t("Check upstream version"), get_config('system', 'check_new_version_url'), t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices), + '$check_new_version_url' => array('check_new_version_url', t("Check upstream version"), get_config('system', 'check_new_version_url'), t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices), '$suppress_tags' => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")), '$itemcache' => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")), '$itemcache_duration' => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")), From f097d4d4795c960daf09746b7b17ca09ebf26e8a Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 6 Nov 2017 18:21:16 +0100 Subject: [PATCH 18/20] std foo 2 --- view/templates/admin_site.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 987da171a..9f25ac085 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -126,7 +126,7 @@ {{include file="field_input.tpl" field=$basepath}} {{include file="field_checkbox.tpl" field=$suppress_tags}} {{include file="field_checkbox.tpl" field=$nodeinfo}} - {{include file="field_select.tpl" field=$checknewversionurl}} + {{include file="field_select.tpl" field=$check_new_version_url}}

{{$portable_contacts}}

From 64066592a4134068562c7cb8d6a7f948bd32976b Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 6 Nov 2017 18:27:29 +0100 Subject: [PATCH 19/20] some debug logging --- include/checkversion.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/checkversion.php b/include/checkversion.php index 0567a5954..b2ed814c8 100644 --- a/include/checkversion.php +++ b/include/checkversion.php @@ -25,7 +25,10 @@ function checkversion_run () { if ($checkurl == 'none' ) { return; } - $gitversion = dbesc(trim(fetch_url("https://raw.githubusercontent.com/friendica/friendica/".$checkurl."/VERSION"))); + $checkurl = "https://raw.githubusercontent.com/friendica/friendica/".$checkurl."/VERSION"; + logger("Checking VERSION from: ".$checkurl, LOGGER_DEBUG); + $gitversion = dbesc(trim(fetch_url($checkurl))); + logger("Upstream VERSION is: ".$gitversion, LOGGER_DEBUG); Config::set('system', 'git_friendica_version', $gitversion); logger('checkversion: end'); From 3b15b19e62d3b094a5fb6f5d40af0b4425c2fb17 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 6 Nov 2017 18:57:40 +0100 Subject: [PATCH 20/20] switches, no ifs --- include/checkversion.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/include/checkversion.php b/include/checkversion.php index b2ed814c8..7d3c2de6f 100644 --- a/include/checkversion.php +++ b/include/checkversion.php @@ -21,14 +21,23 @@ function checkversion_run () { $checkurl = Config::get('system', 'check_new_version_url', 'none'); - // check for new versions at all? - if ($checkurl == 'none' ) { + switch ($checkurl) { + case 'master': + $checked_url = 'https://raw.githubusercontent.com/friendica/friendica/master/VERSION'; + break; + case 'develop': + $checked_url = 'https://raw.githubusercontent.com/friendica/friendica/develop/VERSION'; + break; + default: + // don't check return; - } - $checkurl = "https://raw.githubusercontent.com/friendica/friendica/".$checkurl."/VERSION"; - logger("Checking VERSION from: ".$checkurl, LOGGER_DEBUG); - $gitversion = dbesc(trim(fetch_url($checkurl))); +} + logger("Checking VERSION from: ".$checked_url, LOGGER_DEBUG); + + // fetch the VERSION file + $gitversion = dbesc(trim(fetch_url($checked_url))); logger("Upstream VERSION is: ".$gitversion, LOGGER_DEBUG); + Config::set('system', 'git_friendica_version', $gitversion); logger('checkversion: end');