diff options
author | Andreas Gohr <andi@splitbrain.org> | 2020-03-04 15:13:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 15:13:43 +0100 |
commit | bcb9e6dfd943e82f5d13f08551c0364d59243342 (patch) | |
tree | 2b6062f51d73609c698eef477e595ed779d93a09 | |
parent | 2cf4f729e4bf39e77023e2e7530ea1148a56886f (diff) | |
parent | 9fdcc8fcd87114ca59a1764a84d213a53c655c8c (diff) | |
download | dokuwiki-bcb9e6dfd943e82f5d13f08551c0364d59243342.tar.gz dokuwiki-bcb9e6dfd943e82f5d13f08551c0364d59243342.zip |
Merge pull request #2985 from movatica/fix_fperm
Fixed inconsistent handling of falsy values on fperm setting
-rw-r--r-- | inc/Search/Indexer.php | 4 | ||||
-rw-r--r-- | inc/init.php | 4 | ||||
-rw-r--r-- | inc/io.php | 2 | ||||
-rw-r--r-- | inc/media.php | 4 | ||||
-rw-r--r-- | lib/plugins/extension/helper/extension.php | 4 |
5 files changed, 9 insertions, 9 deletions
diff --git a/inc/Search/Indexer.php b/inc/Search/Indexer.php index 8770ac794..a29e5b28b 100644 --- a/inc/Search/Indexer.php +++ b/inc/Search/Indexer.php @@ -1000,7 +1000,7 @@ class Indexer { if (!empty($lines)) fwrite($fh, "\n"); fclose($fh); - if (isset($conf['fperm'])) + if ($conf['fperm']) chmod($fn.'.tmp', $conf['fperm']); io_rename($fn.'.tmp', $fn.'.idx'); return true; @@ -1067,7 +1067,7 @@ class Indexer { fwrite($fh, $line); } fclose($fh); - if (isset($conf['fperm'])) + if ($conf['fperm']) chmod($fn.'.tmp', $conf['fperm']); io_rename($fn.'.tmp', $fn.'.idx'); return true; diff --git a/inc/init.php b/inc/init.php index 69ef6f15a..f9bb53472 100644 --- a/inc/init.php +++ b/inc/init.php @@ -340,7 +340,7 @@ function init_files(){ $fh = @fopen($file,'a'); if($fh){ fclose($fh); - if(!empty($conf['fperm'])) chmod($file, $conf['fperm']); + if($conf['fperm']) chmod($file, $conf['fperm']); }else{ nice_die("$file is not writable. Check your permissions settings!"); } @@ -405,7 +405,7 @@ function init_creationmodes(){ // check what is set automatically by the system on file creation // and set the fperm param if it's not what we want - $auto_fmode = 0666 & ~$umask; + $auto_fmode = $conf['fmode'] & ~$umask; if($auto_fmode != $conf['fmode']) $conf['fperm'] = $conf['fmode']; // check what is set automatically by the system on file creation diff --git a/inc/io.php b/inc/io.php index 18aae25e7..1dfabe845 100644 --- a/inc/io.php +++ b/inc/io.php @@ -252,7 +252,7 @@ function _io_saveFile($file, $content, $append) { fclose($fh); } - if(!$fileexists and !empty($conf['fperm'])) chmod($file, $conf['fperm']); + if(!$fileexists and $conf['fperm']) chmod($file, $conf['fperm']); return true; } diff --git a/inc/media.php b/inc/media.php index ec40df5ef..cc29bd16c 100644 --- a/inc/media.php +++ b/inc/media.php @@ -2082,7 +2082,7 @@ function media_resize_image($file, $ext, $w, $h=0){ media_resize_imageIM($ext, $file, $info[0], $info[1], $local, $w, $h) || media_resize_imageGD($ext, $file, $info[0], $info[1], $local, $w, $h) ) { - if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); + if($conf['fperm']) @chmod($local, $conf['fperm']); return $local; } //still here? resizing failed @@ -2149,7 +2149,7 @@ function media_crop_image($file, $ext, $w, $h=0){ if( $mtime > @filemtime($file) || media_crop_imageIM($ext,$file,$info[0],$info[1],$local,$cw,$ch,$cx,$cy) || media_resize_imageGD($ext,$file,$cw,$ch,$local,$cw,$ch,$cx,$cy) ){ - if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); + if($conf['fperm']) @chmod($local, $conf['fperm']); return media_resize_image($local,$ext, $w, $h); } diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index 47fe87373..3e7087eba 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -1245,10 +1245,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin closedir($dh); return $ok; } else { - $exists = file_exists($dst); + $existed = file_exists($dst); if (!@copy($src, $dst)) return false; - if (!$exists && !empty($conf['fperm'])) chmod($dst, $conf['fperm']); + if (!$existed && $conf['fperm']) chmod($dst, $conf['fperm']); @touch($dst, filemtime($src)); } |