summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-03-04 16:40:38 +0100
committerAndreas Gohr <andi@splitbrain.org>2006-03-04 16:40:38 +0100
commit1ca31cfe69e2d10cce65c4323eb652b355f4c904 (patch)
tree5783a2da2d5ef9ba40aef392b7ad959740125e4c /lib
parent7c6f82e59d762d68d99d1a88f449d1035ffa5f76 (diff)
downloadrpg-1ca31cfe69e2d10cce65c4323eb652b355f4c904.tar.gz
rpg-1ca31cfe69e2d10cce65c4323eb652b355f4c904.tar.bz2
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
Diffstat (limited to 'lib')
-rw-r--r--lib/exe/indexer.php2
-rw-r--r--lib/exe/media.php2
-rw-r--r--lib/plugins/config/lang/en/lang.php1
-rw-r--r--lib/plugins/config/lang/fr/lang.php2
-rw-r--r--lib/plugins/config/lang/ja/lang.php1
-rw-r--r--lib/plugins/config/lang/pl/lang.php1
-rw-r--r--lib/plugins/config/lang/ru/lang.php1
-rw-r--r--lib/plugins/config/settings/config.metadata.php9
-rw-r--r--lib/plugins/config/settings/extra.class.php20
9 files changed, 16 insertions, 23 deletions
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index 8fe9e35d4..28eaa8284 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -60,7 +60,7 @@ function runIndexer(){
return false;
}
}
- if(isset($conf['dmask'])) { chmod($lock, $conf['dmask']); }
+ if($conf['dperm']) chmod($lock, $conf['dperm']);
require_once(DOKU_INC.'inc/indexer.php');
diff --git a/lib/exe/media.php b/lib/exe/media.php
index bbdf1814e..ae0b6efe7 100644
--- a/lib/exe/media.php
+++ b/lib/exe/media.php
@@ -124,7 +124,7 @@ function media_upload($NS,$AUTH){
io_makeFileDir($fn);
if(move_uploaded_file($file['tmp_name'], $fn)) {
// set the correct permission here
- if(isset($conf['fmask'])) { chmod($fn, $conf['fmask']); }
+ if($conf['fperm']) chmod($fn, $fperm);
msg($lang['uploadsucc'],1);
return true;
}else{
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index cb13a5a12..a40f265a6 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -20,7 +20,6 @@ $lang['locked'] = 'The settings file can not be updated, if this is unintent
/* -------------------- Config Options --------------------------- */
-$lang['umask'] = 'global permission mask';
$lang['fmode'] = 'file creation mode';
$lang['dmode'] = 'directory creation mode';
$lang['lang'] = 'language';
diff --git a/lib/plugins/config/lang/fr/lang.php b/lib/plugins/config/lang/fr/lang.php
index 10092c97e..231b1e78f 100644
--- a/lib/plugins/config/lang/fr/lang.php
+++ b/lib/plugins/config/lang/fr/lang.php
@@ -18,8 +18,6 @@ $lang['locked'] = 'Le fichier des paramètres ne peut être modifié, si cec
vérifiez que le nom et les droits du fichier sont corrects.';
// settings prompts
-$lang['umask'] = 'masque pour les nouveaux fichiers'; //set the umask for new files
-$lang['dmask'] = 'masque pour les nouveaux répertoires'; //directory mask accordingly
$lang['lang'] = 'langue'; //your language
$lang['basedir'] = 'répertoire de base'; //absolute dir from serveroot - blank for autodetection
$lang['baseurl'] = 'url de base'; //URL to server including protocol - blank for autodetect
diff --git a/lib/plugins/config/lang/ja/lang.php b/lib/plugins/config/lang/ja/lang.php
index 0c33cb802..8c555aa97 100644
--- a/lib/plugins/config/lang/ja/lang.php
+++ b/lib/plugins/config/lang/ja/lang.php
@@ -19,7 +19,6 @@ $lang['locked'] = '設定用ファイルを更新できません。もし意
ローカル設定ファイルの名前と権限を確認して下さい。';
// settings prompts
-$lang['umask'] = 'グローバル権限マスク'; //set the umask for new files
$lang['fmode'] = 'ファイル作成マスク'; //directory mask accordingly
$lang['dmode'] = 'フォルダ作成マスク'; //directory mask accordingly
$lang['lang'] = '使用言語'; //your language
diff --git a/lib/plugins/config/lang/pl/lang.php b/lib/plugins/config/lang/pl/lang.php
index 79118c51b..deddd0587 100644
--- a/lib/plugins/config/lang/pl/lang.php
+++ b/lib/plugins/config/lang/pl/lang.php
@@ -17,7 +17,6 @@ $lang['nochoice'] = '(brak innych możliwości)';
$lang['locked'] = 'Plik ustawień nie mógł zostać zmieniony, upewnij się, czy uprawnienia do plik są odpowiednie.';
// settings prompts
-$lang['umask'] = 'maska uprawnień nowego pliku'; //set the umask for new files
$lang['fmode'] = 'tryb tworzenia pliku'; //directory mask accordingly
$lang['dmode'] = 'tryb tworzenia katalogu'; //directory mask accordingly
$lang['lang'] = 'język'; //your language
diff --git a/lib/plugins/config/lang/ru/lang.php b/lib/plugins/config/lang/ru/lang.php
index a824115f2..06156e90d 100644
--- a/lib/plugins/config/lang/ru/lang.php
+++ b/lib/plugins/config/lang/ru/lang.php
@@ -18,7 +18,6 @@ $lang['locked'] = 'Файл настройки недоступен для
убедитесь, что файл локальной настройки имеет правильное имя и права доступа.';
// settings prompts
-$lang['umask'] = 'Общая маска запрета доступа (umask)'; //set the umask for new files
$lang['fmode'] = 'Права для создаваемых файлов'; //directory mask accordingly
$lang['dmode'] = 'Права для создаваемых директорий'; //directory mask accordingly
$lang['lang'] = 'Язык'; //your language
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<strlen($str);$i++) $this->_choices[] = $str{$i};
-
+ for ($i=0;$i<strlen($str);$i++) $this->_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;
}