caching for featured image
This commit is contained in:
parent
54e30183cc
commit
d8a31ce75c
1 changed files with 6 additions and 2 deletions
|
@ -55,10 +55,14 @@ class Featured extends SimpleExtension {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onPostListBuilding($event) {
|
public function onPostListBuilding($event) {
|
||||||
global $config, $page, $user;
|
global $config, $database, $page, $user;
|
||||||
$fid = $config->get_int("featured_id");
|
$fid = $config->get_int("featured_id");
|
||||||
if($fid > 0) {
|
if($fid > 0) {
|
||||||
$image = Image::by_id($fid);
|
$image = $database->cache->get("featured_image_object");
|
||||||
|
if(empty($image)) {
|
||||||
|
$image = Image::by_id($fid);
|
||||||
|
$database->cache->set("featured_image_object", $image, 60);
|
||||||
|
}
|
||||||
if(!is_null($image)) {
|
if(!is_null($image)) {
|
||||||
if(class_exists("Ratings")) {
|
if(class_exists("Ratings")) {
|
||||||
if(strpos(Ratings::get_user_privs($user), $image->rating) === FALSE) {
|
if(strpos(Ratings::get_user_privs($user), $image->rating) === FALSE) {
|
||||||
|
|
Reference in a new issue