• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/quota.php
  • Класс: CDiskQuota
  • Вызов: CDiskQuota::GetDirListFromLastFile
public function GetDirListFromLastFile($path, $path_to_last_file="", $check_time = true, $skip_dir = false)
{
	$path = str_replace("//", "/", $path."/");
	$path_to_last_file = str_replace("//", "/", $path_to_last_file);
	$path_to_lf = str_replace($path, "", $path_to_last_file);
	$size = 0;
	$res = array();
	$file = '';
	$path_tree = explode("/", $path_to_lf);
	while ($lf = array_pop($path_tree))
	{
		$path_to_dir = str_replace("//", "/", $path.implode("/", $path_tree)."/");
		$handle = @opendir($path_to_dir);
		$search = true;
		if ($handle)
		{
			while($file = readdir($handle))
			{
				if($file == "." || $file == ".." || $search)
				{
					if ($file == $lf)
						$search = false;
					continue;
				}

				if(is_dir($path_to_dir.$file))
				{
					if (is_array($skip_dir) && (in_array(str_replace("//", "/", $path.$file."/"), $skip_dir)))
					{
						continue;
					}
					$res_rec = $this->GetDirListSimple($path_to_dir.$file, $check_time);
					$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_to_dir.$file;
					$size += filesize($path_to_dir.$file);
					if ($check_time && intval(microtime(true) - START_EXEC_TIME) >= $this->max_execution_time)
					{
						return array("tree" => $res, "status" => "continue", "last_file" => $path_to_dir.$file, "size" => $size);
					}
				}
			}
		}
		@closedir($handle);
	}
	return array("tree" => $res, "status" => "done", "last_file" => $path.$file, "size" => $size);
}