mirror of
https://github.com/e107inc/e107.git
synced 2025-08-16 11:36:08 +02:00
Increased session to 24 hours (prevent being logged-out every hour).
Recursive chmod added to Database Tools for correcting folder and file perms.
This commit is contained in:
@@ -491,5 +491,59 @@ class e_file
|
||||
return round($size/$tb, 2)." ".CORE_LAN_TB;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Recursive Chmod function.
|
||||
* @param string path to folder
|
||||
* @param string perms for files
|
||||
* @param string perms for directories
|
||||
* @example chmod_R('mydir', 0644, 0755);
|
||||
*/
|
||||
function chmod($path, $filemode=0644, $dirmode=0755)
|
||||
{
|
||||
if (is_dir($path) )
|
||||
{
|
||||
if (!chmod($path, $dirmode))
|
||||
{
|
||||
$dirmode_str=decoct($dirmode);
|
||||
print "Failed applying filemode '$dirmode_str' on directory '$path'\n";
|
||||
print " `-> the directory '$path' will be skipped from recursive chmod\n";
|
||||
return;
|
||||
}
|
||||
$dh = opendir($path);
|
||||
while (($file = readdir($dh)) !== false)
|
||||
{
|
||||
if($file != '.' && $file != '..') // skip self and parent pointing directories
|
||||
{
|
||||
$fullpath = $path.'/'.$file;
|
||||
$this->chmod($fullpath, $filemode,$dirmode);
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_link($path))
|
||||
{
|
||||
print "link '$path' is skipped\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chmod($path, $filemode))
|
||||
{
|
||||
$filemode_str=decoct($filemode);
|
||||
print "Failed applying filemode '$filemode_str' on file '$path'\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user