summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTroels Liebe Bentsen <tlb@rapanden.dk>2006-02-24 22:16:55 +0100
committerTroels Liebe Bentsen <tlb@rapanden.dk>2006-02-24 22:16:55 +0100
commit44881d272282937c9bb745f462c947319d404dd0 (patch)
tree186d932116e04b1271ad22a3bd628d6617a49c49 /bin
parentb687885519897ab2959bb0540ec822b96f722fd6 (diff)
downloadrpg-44881d272282937c9bb745f462c947319d404dd0.tar.gz
rpg-44881d272282937c9bb745f462c947319d404dd0.tar.bz2
Fix umask bug and do a code cleanup of chmod/mkdir usage so set the correct permissions, this should also fix problems with dokuwiki making setuid files on some umasks.
* Don't set the umask() anymore, this is not good form and we don't really know what is it in the old code anyway as it was not done properly. * Retire the dmask config option introduce 2 new ones called fmode and dmode, this is more in line with posix and should make more sense. * Use chmod for setting the correct permissions but only if it's needed. * Set changing of permissions off by default as i should work properly in most Apache setups without and it does not make sense on windows anyway. darcs-hash:20060224211655-ee6b9-68f7bb59417d6f0033cfd3764146923daa4dcf1b.gz
Diffstat (limited to 'bin')
-rwxr-xr-xbin/indexer.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/indexer.php b/bin/indexer.php
index 0eb1fbe48..4f80d4642 100755
--- a/bin/indexer.php
+++ b/bin/indexer.php
@@ -79,7 +79,6 @@ function _index($id){
_lock();
echo "$id... ";
idx_addPage($id);
- umask($conf['umask']);
io_saveFile(metaFN($id,'.indexed'),' ');
echo "done.\n";
_unlock();
@@ -92,7 +91,7 @@ function _lock(){
global $conf;
$lock = $conf['lockdir'].'/_indexer.lock';
$said = false;
- while(!@mkdir($lock)){
+ while(!@mkdir($lock, $conf['dmode'])){
if(time()-@filemtime($lock) > 60*5){
// looks like a stale lock - remove it
@rmdir($lock);
@@ -106,6 +105,7 @@ function _lock(){
sleep(15);
}
}
+ if(isset($conf['dmask'])) { chmod($lock, $conf['dmask']); }
if($said) print "\n";
}
@@ -125,7 +125,6 @@ function _clearindex(){
global $conf;
_lock();
echo "Clearing index... ";
- umask($conf['umask']);
io_saveFile($conf['cachedir'].'/word.idx','');
io_saveFile($conf['cachedir'].'/page.idx','');
io_saveFile($conf['cachedir'].'/index.idx','');