Create domain-aware cache identifiers for groupware folders (#3991)
This commit is contained in:
parent
6a19ad1c6e
commit
ae93c7b345
3 changed files with 17 additions and 9 deletions
2
plugins/libkolab/SQL/mysql/2014112700.sql
Normal file
2
plugins/libkolab/SQL/mysql/2014112700.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- delete cache entries for old folder identifiers
|
||||
DELETE FROM `kolab_folders` WHERE `resource` LIKE 'imap://anonymous@%';
|
|
@ -97,7 +97,7 @@ class kolab_storage_folder extends kolab_storage_folder_api
|
|||
}
|
||||
|
||||
// compose fully qualified ressource uri for this instance
|
||||
$this->resource_uri = 'imap://' . urlencode($this->get_owner()) . '@' . $this->imap->options['host'] . '/' . $subpath;
|
||||
$this->resource_uri = 'imap://' . urlencode($this->get_owner(true)) . '@' . $this->imap->options['host'] . '/' . $subpath;
|
||||
return $this->resource_uri;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,9 +85,10 @@ abstract class kolab_storage_folder_api
|
|||
/**
|
||||
* Returns the owner of the folder.
|
||||
*
|
||||
* @param boolean Return a fully qualified owner name (i.e. including domain for shared folders)
|
||||
* @return string The owner of this folder.
|
||||
*/
|
||||
public function get_owner()
|
||||
public function get_owner($fully_qualified = false)
|
||||
{
|
||||
// return cached value
|
||||
if (isset($this->owner))
|
||||
|
@ -106,16 +107,21 @@ abstract class kolab_storage_folder_api
|
|||
break;
|
||||
|
||||
default:
|
||||
list($prefix, $user) = explode($this->imap->get_hierarchy_delimiter(), $info['name']);
|
||||
if (strpos($user, '@') === false) {
|
||||
$domain = strstr($rcmail->get_user_name(), '@');
|
||||
if (!empty($domain))
|
||||
$user .= $domain;
|
||||
}
|
||||
$this->owner = $user;
|
||||
list($prefix, $this->owner) = explode($this->imap->get_hierarchy_delimiter(), $info['name']);
|
||||
$fully_qualified = true; // enforce email addresses (backwards compatibility)
|
||||
break;
|
||||
}
|
||||
|
||||
if ($fully_qualified && strpos($this->owner, '@') === false) {
|
||||
// extract domain from current user name
|
||||
$domain = strstr($rcmail->get_user_name(), '@');
|
||||
// fall back to mail_domain config option
|
||||
if (empty($domain) && ($mdomain = $rcmail->config->mail_domain($this->imap->options['host']))) {
|
||||
$domain = '@' . $mdomain;
|
||||
}
|
||||
$this->owner .= $domain;
|
||||
}
|
||||
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue