Merge pull request #13 from maxpozdeev/v1.6.x

V1.6.5
This commit is contained in:
Max Pozdeev 2021-06-27 16:07:01 +03:00 committed by GitHub
commit 63acc1a2e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 6 deletions

View file

@ -24,3 +24,6 @@ indent_size = 2
[/version.txt]
insert_final_newline = false
[*.yml]
indent_style = space

View file

@ -0,0 +1,4 @@
FROM php:5.4-apache
RUN docker-php-ext-install mysqli

View file

@ -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

View file

@ -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

View file

@ -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;
}
}

View file

@ -164,14 +164,14 @@ class Config
if($f === false) throw new Exception("Error while saving config file");
fwrite($f, "<?php\n\$config = array();\n$s?>");
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);
}
*/
}
}

View file

@ -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'));