diff --git a/inc/DAVResource.php b/inc/DAVResource.php index f88b16e5..dcb45078 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -575,29 +575,34 @@ EOSQL; $cache_ns = 'collection-'.preg_replace( '{/[^/]*$}', '/', $this->dav_name); $cache_key = 'dav_resource'.$session->user_no; $this->collection = $cache->get( $cache_ns, $cache_key ); + if ( $this->collection === false ) { $this->ReadCollectionFromDatabase(); + if ( $this->collection->type != 'principal' && $this->_collection_is_cacheable ) { $cache_ns = 'collection-'.$this->collection->dav_name; @dbg_error_log( 'Cache', ':FetchCollection: Setting cache ns "%s" key "%s". Type: %s', $cache_ns, $cache_key, $this->collection->type ); $cache->set( $cache_ns, $cache_key, $this->collection ); } + @dbg_error_log( 'DAVResource', ':FetchCollection: Found collection named "%s" of type "%s".', $this->collection->dav_name, $this->collection->type ); } else { - @dbg_error_log( 'Cache', ':FetchCollection: Got cache ns "%s" key "%s". Type: %s', $cache_ns, $cache_key, $this->collection->type ); - if ( preg_match( '#^(/[^/]+)/?$#', $this->dav_name, $matches) - || preg_match( '#^((/principals/[^/]+/)[^/]+)/?$#', $this->dav_name, $matches) ) { + @dbg_error_log( 'Cache', ':FetchCollection: Got cache ns "%s" key "%s". dav_name: "%s", Type: %s', $cache_ns, $cache_key, $this->collection->dav_name, $this->collection->type ); + + if ($this->collection->type == 'principal') { $this->_is_principal = true; $this->FetchPrincipal(); $this->collection->is_principal = true; - $this->collection->type = 'principal'; - } else { - if ($this->collection->type == 'proxy') { - $this->_is_proxy_resource = true; - $this->proxy_type = $this->collection->proxy_type; - } + + } else if ($this->collection->type == 'calendar') { + $this->_is_calendar = true; + + } else if ($this->collection->type == 'proxy') { + $this->_is_proxy_resource = true; + $this->proxy_type = $this->collection->proxy_type; } + @dbg_error_log( 'DAVResource', ':FetchCollection: Read cached collection named "%s" of type "%s".', $this->collection->dav_name, $this->collection->type ); }