From fc94ac45e735bae3378d46a988210d2d5a32070e Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 2 Aug 2010 13:41:35 +0000 Subject: [PATCH] Updated config registry -Added property type file Updated stats -Added several checks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19343 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_configRegistry.inc | 12 ++++++++++-- gosa-core/include/class_stats.inc | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index a1ea7b319..f895a3dac 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -745,11 +745,19 @@ class gosaProperty static function isWriteableFile($message,$class,$name,$value, $type) { - $match = !empty($value) && (is_file($value) || is_writeable($value)); + $match = (file_exists($value) && is_writeable($value)) || + (!file_exists($value) && is_writeable(dirname($value))); + // Display the reason for failing this check. if($message && ! $match){ - if(!is_writeable($value) || !is_file($value)){ + + if(!file_exists($value) && !is_writeable(dirname($value))){ + msg_dialog::display(_("Warning"), + sprintf(_("The file '%s' specified for '%s:%s' cannot be created neither be used for writing!"), + bold($value),bold($class),bold($name)), + WARNING_DIALOG); + }elseif(file_exists($value) && !is_writeable($value)){ msg_dialog::display(_("Warning"), sprintf(_("The file '%s' specified for '%s:%s' cannot be used for writing!"), bold($value),bold($class),bold($name)), diff --git a/gosa-core/include/class_stats.inc b/gosa-core/include/class_stats.inc index b64ebe1e4..9d6517c3d 100644 --- a/gosa-core/include/class_stats.inc +++ b/gosa-core/include/class_stats.inc @@ -38,7 +38,7 @@ class stats } // Check if we are able to read/write the given database file. - if(!is_writeable(stats::$tableFile)){ + if(!is_writeable(stats::$tableFile) && !is_writeable(dirname(stats::$tableFile))){ return(NULL); } -- 2.30.2