summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThilo Wawrzik2008-02-24 23:45:21 (GMT)
committerThilo Wawrzik2008-02-24 23:45:21 (GMT)
commit8eb69437886154241724ba5e193871f110605221 (patch)
treee1fd9c3f6955796a6a7d2cac2474bd9de6e38eee
parentda2062e4d4ef2bda6ffed83b739b9c630c85067d (diff)
- bugfix: fatal Error ('drupal_get_path') for guest users if page cache is enabled (#224598)5.x-2.2
-rw-r--r--gallery.module9
1 files changed, 6 insertions, 3 deletions
diff --git a/gallery.module b/gallery.module
index 4d8812e..833140a 100644
--- a/gallery.module
+++ b/gallery.module
@@ -1,7 +1,9 @@
<?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();