forgot that php isn't python

This commit is contained in:
Shish 2019-05-28 15:16:22 +01:00
parent 4b4ff68729
commit 189385ff61
4 changed files with 5 additions and 4 deletions

View file

@ -29,7 +29,7 @@ check out one of the versioned branches.
# Requirements
- MySQL/MariaDB 5.1+ (with experimental support for PostgreSQL 9+ and SQLite 3)
- [Stable PHP](https://en.wikipedia.org/wiki/PHP#Release_history) (7.0+ as of writing)
- [Stable PHP](https://en.wikipedia.org/wiki/PHP#Release_history) (7.1+ as of writing)
- GD or ImageMagick
# Installation

View file

@ -120,6 +120,7 @@ function do_install() { // {{{
return;
}
define("CACHE_DSN", null);
define("DEBUG_SQL", false);
define("DATABASE_KA", true);
install_process();

View file

@ -138,7 +138,7 @@ class Cache {
public $hits=0, $misses=0;
public $time=0;
public function __construct($dsn: string) {
public function __construct(?string $dsn) {
$matches = array();
if($dsn && preg_match("#(.*)://(.*)#", $dsn, $matches)) {
if($matches[1] == "memcache") {
@ -177,7 +177,7 @@ class Cache {
}
public function set(string $key, $val, int $time=0) {
$this->engine->set($key, $time, $val);
$this->engine->set($key, $val, $time);
if((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) {
file_put_contents("data/cache.log", "Cache set: $key ($time)\n", FILE_APPEND);
}

View file

@ -45,7 +45,7 @@ class Database {
* DB connection is on-demand.
*/
public function __construct() {
$this->cache = Cache(CACHE_DSN);
$this->cache = new Cache(CACHE_DSN);
}
private function connect_db() {