mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-01-27 00:33:34 +00:00
Set DAVResource type correctly when restoring from memcache
Assuming we're always dealing with a Principal isn't correct.
This commit is contained in:
parent
1fec8fd111
commit
8f38332fce
@ -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') {
|
||||
|
||||
} 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 );
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user