diff --git a/.editorconfig b/.editorconfig index 63f7b7b..9c546e0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -24,3 +24,6 @@ indent_size = 2 [/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 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; } } diff --git a/src/includes/common.php b/src/includes/common.php index 475d997..9425ee2 100644 --- a/src/includes/common.php +++ b/src/includes/common.php @@ -164,14 +164,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); } - */ + } } 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'));