- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/quota.php
- Класс: CDiskQuota
- Вызов: CDiskQuota::GetDirListSimple
public function GetDirListSimple($path, $check_time = true, $skip_dir=false)
{
$path = str_replace("//", "/", $path."/");
$res = array();
$size = 0;
$handle = @opendir($path);
if ($handle)
{
while($file = readdir($handle))
{
if($file == "." || $file == "..")
{
continue;
}
if(is_dir($path.$file))
{
if (is_array($skip_dir) && (in_array(str_replace("//", "/", $path.$file."/"), $skip_dir)))
{
continue;
}
$res_rec = $this->GetDirListSimple($path.$file, $check_time, $skip_dir);
$res = array_merge($res, $res_rec["tree"]);
$size += doubleVal($res_rec["size"]);
if ($res_rec["status"] == "continue")
{
$res_rec["tree"] = $res;
$res_rec["size"] = doubleVal($size);
return $res_rec;
}
}
else
{
$res[] = $path.$file;
$size += filesize($path.$file);
if ($check_time && intval(microtime(true) - START_EXEC_TIME) >= $this->max_execution_time)
{
return array("tree" => $res, "status" => "continue", "last_file" => $path.$file, "size" => $size);
}
}
}
@closedir($handle);
}
else
{
return array("status" => "error");
}
return array("tree" => $res, "status" => "done", "last_file" => $path.$file, "size" => $size);
}