From 6983fa1b72d320e08cd2b1668de5d4e18a9f540d Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Sun, 27 Jun 2021 15:28:28 +0300 Subject: [PATCH 1/5] * invalidate opcache while saving config file --- src/includes/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/includes/common.php b/src/includes/common.php index 9bc2f38..24d30fa 100644 --- a/src/includes/common.php +++ b/src/includes/common.php @@ -165,14 +165,14 @@ class Config if($f === false) throw new Exception("Error while saving config file"); fwrite($f, ""); fclose($f); -/* + //Reset Zend OPcache //opcache_get_status() sometimes crashes //TODO: save config in database! if (function_exists("opcache_invalidate") && 0 != (int)opcache_get_configuration()["directives"]["opcache.enable"]) { opcache_invalidate(MTTPATH. 'db/config.php', true); } - */ + } } From a2af3e7f7703528839ec308e3b9e98c8bb89f1d6 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Sun, 27 Jun 2021 15:39:53 +0300 Subject: [PATCH 2/5] Check if mysql extension is available while mysql setup --- src/setup.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/setup.php b/src/setup.php index ef33098..a3c1b04 100644 --- a/src/setup.php +++ b/src/setup.php @@ -336,6 +336,9 @@ function testConnect(&$error) { if(Config::get('db') == 'mysql') { + if ( !function_exists("mysqli_connect") ) { + throw new Exception("Required PHP extension 'mysqli' is not installed"); + } require_once(MTTINC. 'class.db.mysql.php'); $db = new Database_Mysql; $db->connect(Config::get('mysql.host'), Config::get('mysql.user'), Config::get('mysql.password'), Config::get('mysql.db')); From 858aea023d069661e40511df42cda80dc4181044 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Sun, 27 Jun 2021 15:44:21 +0300 Subject: [PATCH 3/5] - rewrite sqlite3 table_exists() to avoid error in PHP 8 --- src/includes/class.db.sqlite3.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/includes/class.db.sqlite3.php b/src/includes/class.db.sqlite3.php index 950e65d..5cc47bb 100644 --- a/src/includes/class.db.sqlite3.php +++ b/src/includes/class.db.sqlite3.php @@ -152,10 +152,15 @@ class Database_Sqlite3 function table_exists($table) { - $table = $this->dbh->quote($table); - $q = $this->dbh->query("SELECT 1 FROM $table WHERE 1=0"); - if($q === false) return false; - else return true; + $exists = $this->sq("SELECT 1 FROM sqlite_master WHERE type='table' AND name=?", $table); + if ($exists == "1") { + return true; + } + $exists = $this->sq("SELECT 1 FROM sqlite_temp_master WHERE type='table' AND name=?", $table); + if ($exists == "1") { + return true; + } + return false; } } From e022bf5d857544a687e46ea2b83465f2d82810d3 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Sun, 27 Jun 2021 15:48:53 +0300 Subject: [PATCH 4/5] update version to 1.6.5 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 6463e95..49ebdd6 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.4 \ No newline at end of file +1.6.5 \ No newline at end of file From f2d45b570d43f2126693a48e2896d1e97542717c Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Sun, 27 Jun 2021 15:59:31 +0300 Subject: [PATCH 5/5] Add testing docker container based on PHP 5.4 --- .editorconfig | 3 +++ docker/dev/mtt-php54-apache/Dockerfile | 4 ++++ docker/dev/mtt-php54-apache/docker-compose.yml | 11 +++++++++++ docker/dev/mtt-php54-apache/php-mtt.ini | 6 ++++++ 4 files changed, 24 insertions(+) create mode 100644 docker/dev/mtt-php54-apache/Dockerfile create mode 100644 docker/dev/mtt-php54-apache/docker-compose.yml create mode 100644 docker/dev/mtt-php54-apache/php-mtt.ini diff --git a/.editorconfig b/.editorconfig index 6ce6fc3..6ce15c3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,3 +19,6 @@ insert_final_newline = false [/version.txt] insert_final_newline = false + +[*.yml] +indent_style = space diff --git a/docker/dev/mtt-php54-apache/Dockerfile b/docker/dev/mtt-php54-apache/Dockerfile new file mode 100644 index 0000000..492964f --- /dev/null +++ b/docker/dev/mtt-php54-apache/Dockerfile @@ -0,0 +1,4 @@ + +FROM php:5.4-apache + +RUN docker-php-ext-install mysqli diff --git a/docker/dev/mtt-php54-apache/docker-compose.yml b/docker/dev/mtt-php54-apache/docker-compose.yml new file mode 100644 index 0000000..0da4917 --- /dev/null +++ b/docker/dev/mtt-php54-apache/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' +services: + web: + build: ./ + image: mtt-php5.4-apache + container_name: mtt-php54-apache + ports: + - "8080:80" + volumes: + - ../../src:/var/www/html + - ./php-mtt.ini:/usr/local/etc/php/conf.d/php-mtt.ini diff --git a/docker/dev/mtt-php54-apache/php-mtt.ini b/docker/dev/mtt-php54-apache/php-mtt.ini new file mode 100644 index 0000000..1bb6e2b --- /dev/null +++ b/docker/dev/mtt-php54-apache/php-mtt.ini @@ -0,0 +1,6 @@ + +# Since PHP 5.4 E_STRICT is included in E_ALL +error_reporting = E_ALL + +#log_errors = On +#display_errors = On