mirror of
https://github.com/friendica/friendica
synced 2025-04-24 00:30:11 +00:00
Replace direct accesses to App->config by Config::get/set calls
This commit is contained in:
parent
d1f2d04803
commit
762a786611
29 changed files with 180 additions and 190 deletions
|
@ -184,7 +184,7 @@ class dba {
|
|||
private static function logIndex($query) {
|
||||
$a = get_app();
|
||||
|
||||
if (empty($a->config["system"]["db_log_index"])) {
|
||||
if (empty(Config::get('system', 'db_log_index'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,18 +203,18 @@ class dba {
|
|||
return;
|
||||
}
|
||||
|
||||
$watchlist = explode(',', $a->config["system"]["db_log_index_watch"]);
|
||||
$blacklist = explode(',', $a->config["system"]["db_log_index_blacklist"]);
|
||||
$watchlist = explode(',', Config::get('system', 'db_log_index_watch'));
|
||||
$blacklist = explode(',', Config::get('system', 'db_log_index_blacklist'));
|
||||
|
||||
while ($row = dba::fetch($r)) {
|
||||
if ((intval($a->config["system"]["db_loglimit_index"]) > 0)) {
|
||||
if ((intval(Config::get('system', 'db_loglimit_index')) > 0)) {
|
||||
$log = (in_array($row['key'], $watchlist) &&
|
||||
($row['rows'] >= intval($a->config["system"]["db_loglimit_index"])));
|
||||
($row['rows'] >= intval(Config::get('system', 'db_loglimit_index'))));
|
||||
} else {
|
||||
$log = false;
|
||||
}
|
||||
|
||||
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) && ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
|
||||
if ((intval(Config::get('system', 'db_loglimit_index_high')) > 0) && ($row['rows'] >= intval(Config::get('system', 'db_loglimit_index_high')))) {
|
||||
$log = true;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ class dba {
|
|||
|
||||
if ($log) {
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
@file_put_contents($a->config["system"]["db_log_index"], DateTimeFormat::utcNow()."\t".
|
||||
@file_put_contents(Config::get('system', 'db_log_index'), DateTimeFormat::utcNow()."\t".
|
||||
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
|
||||
basename($backtrace[1]["file"])."\t".
|
||||
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
||||
|
@ -384,7 +384,7 @@ class dba {
|
|||
|
||||
$orig_sql = $sql;
|
||||
|
||||
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
|
||||
if (Config::get('system', 'db_callstack')) {
|
||||
$sql = "/*".System::callstack()." */ ".$sql;
|
||||
}
|
||||
|
||||
|
@ -545,16 +545,15 @@ class dba {
|
|||
|
||||
$a->save_timestamp($stamp1, 'database');
|
||||
|
||||
if (x($a->config,'system') && x($a->config['system'], 'db_log')) {
|
||||
|
||||
if (Config::get('system', 'db_log')) {
|
||||
$stamp2 = microtime(true);
|
||||
$duration = (float)($stamp2 - $stamp1);
|
||||
|
||||
if (($duration > $a->config["system"]["db_loglimit"])) {
|
||||
if (($duration > Config::get('system', 'db_loglimit'))) {
|
||||
$duration = round($duration, 3);
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
|
||||
@file_put_contents($a->config["system"]["db_log"], DateTimeFormat::utcNow()."\t".$duration."\t".
|
||||
@file_put_contents(Config::get('system', 'db_log'), DateTimeFormat::utcNow()."\t".$duration."\t".
|
||||
basename($backtrace[1]["file"])."\t".
|
||||
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
||||
substr(self::replaceParameters($sql, $args), 0, 2000)."\n", FILE_APPEND);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue