From 1ca31cfe69e2d10cce65c4323eb652b355f4c904 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 4 Mar 2006 16:40:38 +0100 Subject: simplified file permission handling This patch simpliefies the configuration of the file and directory creation modes. There is no need to set the umask anymore. Only the wanted permissions for files and directories are set. An init function compares the wanted modes with the ones that would be choosen by the system automatically (consulting the system's umask) and sets the modes for chmod when needed. darcs-hash:20060304154038-7ad00-5ef1db3a87e42563a602f9d050c681d2ea74682f.gz --- lib/plugins/config/settings/config.metadata.php | 9 ++++----- lib/plugins/config/settings/extra.class.php | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'lib/plugins/config/settings') diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index d39ee7b50..7aa570f63 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -2,7 +2,7 @@ /** * Metadata for configuration manager plugin * - * Note: This file should be included within a function to ensure it + * Note: This file should be included within a function to ensure it * doesn't class with the settings it is describing. * * Format: @@ -58,12 +58,12 @@ $file['default'] = "DOKU_CONF.'dokuwiki.php'"; // optional $file['protected'] = "DOKU_CONF.'local.protected.php'"; // optional // test value (FIXME, remove before publishing) -//$meta['test'] = array('multichoice','_choices' => array('')); - +//$meta['test'] = array('multichoice','_choices' => array('')); + // --------------[ setting metadata ]------------------------------------ // - for description of format and fields see top of file // - order the settings in the order you wish them to appear -// - any settings not mentioned will come after the last setting listed and +// - any settings not mentioned will come after the last setting listed and // will use the default class with no parameters $meta['title'] = array(''); @@ -72,7 +72,6 @@ $meta['savedir'] = array('savedir'); $meta['lang'] = array('dirchoice','_dir' => DOKU_INC.'inc/lang/'); $meta['template'] = array('dirchoice','_dir' => DOKU_INC.'lib/tpl/'); -$meta['umask'] = array('numeric','_pattern' => '/0[0-7]{3}/'); // only accept octal representation $meta['dmode'] = array('numeric','_pattern' => '/0[0-7]{3}/'); // only accept octal representation $meta['fmode'] = array('numeric','_pattern' => '/0[0-7]{3}/'); // only accept octal representation $meta['basedir'] = array(''); diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 145e3c850..805806e8b 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -7,11 +7,11 @@ if (!class_exists('setting_sepchar')) { class setting_sepchar extends setting_multichoice { - + function setting_sepchar($key,$param=NULL) { $str = '_-.'; - for ($i=0;$i_choices[] = $str{$i}; - + for ($i=0;$i_choices[] = $str{$i}; + // call foundation class constructor $this->setting($key,$param); } @@ -23,7 +23,7 @@ if (!class_exists('setting_savedir')) { function update($input) { if ($this->is_protected()) return false; - + $value = is_null($this->_local) ? $this->_default : $this->_local; if ($value == $input) return false; @@ -32,7 +32,7 @@ if (!class_exists('setting_savedir')) { $this->_input = $input; return false; } - + $this->_local = $input; return true; } @@ -50,7 +50,7 @@ if (!class_exists('setting_authtype')) { sort($authtypes); $this->_choices = $authtypes; - + parent::initialize($default,$local,$protected); } } @@ -61,18 +61,18 @@ if (!class_exists('setting_im_convert')) { function update($input) { if ($this->is_protected()) return false; - + $input = trim($input); - + $value = is_null($this->_local) ? $this->_default : $this->_local; if ($value == $input) return false; if ($input && !@file_exists($input)) { $this->_error = true; $this->_input = $input; - return false; + return false; } - + $this->_local = $input; return true; } -- cgit v1.2.3