Commit db2639b0 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(mail) Fix mail server cache reset for forein keys

issue #5808
Showing with 38 additions and 52 deletions
+38 -52
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class serviceCyrus extends simpleService class serviceCyrus extends simpleMailMethodService
{ {
var $objectclasses = array('fdCyrusServer'); var $objectclasses = array('fdCyrusServer');
...@@ -111,17 +111,5 @@ class serviceCyrus extends simpleService ...@@ -111,17 +111,5 @@ class serviceCyrus extends simpleService
) )
); );
} }
protected function post_save()
{
parent::post_save();
mailMethod::resetMailServersCache();
}
protected function post_remove ()
{
parent::post_remove();
mailMethod::resetMailServersCache();
}
} }
?> ?>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class serviceDovecot extends simpleService class serviceDovecot extends simpleMailMethodService
{ {
var $objectclasses = array('fdDovecotServer'); var $objectclasses = array('fdDovecotServer');
...@@ -102,17 +102,5 @@ class serviceDovecot extends simpleService ...@@ -102,17 +102,5 @@ class serviceDovecot extends simpleService
) )
); );
} }
protected function post_save()
{
parent::post_save();
mailMethod::resetMailServersCache();
}
protected function post_remove ()
{
parent::post_remove();
mailMethod::resetMailServersCache();
}
} }
?> ?>
...@@ -20,7 +20,32 @@ ...@@ -20,7 +20,32 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class serviceIMAP extends simpleService class simpleMailMethodService extends simpleService
{
protected function prepare_save ()
{
if (!$this->shouldSave()) {
// Reset mail server cache now as post_save won’t be called
mailMethod::resetMailServersCache();
}
return parent::prepare_save();
}
protected function post_save()
{
parent::post_save();
mailMethod::resetMailServersCache();
}
protected function post_remove ()
{
parent::post_remove();
mailMethod::resetMailServersCache();
}
}
class serviceIMAP extends simpleMailMethodService
{ {
/* This plugin only writes its objectClass */ /* This plugin only writes its objectClass */
var $objectclasses = array('fdImapServer'); var $objectclasses = array('fdImapServer');
...@@ -49,17 +74,5 @@ class serviceIMAP extends simpleService ...@@ -49,17 +74,5 @@ class serviceIMAP extends simpleService
{ {
return '<b>This server runs an IMAP or POP3 server</b>'.parent::execute(); return '<b>This server runs an IMAP or POP3 server</b>'.parent::execute();
} }
protected function post_save()
{
parent::post_save();
mailMethod::resetMailServersCache();
}
protected function post_remove ()
{
parent::post_remove();
mailMethod::resetMailServersCache();
}
} }
?> ?>
...@@ -231,6 +231,15 @@ class mailAccount extends simplePlugin ...@@ -231,6 +231,15 @@ class mailAccount extends simplePlugin
} }
} }
function foreignKeyUpdate ($field, $oldvalue, $newvalue, $source)
{
if ($field == 'gosaMailServer') {
mailMethod::resetMailServersCache();
$this->attributesAccess['gosaMailServer']->setChoices(array_keys(mailMethod::getMailServers()));
}
parent::foreignKeyUpdate ($field, $oldvalue, $newvalue, $source);
}
public function mailServerChanged() public function mailServerChanged()
{ {
/* Intialize the used mailMethod */ /* Intialize the used mailMethod */
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class serviceRenaterPartage extends simpleService class serviceRenaterPartage extends simpleMailMethodService
{ {
var $objectclasses = array('fdRenaterPartageServer'); var $objectclasses = array('fdRenaterPartageServer');
...@@ -96,17 +96,5 @@ class serviceRenaterPartage extends simpleService ...@@ -96,17 +96,5 @@ class serviceRenaterPartage extends simpleService
parent::__construct($dn, $parent); parent::__construct($dn, $parent);
$this->attributesAccess['fdRenaterPartageServerMailDomain']->setLinearRendering(FALSE); $this->attributesAccess['fdRenaterPartageServerMailDomain']->setLinearRendering(FALSE);
} }
protected function post_save()
{
parent::post_save();
mailMethod::resetMailServersCache();
}
protected function post_remove ()
{
parent::post_remove();
mailMethod::resetMailServersCache();
}
} }
?> ?>
Supports Markdown
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