From 79dc88fd67ff49c1aaedddfb9c1a6b96850cefbf Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sun, 9 Jul 2023 12:46:34 +1000 Subject: [PATCH] wip --- .lando.yml | 11 ++++++++--- Code/Lib/Libzot.php | 2 +- include/dba/dba_driver.php | 15 ++++++++++++++- include/items.php | 13 ++++++------- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.lando.yml b/.lando.yml index f8af5fb8a..72d7a008e 100644 --- a/.lando.yml +++ b/.lando.yml @@ -18,7 +18,7 @@ services: xdebug: true overrides: environment: - PHP_IDE_CONFIG: "serverName=appserver" + PHP_IDE_CONFIG: serverName=appserver XDEBUG_SESSION_START: lando config: php: .vscode/php.ini @@ -37,10 +37,15 @@ tooling: xdebug-on: service: appserver description: Enable xdebug for Apache. - cmd: rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && docker-php-ext-enable xdebug && /etc/init.d/apache2 reload && echo "Xdebug enabled" + cmd: >- + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && + docker-php-ext-enable xdebug && /etc/init.d/apache2 reload && echo "Xdebug + enabled" user: root xdebug-off: service: appserver description: Disable xdebug for Apache. - cmd: rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && /etc/init.d/apache2 reload && echo "Xdebug disabled" + cmd: >- + rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && + /etc/init.d/apache2 reload && echo "Xdebug disabled" user: root diff --git a/Code/Lib/Libzot.php b/Code/Lib/Libzot.php index 3a58de525..73441cb8b 100644 --- a/Code/Lib/Libzot.php +++ b/Code/Lib/Libzot.php @@ -1609,7 +1609,7 @@ class Libzot $result = []; $commentApproval = null; - // logger('msg_arr: ' . print_r($msg_arr,true),LOGGER_ALL); + logger('msg_arr: ' . print_r($msg_arr,true),LOGGER_ALL); // If an upstream hop used ActivityPub, set the identities to zot6 nomadic identities where applicable // else things could easily get confused diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index e7741046a..4fe334ddd 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -363,6 +363,7 @@ function q($sql) $args = func_get_args(); array_shift($args); + $watching = false; if (DBA::$dba && DBA::$dba->connected) { $stmt = vsprintf($sql, $args); @@ -370,11 +371,23 @@ function q($sql) db_logger('dba: vsprintf error: ' . print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true), LOGGER_NORMAL, LOG_CRIT); } + $watch = get_config('system','db_watch'); + if ($watch && stripos($stmt, $watch) !== false) { + dbg(2); + $watching = true; + } + if (DBA::$dba->debug) { db_logger('Sql: ' . $stmt, LOGGER_DEBUG, LOG_INFO); } - return DBA::$dba->q($stmt); + $result = DBA::$dba->q($stmt); + if ($watching) { + dbg(0); + } + + + return $result; } /* diff --git a/include/items.php b/include/items.php index 89cd12361..4b028a6e2 100644 --- a/include/items.php +++ b/include/items.php @@ -1846,6 +1846,7 @@ function item_store($arr, $deliver = true) { if(($terms) && (is_array($terms))) { foreach($terms as $t) { + dbg(2); q("insert into term (uid,oid,otype,ttype,term,url) values(%d,%d,%d,%d,'%s','%s') ", intval($arr['uid']), @@ -1855,6 +1856,7 @@ function item_store($arr, $deliver = true) { dbesc($t['term']), dbesc($t['url']) ); + dbg(0); } $arr['term'] = $terms; @@ -2188,6 +2190,7 @@ function item_store_update($arr, $deliver = true) { if(is_array($terms)) { foreach($terms as $t) { + dbg(2); q("insert into term (uid,oid,otype,ttype,term,url) values(%d,%d,%d,%d,'%s','%s') ", intval($uid), @@ -2197,6 +2200,7 @@ function item_store_update($arr, $deliver = true) { dbesc($t['term']), dbesc($t['url']) ); + dbg(0); } $arr['term'] = $terms; } @@ -2565,7 +2569,7 @@ function tag_deliver($uid, $item_id) { return; } - // don't boost likes and other response activities as it is likely that + // don't boost likes and other response activities as it isdelivery_cha likely that // few platforms will handle this in an elegant way if (ActivityStreams::is_response_activity($item['verb'])) { @@ -2900,7 +2904,7 @@ function i_am_mentioned($channel,$item,$check_groups = false) { */ function start_delivery_chain($channel, $item, $item_id, bool|array $parent, $group = false, $edit = false) { - // btlogger('start_chain: ' . $channel['channel_id'] . ' item: ' . $item_id); + btlogger('start_chain: ' . $channel['channel_id'] . ' item: ' . print_r($item, true)); $moderated = perm_is_allowed($channel['channel_id'], $item['author_xchan'], 'moderated'); $source = check_item_source($channel['channel_id'],$item); @@ -3642,11 +3646,6 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false, $ ObjCache::Delete($item['mid']); } - q("delete from term where oid = %d and otype = %d", - intval($item['id']), - intval(TERM_OBJ_POST) - ); - // remove delivery reports $c = q("select channel_hash from channel where channel_id = %d limit 1",