Update the cached rendered html when it changed
This commit is contained in:
parent
8d68e865c1
commit
297784880e
|
@ -1184,6 +1184,7 @@ function put_item_in_cache(&$item, $update = false)
|
||||||
$body = $item["body"];
|
$body = $item["body"];
|
||||||
|
|
||||||
$rendered_hash = defaults($item, 'rendered-hash', '');
|
$rendered_hash = defaults($item, 'rendered-hash', '');
|
||||||
|
$rendered_html = defaults($item, 'rendered-html', '');
|
||||||
|
|
||||||
if ($rendered_hash == ''
|
if ($rendered_hash == ''
|
||||||
|| $item["rendered-html"] == ""
|
|| $item["rendered-html"] == ""
|
||||||
|
@ -1196,6 +1197,11 @@ function put_item_in_cache(&$item, $update = false)
|
||||||
$item["rendered-html"] = prepare_text($item["body"]);
|
$item["rendered-html"] = prepare_text($item["body"]);
|
||||||
$item["rendered-hash"] = hash("md5", $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)) {
|
if ($update && ($item["id"] > 0)) {
|
||||||
dba::update('item', ['rendered-html' => $item["rendered-html"], 'rendered-hash' => $item["rendered-hash"]],
|
dba::update('item', ['rendered-html' => $item["rendered-html"], 'rendered-hash' => $item["rendered-hash"]],
|
||||||
['id' => $item["id"]], false);
|
['id' => $item["id"]], false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user