From adfd2419558476e58763729ab52784aa6442505f Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 2 Oct 2009 14:55:38 +0000 Subject: [PATCH] Added a warning message, when template files are missing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14494 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/mail/class_mail-methods-cyrus.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc index 6bfde61c7..e054fa29e 100644 --- a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc +++ b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc @@ -434,6 +434,21 @@ class mailMethodCyrus extends mailMethod{ { mailMethod::saveSieveSettings(); + // Check file integrity + $files = array(); + foreach(array("sieve-header.txt","sieve-spam.txt","sieve-mailsize.txt","sieve-vacation.txt","sieve-discard.txt") as $file){ + if(!file_exists(CONFIG_DIR."/".$file) || ! is_readable(CONFIG_DIR."/".$file)){ + $files[] = CONFIG_DIR."/".$file; + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__ , CONFIG_DIR."/".$file, + "Sieve template missing, please locate and move the template file: "); + } + } + if(count($files)){ + $msg = sprintf(_("File '%s' does not exist!"),implode($files,", ")); + $msg .= " "._("The sieve script may not be written correctly."); + msg_dialog::display(_("Warning"),$msg,WARNING_DIALOG); + } + /* Map attribute from parent class */ $mail = $this->parent->mail; @@ -503,6 +518,7 @@ class mailMethodCyrus extends mailMethod{ Build up new sieve script here. *****/ + /* Only create a new one, if it is not empty */ $script= ""; if (is_integer(strpos($gosaMailDeliveryMode, "R")) || -- 2.30.2