From b6c303645fd2d9df54d639302f1f09896550c9ea Mon Sep 17 00:00:00 2001
From: Gary Allan <github@gallan.co.uk>
Date: Fri, 18 Nov 2022 21:01:24 +0000
Subject: [PATCH] Release: v1.6.0 version bump

---
 README.md                                         |  5 +++--
 app/footer.php                                    |  4 ++--
 db/SCHEMA.sql                                     |  2 +-
 functions/checks/check_php_build.php              | 15 +++++++++------
 functions/upgrade_queries.php                     |  1 +
 functions/upgrade_queries/upgrade_queries_1.6.php |  8 ++++++++
 functions/version.php                             |  8 ++++----
 misc/CHANGELOG                                    |  6 ++++++
 8 files changed, 34 insertions(+), 15 deletions(-)
 create mode 100644 functions/upgrade_queries/upgrade_queries_1.6.php

diff --git a/README.md b/README.md
index 77847363..5999c06f 100755
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ to be able to display javascript quickly and correctly.
 ## Branches
  - MASTER: Current development release
  - 1.5: Productional branch for 1.5.x release
- - 1.4: Productional branch for 1.4.x release
+ - 1.4: Productional branch for 1.4.x release (obsolete)
  - 1.3: Productional branch for 1.3.x release (obsolete)
  - 1.2: Productional branch for 1.2.x release (obsolete)
  - Other branches: Feature testing
@@ -24,8 +24,9 @@ to be able to display javascript quickly and correctly.
 ## Supported PHP versions
 
 phpIPAM has been developed and tested on the following PHP versions.\
-The use of untested PHP versions may result in compatibility issues and is unsupported.
+The use of untested PHP versions is unsupported and may result in compatibility issues.
 
+- MASTER: PHP versions 5.4 to 8.1 (8.x support work-in-progress)
 - 1.5.x: PHP versions 5.4 to 7.4
 - 1.4.x: PHP versions 5.4 to 7.4
 - 1.3.x: PHP versions 5.4 to 7.1
diff --git a/app/footer.php b/app/footer.php
index a55ec6b6..e3b346a1 100755
--- a/app/footer.php
+++ b/app/footer.php
@@ -11,8 +11,8 @@
 		if (defined("GIT_VCS_REF")) {
 			print " git <a href='https://github.com/phpipam/phpipam/tree/".GIT_VCS_REF."'>".GIT_VCS_REF."</a>";
 		}
