X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdba.php;h=b0927265be9006e24bc16e368b86763ae690bb23;hb=f9bd6894de9e56bbbee4379e878c6d1f5703f51b;hp=4837f0a48ab3328c670b772976624d70aadf51a7;hpb=66996a2fa3bf8ad726f83df19a247ff006552aea;p=friendica.git diff --git a/include/dba.php b/include/dba.php index 4837f0a48a..b0927265be 100644 --- a/include/dba.php +++ b/include/dba.php @@ -1,24 +1,30 @@ save_timestamp($stamp1, "database"); + if (strtolower(substr($sql, 0, 6)) != "select") + $a->save_timestamp($stamp1, "database_write"); + if(x($a->config,'system') && x($a->config['system'],'db_log')) { if (($duration > $a->config["system"]["db_loglimit"])) { $duration = round($duration, 3); @@ -226,7 +235,7 @@ class dba { } function __destruct() { - if ($this->db) + if ($this->db) if($this->mysqli) $this->db->close(); else @@ -244,14 +253,14 @@ function printable($s) { }} // Procedural functions -if(! function_exists('dbg')) { +if(! function_exists('dbg')) { function dbg($state) { global $db; if($db) $db->dbg($state); }} -if(! function_exists('dbesc')) { +if(! function_exists('dbesc')) { function dbesc($str) { global $db; if($db && $db->connected) @@ -267,7 +276,7 @@ function dbesc($str) { // Example: $r = q("SELECT * FROM `%s` WHERE `uid` = %d", // 'user', 1); -if(! function_exists('q')) { +if(! function_exists('q')) { function q($sql) { global $db; @@ -284,12 +293,12 @@ function q($sql) { /** * - * This will happen occasionally trying to store the - * session data after abnormal program termination + * This will happen occasionally trying to store the + * session data after abnormal program termination * */ logger('dba: no database: ' . print_r($args,true)); - return false; + return false; }} @@ -299,7 +308,7 @@ function q($sql) { * */ -if(! function_exists('dbq')) { +if(! function_exists('dbq')) { function dbq($sql) { global $db; @@ -311,10 +320,10 @@ function dbq($sql) { }} -// Caller is responsible for ensuring that any integer arguments to +// Caller is responsible for ensuring that any integer arguments to // dbesc_array are actually integers and not malformed strings containing -// SQL injection vectors. All integer array elements should be specifically -// cast to int to avoid trouble. +// SQL injection vectors. All integer array elements should be specifically +// cast to int to avoid trouble. if(! function_exists('dbesc_array_cb')) { @@ -335,4 +344,3 @@ function dbesc_array(&$arr) { function dba_timer() { return microtime(true); } -