elFinder\elFinderVolumeDriver::countSize PHP Méthode

countSize() protected méthode

Return file/total directory size
Author: Dmitry (dio) Levashov
protected countSize ( string $path ) : integer
$path string file path
Résultat integer
    protected function countSize($path)
    {
        $stat = $this->stat($path);
        if (empty($stat) || !$stat['read'] || !empty($stat['hidden'])) {
            return 'unknown';
        }
        if ($stat['mime'] != 'directory') {
            return $stat['size'];
        }
        $subdirs = $this->options['checkSubfolders'];
        $this->options['checkSubfolders'] = true;
        $result = 0;
        foreach ($this->getScandir($path) as $stat) {
            $size = $stat['mime'] == 'directory' && $stat['read'] ? $this->countSize($this->_joinPath($path, $stat['name'])) : (isset($stat['size']) ? intval($stat['size']) : 0);
            if ($size > 0) {
                $result += $size;
            }
        }
        $this->options['checkSubfolders'] = $subdirs;
        return $result;
    }