From: Michael Date: Fri, 6 Apr 2018 14:01:52 +0000 (+0000) Subject: Update the cached rendered html when it changed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=297784880eb60dd9f32bf8d7689c3ad33f30cd43;p=friendica.git Update the cached rendered html when it changed --- diff --git a/include/text.php b/include/text.php index 6522ada1c3..957145ca18 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,11 @@ 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"]) || ($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);