-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fcommon.php
21 lines (21 loc) · 1.09 KB
/
fcommon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
function getAISdFilesNames($path) {
$path = rtrim($path,'/');
//echo "path=$path;\n";
if(!$path) $path = 'data';
$dirName = pathinfo($path, PATHINFO_DIRNAME);
$fileName = pathinfo($path,PATHINFO_BASENAME);
//echo "dirName=$dirName; fileName=$fileName;\n";
if((!$dirName) OR ($dirName=='.')) {
$dirName = sys_get_temp_dir()."/netAIS"; // права собственно на /tmp в системе могут быть замысловатыми
$path = $dirName."/".$fileName.'/';
$umask = umask(0); // сменим на 0777 и запомним текущую
@mkdir($path, 0777,true); //
@chmod($path,0777); // права будут только на каталог netAIS. Если он вложенный, то на предыдущие, созданные по true в mkdir, прав не будет. Тогда надо использовать umask.
umask($umask); // Вернём. Зачем? Но umask глобальна вообще для всех юзеров веб-сервера
}
else $path .= '/';
//echo "path=$path;\n";
return $path;
} // end function getAISdFilesNames
?>