make sure featured image object is fully populated before caching, else it still lazy-queries tags each time
This commit is contained in:
parent
ee1162309a
commit
5a93e650c1
@ -60,10 +60,13 @@ class Featured extends Extension {
|
||||
global $config, $database, $page, $user;
|
||||
$fid = $config->get_int("featured_id");
|
||||
if($fid > 0) {
|
||||
$image = $database->cache->get("featured_image_object");
|
||||
if(empty($image)) {
|
||||
$image = $database->cache->get("featured_image_object-$fid");
|
||||
if($image === false) {
|
||||
$image = Image::by_id($fid);
|
||||
$database->cache->set("featured_image_object", $image, 60);
|
||||
if($image) { // make sure the object is fully populated before saving
|
||||
$image->get_tag_array();
|
||||
}
|
||||
$database->cache->set("featured_image_object-$fid", $image, 60);
|
||||
}
|
||||
if(!is_null($image)) {
|
||||
if(class_exists("Ratings")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user