forgot that php isn't python
This commit is contained in:
parent
4b4ff68729
commit
189385ff61
4 changed files with 5 additions and 4 deletions
|
@ -29,7 +29,7 @@ check out one of the versioned branches.
|
||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
- MySQL/MariaDB 5.1+ (with experimental support for PostgreSQL 9+ and SQLite 3)
|
- 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
|
- GD or ImageMagick
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
|
@ -120,6 +120,7 @@ function do_install() { // {{{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define("CACHE_DSN", null);
|
||||||
define("DEBUG_SQL", false);
|
define("DEBUG_SQL", false);
|
||||||
define("DATABASE_KA", true);
|
define("DATABASE_KA", true);
|
||||||
install_process();
|
install_process();
|
||||||
|
|
|
@ -138,7 +138,7 @@ class Cache {
|
||||||
public $hits=0, $misses=0;
|
public $hits=0, $misses=0;
|
||||||
public $time=0;
|
public $time=0;
|
||||||
|
|
||||||
public function __construct($dsn: string) {
|
public function __construct(?string $dsn) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if($dsn && preg_match("#(.*)://(.*)#", $dsn, $matches)) {
|
if($dsn && preg_match("#(.*)://(.*)#", $dsn, $matches)) {
|
||||||
if($matches[1] == "memcache") {
|
if($matches[1] == "memcache") {
|
||||||
|
@ -177,7 +177,7 @@ class Cache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set(string $key, $val, int $time=0) {
|
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'])) {
|
if((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) {
|
||||||
file_put_contents("data/cache.log", "Cache set: $key ($time)\n", FILE_APPEND);
|
file_put_contents("data/cache.log", "Cache set: $key ($time)\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Database {
|
||||||
* DB connection is on-demand.
|
* DB connection is on-demand.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->cache = Cache(CACHE_DSN);
|
$this->cache = new Cache(CACHE_DSN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function connect_db() {
|
private function connect_db() {
|
||||||
|
|
Reference in a new issue