-		if (phpversion() >= UNSUPPORTED_PHP_VERSION) {
-			print " "._('UNSUPPORTED_PHP_VERSION').":".phpversion();
+		if (phpversion() >= PHPIPAM_PHP_UNTESTED) {
+			print " "._('is not supported on PHP').phpversion();
 		}
 		?>
 	</td>
diff --git a/db/SCHEMA.sql b/db/SCHEMA.sql
index 4d703868..c9744daa 100755
--- a/db/SCHEMA.sql
+++ b/db/SCHEMA.sql
@@ -1058,5 +1058,5 @@ CREATE TABLE `nominatim_cache` (
 # Dump of table -- for autofix comment, leave as it is
 # ------------------------------------------------------------
 
-UPDATE `settings` SET `version` = "1.5";
+UPDATE `settings` SET `version` = "1.6";
 UPDATE `settings` SET `dbversion` = 39;
diff --git a/functions/checks/check_php_build.php b/functions/checks/check_php_build.php
index 5d329391..cc631f7e 100755
--- a/functions/checks/check_php_build.php
+++ b/functions/checks/check_php_build.php
@@ -11,8 +11,11 @@ $requiredExt  = array("session", "sockets", "filter", "openssl", "gmp", "json",
 # Required functions (included in php-xml or php-simplexml package)
 $requiredFns  = array("simplexml_load_string");
 
-if(!defined('UNSUPPORTED_PHP_VERSION'))
-define('UNSUPPORTED_PHP_VERSION', "8.0");
+if(!defined('PHPIPAM_PHP_MIN'))
+define('PHPIPAM_PHP_MIN', "5.4");
+
+if(!defined('PHPIPAM_PHP_UNTESTED'))
+define('PHPIPAM_PHP_UNTESTED', "8.2");  // PHP 8.2 or greater is untested & unsupported
 
 
 # Empty missing arrays to prevent errors
@@ -67,15 +70,15 @@ if ( PHP_INT_SIZE == 4 ) {
     $error[] = "<strong>"._('Not 64-bit system')."!</strong><br><hr>";
     $error[] = _('From release 1.4 on 64bit system is required!');
 }
-elseif ( phpversion() < "5.4" ) {
+elseif ( phpversion() < PHPIPAM_PHP_MIN ) {
     $error[] = "<strong>"._('Unsupported PHP version')."!</strong><br><hr>";
-    $error[] = _('From release 1.3.2 on at least PHP version 5.4 is required!')."<br>";
+    $error[] = _('Minimum PHP version required').": ".PHPIPAM_PHP_MIN."<br>";
     $error[] = _("Detected PHP version: ").phpversion();
 
 }
-elseif ( phpversion() >= UNSUPPORTED_PHP_VERSION && !Config::ValueOf('allow_untested_php_versions', false) ) {
+elseif ( phpversion() >= PHPIPAM_PHP_UNTESTED && !Config::ValueOf('allow_untested_php_versions', false) ) {
     $error[] = "<strong>"._('Unsupported PHP version')."!</strong><br><hr>";
-    $error[] = _("Detected PHP version: ").phpversion()." >= ".UNSUPPORTED_PHP_VERSION."<br><br>";
+    $error[] = _("Detected PHP version: ").phpversion()." >= ".PHPIPAM_PHP_UNTESTED."<br><br>";
     $error[] = _('phpIPAM is not yet compatible with this version of php.')." "._('You may encounter issues & errors.')."<br><br>";
     $error[] = _('Please set <q>$allow_untested_php_versions=true;</q> in config.php to continue at your own risk.');
 }
diff --git a/functions/upgrade_queries.php b/functions/upgrade_queries.php
index 9606bd69..5f7c5a13 100644
--- a/functions/upgrade_queries.php
+++ b/functions/upgrade_queries.php
@@ -18,6 +18,7 @@ include('upgrade_queries/upgrade_queries_1.2.php');
 include('upgrade_queries/upgrade_queries_1.3.php');
 include('upgrade_queries/upgrade_queries_1.4.php');
 include('upgrade_queries/upgrade_queries_1.5.php');
+include('upgrade_queries/upgrade_queries_1.6.php');
 
 
 // output if required
diff --git a/functions/upgrade_queries/upgrade_queries_1.6.php b/functions/upgrade_queries/upgrade_queries_1.6.php
new file mode 100644
index 00000000..84cd2358
--- /dev/null
+++ b/functions/upgrade_queries/upgrade_queries_1.6.php
@@ -0,0 +1,8 @@
+<?php
+
+#
+# Version 1.6 queries
+#
+$upgrade_queries["1.6.39"]   = [];
+$upgrade_queries["1.6.39"][] = "-- Version update";
+$upgrade_queries["1.6.39"][] = "UPDATE `settings` set `version` = '1.6';";
\ No newline at end of file
diff --git a/functions/version.php b/functions/version.php
index d9ef47dc..2f8a7b6d 100644
--- a/functions/version.php
+++ b/functions/version.php
@@ -1,14 +1,14 @@
 <?php
 /* set latest version */
-define("VERSION", "1.5");									//decimal release version e.g 1.32
+define("VERSION", "1.6");									//decimal release version e.g 1.32
 /* set latest version */
-define("VERSION_VISIBLE", "1.5.0");							//visible version in footer e.g 1.3.2
+define("VERSION_VISIBLE", "1.6.0");							//visible version in footer e.g 1.3.2
 /* set latest revision */
-define("REVISION", "016");									//increment on static content changes (js/css) or point releases to avoid caching issues
+define("REVISION", "001");									//increment on static content changes (js/css) or point releases to avoid caching issues
 /* set last possible upgrade */
 define("LAST_POSSIBLE", "1.19");							//minimum required version to be able to upgrade
 /* set published - hide dbversion in footer */
-define("PUBLISHED", true);									//hide dbversion in footer
+define("PUBLISHED", false);									//hide dbversion in footer
 
 // Automatically set DBVERSION as everyone forgets!
 function get_dbversion() {
diff --git a/misc/CHANGELOG b/misc/CHANGELOG
index 4cfa8762..a0463d88 100755
--- a/misc/CHANGELOG
+++ b/misc/CHANGELOG
@@ -1,3 +1,9 @@
+== 1.6.0
+
+    Enhancements, changes:
+    ----------------------------
+    + php8.1 compatibility (php8.x support is work-in-progress);
+
 == 1.5.0
 
     New features:
-- 
GitLab