Python俱乐部
Python
小课题
京东优惠券
dokuwiki会生成很多文件,包括meta,cache文件等等,当你想删除这些文件的时候,你会发现你没有写权限。
这是由于dokuwiki生成的文件是Linux/Unix系统给Apache的权限,可能会和你的FTP权限不一样,这时候你就不能删除dokuwiki生成的文件了。
下面的php文件可以将这个php文件所在目录下所有的文件,文件夹的权限改为777,这样你就可以通过FTP来删除Dokuwiki所生成的文件
当且仅当你明白下面文件内容时才使用这个文件!
<?php /** * When you call this file it will make all files and directories * in it's own directory and all directories below writable by * everyone * * You can use this to (re)gain control on files owned by the * apache process. * * Only use it if you really know that this is what you want. * Delete the file immediately after using it! */ header("Content-Type: text/plain"); echo "starting...\n"; flush(); traverse(dirname(__FILE__)); echo "finished...\n"; function traverse($dir){ if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { //skip hidden files and upper dirs if(preg_match('/^[\._]/',$file)) continue; if(is_dir($dir.'/'.$file)){ if(@chmod($dir.'/'.$file,0777)){ echo "chmod 0777 $dir/$file OK\n"; }else{ echo "chmod 0777 $dir/$file FAILED\n"; } flush(); traverse($dir.'/'.$file); continue; } if(@chmod($dir.'/'.$file,0666)){ echo "chmod 0666 $dir/$file OK\n"; }else{ echo "chmod 0666 $dir/$file FAILED\n"; } flush(); } closedir($dh); } } ?>