Subversion Repositories oidplus

Rev

Rev 1284 | Rev 1324 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1284 Rev 1308
Line 2828... Line 2828...
2828
    {
2828
    {
2829
        return $this->get_stat_cache_prop($path, 'gid');
2829
        return $this->get_stat_cache_prop($path, 'gid');
2830
    }
2830
    }
2831
 
2831
 
2832
    /**
2832
    /**
-
 
2833
     * Recursively go through rawlist() output to get the total filesize
-
 
2834
     *
-
 
2835
     * @return int
-
 
2836
     */
-
 
2837
    private static function recursiveFilesize(array $files)
-
 
2838
    {
-
 
2839
        $size = 0;
-
 
2840
        foreach ($files as $name => $file) {
-
 
2841
            if ($name == '.' || $name == '..') {
-
 
2842
                continue;
-
 
2843
            }
-
 
2844
            $size += is_array($file) ?
-
 
2845
                self::recursiveFilesize($file) :
-
 
2846
                $file->size;
-
 
2847
        }
-
 
2848
        return $size;
-
 
2849
    }
-
 
2850
 
-
 
2851
    /**
2833
     * Gets file size
2852
     * Gets file size
2834
     *
2853
     *
2835
     * @param string $path
2854
     * @param string $path
-
 
2855
     * @param bool $recursive
2836
     * @return mixed
2856
     * @return mixed
2837
     */
2857
     */
2838
    public function filesize($path)
2858
    public function filesize($path, $recursive = false)
2839
    {
2859
    {
-
 
2860
        return !$recursive || $this->filetype($path) != 'dir' ?
2840
        return $this->get_stat_cache_prop($path, 'size');
2861
            $this->get_stat_cache_prop($path, 'size') :
-
 
2862
            self::recursiveFilesize($this->rawlist($path, true));
2841
    }
2863
    }
2842
 
2864
 
2843
    /**
2865
    /**
2844
     * Gets file type
2866
     * Gets file type
2845
     *
2867
     *