コード例 #1
0
ファイル: sysinfotools.php プロジェクト: gggeek/ggsysinfo
 static function countFilesSizeInDir($cachedir)
 {
     if (eZSys::osType() != 'win32') {
         /// @todo verify that we got no error?
         exec("du -b -c -s \"{$cachedir}\"", $result);
         $result = @preg_split('/[\\s]+/', $result[1]);
         return $result[0];
     } else {
         $return = 0;
         $files = @scandir($cachedir);
         if ($files === false) {
             return false;
         }
         foreach ($files as $file) {
             if ($file != '.' && $file != '..') {
                 if (is_dir($cachedir . '/' . $file)) {
                     $return += sysInfoTools::countFilesSizeInDir($cachedir . '/' . $file);
                 } else {
                     $return += filesize($cachedir . '/' . $file);
                 }
             }
         }
         return $return;
     }
 }
コード例 #2
0
ファイル: cachestats.php プロジェクト: gggeek/ggsysinfo
            $cachedir = eZSys::siteDir() . '/' . $cacheItem['path'];
        } else {
            $cachedir = eZSys::cacheDirectory() . '/' . $cacheItem['path'];
        }
        $count = sysInfoTools::countFilesInDir($cachedir);
        $cacheFilesList[$cacheItem['name']]['count'] = $count;
        if ($count) {
            $cacheFilesList[$cacheItem['name']]['size'] = number_format(sysInfoTools::countFilesSizeInDir($cachedir));
        } else {
            $cacheFilesList[$cacheItem['name']]['size'] = "";
        }
    }
}
// q: are we 100% sure that the eZ5 cache is always at that location?
if (class_exists('Symfony\\Component\\HttpKernel\\Kernel') && is_dir($ezp5CacheDir = eZSys::siteDir() . '/../ezpublish/cache')) {
    foreach (glob($ezp5CacheDir . '/*', GLOB_ONLYDIR) as $envDir) {
        $env = basename($envDir);
        foreach (glob($envDir . '/*', GLOB_ONLYDIR) as $cacheDir) {
            $cache = basename($cacheDir);
            $cacheName = "Symfony/{$env}/{$cache}";
            $count = sysInfoTools::countFilesInDir($cacheDir);
            $cacheFilesList[$cacheName] = array('path' => "ezpublish/cache/{$env}/{$cache}", 'size' => $count ? number_format(sysInfoTools::countFilesSizeInDir($cacheDir)) : "", 'count' => $count);
        }
    }
}
if ($Params['viewmode'] == 'json') {
    $response_type = $Params['viewmode'];
    $response_data = $cacheFilesList;
    return;
}
$tpl->setVariable('filelist', $cacheFilesList);
コード例 #3
0
ファイル: storagestats.php プロジェクト: gggeek/ggsysinfo
<?php

/**
 *
 * @author G. Giunta
 * @copyright (C) G. Giunta 2008-2016
 * @license Licensed under GNU General Public License v2.0. See file license.txt
 *
 * @todo add more details, such as dates of first/last files
 * @todo add support for db-clustered configs - hard currently, since there is no recursive search in api...
 * @todo in edfs mode allow user to only show clustered data
 */
$storageFilesList = array();
$storageDir = eZSys::storageDirectory();
$files = @scandir($storageDir);
foreach ($files as $file) {
    if ($file != '.' && $file != '..' && is_dir($storageDir . '/' . $file)) {
        $storageFilesList[$file] = array('path' => $storageDir . '/' . $file, 'count' => number_format(sysInfoTools::countFilesInDir($storageDir . '/' . $file)), 'size' => number_format(sysInfoTools::countFilesSizeInDir($storageDir . '/' . $file)));
    }
}
if ($Params['viewmode'] == 'json') {
    $response_type = $Params['viewmode'];
    $response_data = $storageFilesList;
    return;
}
$tpl->setVariable('filelist', $storageFilesList);
コード例 #4
0
$clusterStorageDir = ezSysinfoClusterManager::clusterFileStorageDir();
if ($clusterStorageDir != '') {
    $storageDir = $clusterStorageDir;
    foreach ($cacheList as $cacheItem) {
        if ($cacheItem['path'] != false && $cacheItem['enabled']) {
            $cacheName = 'DFS://' . $cacheItem['name'];
            // take care: this is hardcoded from knowledge of cache structure...
            if ($cacheItem['path'] == 'var/cache/ini') {
                //$cachedir = $storageDir . '/' . eZSys::siteDir() . '/' . $cacheItem['path'];
                // no var/cache/ini in dfs nfs storage
                continue;
            } else {
                $cachedir = $storageDir . '/' . eZSys::cacheDirectory() . '/' . $cacheItem['path'];
            }
            $cacheFilesList[$cacheName] = array('path' => $cachedir);
            $count = sysInfoTools::countFilesInDir($cachedir);
            $cacheFilesList[$cacheName]['count'] = $count;
            if ($count) {
                $cacheFilesList[$cacheName]['size'] = number_format(sysInfoTools::countFilesSizeInDir($cachedir));
            } else {
                $cacheFilesList[$cacheName]['size'] = "";
            }
        }
    }
}
if ($Params['viewmode'] == 'json') {
    $response_type = $Params['viewmode'];
    $response_data = $cacheFilesList;
    return;
}
$tpl->setVariable('filelist', $cacheFilesList);