
|
[dokuwiki] Safemode Bug
- From: Rainer Weinhold <mom.mom@xxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sat, 09 Jul 2005 15:24:23 +0000
Hi,
I'm not sure if this is the right mailing list. But I got a problem with
the Safemode Workaround.
I was not able use the safemode Workaround, I got errors that the
direcotry /html could not be created. So I debugged a litte and I think
there are two Lines which schould be changed. (both io.php)
In io_makeFileDir with safemode on, the Directory Variable is first
corrected to the FTProot, an then io_mkdir_p is called. But io_mkdir_p
goes recursive trough the path and tries via file_exists if the
directory allready exists. But because the FTProot is already stripped
out of the $target parameter, file_exists will always fail, this leads
to the call of io_mkdir_ftp for every part of the directory. So the code
tries to create the whole Direcotry structure from scratch. html -->
dokuwiki --> data --> cache ...
So I suggest that the stripping of the FTProot is needed to be done
right before the io_mkdir_ftp call.
I Attached the Code of the two fixed Function on the buttom. Someone can
check it, on my site it works now. I hope som Developer will add it to
the develop release.
regards Rainer Weinhold
<code>
/**
* Create the directory needed for the given file
*
* @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
*/
function io_makeFileDir($file){
global $conf;
$dir = dirname($file);
// 0507/RW - Safmode Bugfix
if($conf['safemodehack']){
$dir =
preg_replace('/^'.preg_quote(realpath($conf['ftp']['root']),'/').'/','',$dir);
}*/
umask($conf['dmask']);
if(!is_dir($dir)){
io_mkdir_p($dir) || msg("Creating directory $dir failed",-1);
}
umask($conf['umask']);
}
/**
* Creates a directory hierachy.
*
* @link http://www.php.net/manual/en/function.mkdir.php
* @author <saint@xxxxxxxxxxxx>
* @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
*/
function io_mkdir_p($target){
global $conf;
if (is_dir($target)||empty($target)) return 1; // best case check first
if (@file_exists($target) && !is_dir($target)) return 0;
//recursion
if (io_mkdir_p(substr($target,0,strrpos($target,'/') ) ) ) {
// 0507/RW - Safmode Bugfix
if($conf['safemodehack']){
$dir =
preg_replace('/^'.preg_quote(realpath($conf['ftp']['root']),'/').'/','',$target);
return io_mkdir_ftp($dir);
}else{
return @mkdir($target,0777); // crawl back up & create dir tree
}
}
return 0;
}
</code>
--
*******************************
Rainer Weinhold
Konstanz
Web : http://www.inforw.de
*******************************
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts:[dokuwiki] Safemode Bug [dokuwiki] Safemode Bug [dokuwiki] Re: Safemode Bug [dokuwiki] Re: Safemode Bug [dokuwiki] Re: Safemode Bug [dokuwiki] Re: Safemode Bug
|

|

|
[ Home |
Signup |
Help |
Login |
Archives |
Lists
]
All trademarks and copyrights within the FreeLists archives are owned
by their respective owners. Everything else ©2008 Avenir Technologies, LLC.
|

|
|