Commit 8eb69437 authored by profix898's avatar profix898

- bugfix: fatal Error ('drupal_get_path') for guest users if page cache is enabled (#224598)

parent da2062e4
<?php
// $Id$
require_once(drupal_get_path('module', 'gallery') .'/gallery_base.inc');
if (function_exists('drupal_get_path')){
require_once(drupal_get_path('module', 'gallery') .'/gallery_base.inc');
}
// Default variable values
define(GALLERY_IMAGEBLOCK_SIZE_METHOD_DEFAULT, 'maxsize');
......@@ -437,8 +439,9 @@ function gallery_page() {
* Implementation of hook_exit().
*/
function gallery_exit() {
if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
// Drupal page cache is enabled, we need to flush the cache if a G2 item has been updated
global $user;
// If page cache is enabled we need to flush the cache everytime a G2 item has changed
if ($user->uid && variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) {
$query = 'SELECT COUNT([GalleryEntity::id]) FROM [GalleryEntity] WHERE [GalleryEntity::modificationTimeStamp] > ?';
if (($results = gallery_db_query($query, array(time()-10))) && $results[0]) {
cache_clear_all();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment