Esempio n. 1
0
function wpsc_dirsize($directory, $sizes)
{
    global $cache_max_time, $cache_path, $valid_nonce;
    $now = time();
    if (is_dir($directory)) {
        if ($dh = opendir($directory)) {
            while (($entry = readdir($dh)) !== false) {
                if ($entry != '.' && $entry != '..') {
                    $sizes = wpsc_dirsize(trailingslashit($directory) . $entry, $sizes);
                }
            }
            closedir($dh);
        }
    } else {
        if (is_file($directory)) {
            $filem = filemtime($directory);
            if ($filem + $cache_max_time <= $now) {
                $sizes['expired'] += 1;
                if ($valid_nonce && $_GET['listfiles']) {
                    $sizes['expired_list'][$now - $filem][str_replace($cache_path . 'supercache/', '', str_replace('index.html', '', str_replace('index.html.gz', '', $directory)))] = 1;
                }
            } else {
                $sizes['cached'] += 1;
                if ($valid_nonce && $_GET['listfiles']) {
                    $sizes['cached_list'][$now - $filem][str_replace($cache_path . 'supercache/', '', str_replace('index.html', '', str_replace('index.html.gz', '', $directory)))] = 1;
                }
            }
            if (!isset($sizes['fsize'])) {
                $sizes['fsize'] = @filesize($directory);
            } else {
                $sizes['fsize'] += @filesize($directory);
            }
        }
    }
    return $sizes;
}
Esempio n. 2
0
function wpsc_dirsize($directory, $sizes)
{
    global $cache_max_time;
    $now = time();
    if (is_dir($directory)) {
        $entries = glob($directory . '/*');
        if (is_array($entries) && !empty($entries)) {
            foreach ($entries as $entry) {
                if ($entry != '.' && $entry != '..') {
                    $sizes = wpsc_dirsize($entry, $sizes);
                }
            }
        }
    } else {
        if (is_file($directory)) {
            if (filemtime($directory) + $cache_max_time <= $now) {
                $sizes['expired'] += 1;
            } else {
                $sizes['cached'] += 1;
            }
        }
    }
    return $sizes;
}
Esempio n. 3
0
function wpsc_dirsize($directory, $sizes)
{
    global $cache_max_time;
    $now = time();
    if (is_dir($directory)) {
        if ($dh = opendir($directory)) {
            while (($entry = readdir($dh)) !== false) {
                if ($entry != '.' && $entry != '..') {
                    $sizes = wpsc_dirsize(trailingslashit($directory) . $entry, $sizes);
                }
            }
            closedir($dh);
        }
    } else {
        if (is_file($directory)) {
            if (filemtime($directory) + $cache_max_time <= $now) {
                $sizes['expired'] += 1;
            } else {
                $sizes['cached'] += 1;
            }
        }
    }
    return $sizes;
}