X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=ee8a213ff659bfa3aa238e740ac51138346d25b3;hb=abd7b2666c1ba79d44db0e71b369433cf8c8e678;hp=8a6fd003129456c944117c42a9c9799c09458196;hpb=296f5618780514161b4ec1c322a9499b64169db8;p=friendica.git diff --git a/include/text.php b/include/text.php index 8a6fd00312..ee8a213ff6 100644 --- a/include/text.php +++ b/include/text.php @@ -1184,6 +1184,7 @@ function put_item_in_cache(&$item, $update = false) $body = $item["body"]; $rendered_hash = defaults($item, 'rendered-hash', ''); + $rendered_html = defaults($item, 'rendered-html', ''); if ($rendered_hash == '' || $item["rendered-html"] == "" @@ -1196,6 +1197,16 @@ function put_item_in_cache(&$item, $update = false) $item["rendered-html"] = prepare_text($item["body"]); $item["rendered-hash"] = hash("md5", $item["body"]); + // Force an update if the generated values differ from the existing ones + if ($rendered_hash != $item["rendered-hash"]) { + $update = true; + } + + // Only compare the HTML when we forcefully ignore the cache + if (Config::get("system", "ignore_cache") && ($rendered_html != $item["rendered-html"])) { + $update = true; + } + if ($update && ($item["id"] > 0)) { dba::update('item', ['rendered-html' => $item["rendered-html"], 'rendered-hash' => $item["rendered-hash"]], ['id' => $item["id"]], false); @@ -1271,7 +1282,7 @@ function prepare_body(array &$item, $attach = false, $is_preview = false) // Compile eventual content filter reasons $filter_reasons = []; if (!$is_preview && !($item['self'] && local_user() == $item['uid'])) { - if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'social', 'disable_cw', false))) { + if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'system', 'disable_cw', false))) { $filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']); }