コード例 #1
0
 /**
  * 获取缓存列表
  * @param int $key 缓存key
  * @return array 用户信息
  */
 public function getCache($key = '')
 {
     $list = array('html' => array('id' => 'html', 'name' => '静态缓存', 'dir' => HTML_PATH, 'size' => sizeFormat(dir_size(HTML_PATH))), 'tpl' => array('id' => 'tpl', 'name' => '模板缓存', 'dir' => CACHE_PATH, 'size' => sizeFormat(dir_size(CACHE_PATH))), 'data' => array('id' => 'data', 'name' => '数据缓存', 'dir' => DATA_PATH, 'size' => sizeFormat(dir_size(DATA_PATH))), 'debug' => array('id' => 'debug', 'name' => '日志缓存', 'dir' => LOG_PATH, 'size' => sizeFormat(dir_size(LOG_PATH))), 'app' => array('id' => 'app', 'name' => '应用缓存', 'dir' => TEMP_PATH, 'size' => sizeFormat(dir_size(TEMP_PATH))), 'run' => array('id' => 'run', 'name' => '运行缓存', 'dir' => RUNTIME_PATH . 'common~runtime.php', 'size' => sizeFormat(filesize(RUNTIME_PATH . 'common~runtime.php'))));
     if ($key) {
         return $list[$key];
     }
     return $list;
 }
コード例 #2
0
 /**
  * 获取缓存列表
  * @param int $key 缓存key
  * @return array 用户信息
  */
 public function getFile($key = '')
 {
     $path = array('Admin' => APP_PATH . 'Admin/', 'Boss' => APP_PATH . 'Boss/', 'Home' => APP_PATH . 'Home/', 'Staff' => APP_PATH . 'Staff/', 'Cache' => CACHE_PATH, 'Log' => LOG_PATH, 'Html' => HTML_PATH, 'App' => TEMP_PATH, 'Data' => DATA_PATH, 'Run' => RUNTIME_PATH . 'common~runtime.php', 'Backup' => './Backup/', 'Images' => './Public/Images/');
     $list = array('Admin' => array('id' => 'Admin', 'name' => 'Admin模块', 'dir' => $path['Admin'], 'size' => sizeFormat(dir_size($path['Admin'])), 'level' => sizeFormat(dir_size($path['Admin']), 'level')), 'Boss' => array('id' => 'Boss', 'name' => 'Boss模块', 'dir' => $path['Boss'], 'size' => sizeFormat(dir_size($path['Boss'])), 'level' => sizeFormat(dir_size($path['Boss']), 'level')), 'Home' => array('id' => 'Home', 'name' => 'Home模块', 'dir' => $path['Home'], 'size' => sizeFormat(dir_size($path['Home'])), 'level' => sizeFormat(dir_size($path['Home']), 'level')), 'Staff' => array('id' => 'Staff', 'name' => 'Staff模块', 'dir' => $path['Staff'], 'size' => sizeFormat(dir_size($path['Staff'])), 'level' => sizeFormat(dir_size($path['Staff']), 'level')), 'Html' => array('id' => 'Html', 'name' => '静态缓存', 'dir' => $path['Html'], 'size' => sizeFormat(dir_size($path['Html'])), 'level' => sizeFormat(dir_size($path['Html']), 'level')), 'Cache' => array('id' => 'Cache', 'name' => '模板缓存', 'dir' => $path['Cache'], 'size' => sizeFormat(dir_size($path['Cache'])), 'level' => sizeFormat(dir_size($path['Cache']), 'level')), 'Data' => array('id' => 'Data', 'name' => '数据缓存', 'dir' => $path['Data'], 'size' => sizeFormat(dir_size($path['Data'])), 'level' => sizeFormat(dir_size($path['Data']), 'level')), 'Log' => array('id' => 'Log', 'name' => '日志缓存', 'dir' => $path['Log'], 'size' => sizeFormat(dir_size($path['Log'])), 'level' => sizeFormat(dir_size($path['Log']), 'level')), 'App' => array('id' => 'App', 'name' => '应用缓存', 'dir' => $path['App'], 'size' => sizeFormat(dir_size($path['App'])), 'level' => sizeFormat(dir_size($path['App']), 'level')), 'Run' => array('id' => 'Run', 'name' => '运行缓存', 'dir' => $path['Run'], 'size' => sizeFormat(filesize($path['Run'])), 'level' => sizeFormat(filesize($path['Run']), 'level')), 'Backup' => array('id' => 'Backup', 'name' => '数据库备份', 'dir' => $path['Backup'], 'size' => sizeFormat(dir_size($path['Backup'])), 'level' => sizeFormat(dir_size($path['Backup']), 'level')), 'Images' => array('id' => 'Images', 'name' => '图片目录', 'dir' => $path['Images'], 'size' => sizeFormat(dir_size($path['Images'])), 'level' => sizeFormat(dir_size($path['Images']), 'level')));
     if ($key) {
         return $list[$key];
     }
     return $list;
 }
コード例 #3
0
 /**
  * Controller constructor
  *
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->backup_enabled = (bool) ConfigOptions::getValue('backup_enabled');
     $this->how_many_backups = (int) ConfigOptions::getValue('backup_how_many_backups');
     $total_size = dir_size(UPLOAD_PATH);
     $total_size += dir_size(PUBLIC_PATH . '/avatars');
     $total_size += dir_size(PUBLIC_PATH . '/projects_icons');
     $total_size += dir_size(PUBLIC_PATH . '/logos');
     $total_size += backup_module_calculate_database_size(TABLE_PREFIX) * 1.1685;
     $existing_backups = backup_module_get_backups(BACKUP_PATH);
     $this->smarty->assign(array('backup_admin_url' => assemble_url('backup_admin'), 'backup_enabled' => $this->backup_enabled, 'backup_how_many_backups' => $this->how_many_backups, 'total_size' => $total_size, 'backup_dir_size' => dir_size(BACKUP_PATH), 'existing_backups' => $existing_backups));
 }
コード例 #4
0
ファイル: sysfunc.php プロジェクト: anboto/xtreamer-web-sdk
function dirSize($dir)
{
    $handle = opendir($dir);
    while ($file = readdir($handle)) {
        if ($file != '..' && $file != '.' && !is_dir($dir . '/' . $file)) {
            $mas += filesize($dir . '/' . $file);
        } else {
            if (is_dir($dir . '/' . $file) && $file != '..' && $file != '.') {
                $mas += dir_size($dir . '/' . $file);
            }
        }
    }
    return $mas;
}
コード例 #5
0
 /**
  * Calculate backup checksum
  *
  * @param string $backup_name
  * @return float
  */
 function calculate_checksum($backup_name)
 {
     $folders = array(BACKUP_PATH . "/{$backup_name}/upload", BACKUP_PATH . "/{$backup_name}/projects_icons", BACKUP_PATH . "/{$backup_name}/avatars", BACKUP_PATH . "/{$backup_name}/logos");
     $files = array(BACKUP_PATH . "/{$backup_name}/database.sql");
     $total_file_size = 0;
     foreach ($folders as $folder) {
         $total_file_size += dir_size($folder);
     }
     // foreach
     foreach ($files as $file) {
         $total_file_size += filesize($file);
     }
     // foreach
     return md5($total_file_size);
 }
コード例 #6
0
ファイル: frame.php プロジェクト: cranefly/crane
function m__space_use()
{
    $html = '空间占用情况:<span style=\\"color:red;\\">';
    if (!isset($_SESSION['space_size'])) {
        $_SESSION['space_size'] = num_bitunit(dir_size(dirname(__FILE__) . '/../'));
    }
    $html .= $_SESSION['space_size'];
    $html .= '</span>&nbsp;&nbsp;&nbsp;空间文件数量:<span style=\\"color:red;\\">';
    if (!isset($_SESSION['space_files'])) {
        $_SESSION['space_files'] = dir_files(dirname(__FILE__) . '/../');
    }
    $html .= $_SESSION['space_files'];
    $html .= '</span>';
    die('{"code":"0","msg":"' . $html . '"}');
}
コード例 #7
0
ファイル: welcome.ctrl.php プロジェクト: royalwang/saivi
function dir_size($dir) { 
    $handle = opendir($dir);
    $size = 0;
    while (false !== ($entry = readdir($handle))) { 
        if($entry != '.' && $entry != '..') { 
            if(is_dir("{$dir}/{$entry}")) { 
                $size += dir_size("{$dir}/{$entry}"); 
            } else { 
                $size += filesize("{$dir}/{$entry}"); 
            }
        }    
    }
    closedir($handle);
    return $size;
}
コード例 #8
0
ファイル: index.php プロジェクト: Kappappa/ikupaca
function dir_size($dir)
{
    $total_size = 0;
    $handle = opendir($dir);
    while ($file = readdir($handle)) {
        if ($file != '..' && $file != '.' && !is_dir($dir . '/' . $file)) {
            $total_size += filesize($dir . '/' . $file);
        } else {
            if (is_dir($dir . '/' . $file) && $file != '..' && $file != '.') {
                $total_size += dir_size($dir . '/' . $file);
            }
        }
    }
    closedir($handle);
    return $total_size;
}
コード例 #9
0
function dir_size($dir)
{
    $dh = opendir($dir);
    $size = 0;
    while ($file = readdir($dh)) {
        if ($file != '.' and $file != '..') {
            $path = $dir . "/" . $file;
            if (@is_dir($path)) {
                $size += dir_size($path);
            } else {
                $size += filesize($path);
            }
        }
    }
    @closedir($dh);
    return $size;
}
コード例 #10
0
ファイル: launcher.php プロジェクト: NikDiamond/NikLauncher
function dir_size($dirname)
{
    $totalsize = 0;
    if ($dirstream = @opendir($dirname)) {
        while (false !== ($filename = readdir($dirstream))) {
            if ($filename != "." && $filename != "..") {
                if (is_file($dirname . "/" . $filename)) {
                    $totalsize += filesize($dirname . "/" . $filename);
                }
                if (is_dir($dirname . "/" . $filename)) {
                    $totalsize += dir_size($dirname . "/" . $filename);
                }
            }
        }
    }
    closedir($dirstream);
    return $totalsize;
}
コード例 #11
0
ファイル: function.php プロジェクト: NwuNet/NetService
/**
 * 获取文件或文件大小
 * @param string $directoty 路径
 * @return int
 */
function dir_size($directoty)
{
    $dir_size = 0;
    if ($dir_handle = @opendir($directoty)) {
        while ($filename = readdir($dir_handle)) {
            $subFile = $directoty . DIRECTORY_SEPARATOR . $filename;
            if ($filename == '.' || $filename == '..') {
                continue;
            } elseif (is_dir($subFile)) {
                $dir_size += dir_size($subFile);
            } elseif (is_file($subFile)) {
                $dir_size += filesize($subFile);
            }
        }
        closedir($dir_handle);
    }
    return $dir_size;
}
コード例 #12
0
ファイル: utils.php プロジェクト: AlvarodelRosal/xppass
function dir_size($path)
{
    static $dir_size;
    $list_dir = list_dir($path);
    if (is_array($list_dir)) {
        foreach ($list_dir as $row) {
            if ($row['type'] == 'dir') {
                dir_size($row['path']);
            } else {
                $dir_size += filesize($row['path']);
            }
        }
    }
    return $dir_size;
}
コード例 #13
0
ファイル: endpoint.php プロジェクト: rlugojr/tilecraft
function clear_dir_if_size($dir, $max_size)
{
    $size = is_dir($dir) ? dir_size($dir) : 0;
    if ($size > $max_size) {
        $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
        foreach ($files as $file) {
            $op = $file->isDir() ? 'rmdir' : 'unlink';
            $op($file->getRealPath());
        }
    }
    return $size > $max_size;
}
コード例 #14
0
ファイル: uploads.php プロジェクト: tipsun91/punbb-mod
function dir_size($dir)
{
    $sz = 0;
    if ($str = @opendir($dir)) {
        while (($fnm = readdir($str)) !== false) {
            if ($fnm[0] != '.') {
                if (is_file($dir . '/' . $fnm)) {
                    $sz += filesize($dir . '/' . $fnm);
                } else {
                    if (is_dir($dir . '/' . $fnm)) {
                        $sz += dir_size($dir . '/' . $fnm);
                    }
                }
            }
        }
    }
    closedir($str);
    return $sz;
}
コード例 #15
0
function userfiles_build_menu()
{
    $quota = 10000;
    // in kilobytes
    if ($_SERVER['USER'] == 'listen') {
        $quota = 10000000;
    }
    if ($_SERVER['USER'] == 'jwdavidson') {
        $quota = 10000000;
    }
    $content .= "<html>\n\t<head>\n\t<script type='text/javascript' src='{$_SERVER['WEB_ROOT']}/resources/javascript/setplan.js' />\n\t<link rel='stylesheet' href='{$_SERVER['WEB_ROOT']}/stylesheet'>\n\t</head>\n\t<body>";
    $fileowner = $_SERVER['USER'];
    $fileowner_files_dir = "{$_SERVER['USER_ROOT']}/files";
    if (is_dir($fileowner_files_dir)) {
        $groupmembers = files_list("{$fileowner_files_dir}", "*", "date");
    } else {
        $groupmembers = array();
    }
    if (count($groupmembers) > 0) {
        foreach ($groupmembers as $fileownerfile) {
            $fileownerfile = basename($fileownerfile);
            if (strpos($fileownerfile, '.jpg') || strpos($fileownerfile, '.png') || strpos($fileownerfile, '.gif')) {
                $photolist[] = $fileownerfile;
            } elseif (strpos($fileownerfile, '.wav') || strpos($fileownerfile, '.mp3') || strpos($fileownerfile, '.m4a') || strpos($fileownerfile, '.au') || strpos($fileownerfile, '.wma') || strpos($fileownerfile, '.ogg')) {
                $audiolist[] = $fileownerfile;
            } else {
                $misclist[] = $fileownerfile;
            }
        }
    }
    unset($groupmembers);
    if (isset($photolist)) {
        foreach ($photolist as $photo) {
            $photosize = getimagesize("{$_SERVER['USER_ROOT']}/files/{$photo}");
            $photo_link = "<img src=\\'http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/userfiles/view/{$fileowner}/{$photo}\\' alt=\\'{$photo}\\' title=\\'{$photo}\\' width=\\'{$photosize['0']}\\' height=\\'{$photosize['1']}\\' />";
            $photo_content .= "\n\t\t\t<li><a  href=\"javascript:insertTag('textbox','{$photo_link}',''); window.parent.document.getElementById('insert').style.display='none'; void(0);\">\n\t\t\t<img src='http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/resources/graphics/posticon.gif' />\n\t\t\t{$photo}\n\t\t\t</a>\n\t\t\t<a href='http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/userfiles/delete/{$fileowner}/{$photo}/menu'>\n\t\t\t<img src='http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/resources/graphics/x.gif' width='8' height='8' />\n\t\t\t</a></li>\n";
        }
        $content .= "<li class='listheader'>Images</li>\n{$photo_content}\n\n";
    }
    if (isset($audiolist)) {
        foreach ($audiolist as $audio) {
            $audio_link = "<a href=\\'http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/userfiles/view/{$fileowner}/{$audio}\\' alt=\\'{$audio}\\'/>";
            $audio_content .= "\n\t\t\t<li><a  href=\"javascript:insertTag('textbox','{$audio_link}',''); window.parent.document.getElementById('insert').style.display='none'; void(0);\">\n\t\t\t<img src='http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/resources/graphics/smallaudio.gif' />\n\t\t\t{$audio}\n\t\t\t</a>\n\t\t\t<a href='http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/userfiles/delete/{$fileowner}/{$audio}/menu'>\n\t\t\t<img src='http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/resources/graphics/x.gif' width='8' height='8' />\n\t\t\t</a></li>\n";
        }
        $content .= "<li class='listheader'>Sounds</li>\n{$audio_content}\n\n";
    }
    if (isset($misclist)) {
        foreach ($misclist as $misc) {
            $misc_display = files_decode_safe_name($misc);
            $misc_link = "<a href=\\'http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/userfiles/view/{$fileowner}/{$misc}\\'>{$misc_display}</a>";
            $misc_content .= "\n\t\t\t<li><a  href=\"javascript:insertTag('textbox','{$misc_link}',''); window.parent.document.getElementById('insert').style.display='none'; void(0);\">\n\t\t\t<img src='{$_SERVER['WEB_ROOT']}/resources/graphics/posticon.gif' />\n\t\t\t{$misc}\n\t\t\t</a>\n\t\t\t<a href='{$_SERVER['WEB_ROOT']}/userfiles/delete/{$fileowner}/{$misc}/menu'>\n\t\t\t<img src='{$_SERVER['WEB_ROOT']}/resources/graphics/x.gif' width='8' height='8' />\n\t\t\t</a></li>\n";
        }
        $content .= "<li class='listheader'>Documents</li>\n{$misc_content}\n\n";
    }
    if (($ds = dir_size("{$_SERVER['USER_ROOT']}/files/")) < 1024 * $quota) {
        $uploadform = "<li>" . round($ds / 1024) . " K used of {$quota} K total\n\t\t<form target='hiddenUploadFrame' action='{$_SERVER['WEB_ROOT']}/scripts/userfiles.php' method='post' enctype='multipart/form-data'>\n\t\t<input type='file' name='files[1]' id='fileToUpload'/>\n\t\t<input type='submit' value='upload file' onclick=\"element('insert').style.display='none';void(0);\"/>\n\t\t<input type='hidden' name='action' value='write files'/>\n\t\t<input type='hidden' name='fileowner' value='{$_SERVER['USER']}'/>\n\t\t<input type='hidden' name='source' value='menu'/>\n\t\t<iframe id='hiddenUploadFrame' name='hiddenUploadFrame' style='height: 1px; width: 1px; visibility: hidden;'></iframe>\n\t\t</form></li>\n";
    } else {
        $content .= "<li><strong>QUOTA EXCEEDED. Please delete " . files_format_size($ds - $quota * 1024) . " of files.</li>";
    }
    $content .= "<li><a href='{$_SERVER['WEB_ROOT']}/userfiles/manage/{$_SERVER['USER']}' target='_top'><img src='{$_SERVER['WEB_ROOT']}{$GLOBALS['toolsicon']}'> manage your files</a></li>\n";
    $content .= "<li><a href='javascript:window.location.reload();'><img src='{$_SERVER['WEB_ROOT']}{$GLOBALS['toolsicon']}'> refresh the list</a></li>\n";
    $content = $uploadform . $content;
    return $content;
}
コード例 #16
0
ファイル: init.php プロジェクト: NaszvadiG/activecollab_loc
/**
 * Retrieves backups from backup folder and sort them in creation date
 *
 * @param string $folder
 * @return array
 */
function backup_module_get_backups($folder)
{
    $existing_backups = get_folders($folder);
    $existing_backups_list = array();
    if (is_foreachable($existing_backups)) {
        foreach ($existing_backups as $existing_backup) {
            $pathinfo = pathinfo($existing_backup);
            if (strpos($pathinfo['filename'], 'backup ') === 0) {
                $backup_name = $pathinfo['filename'];
                if (preg_match("/backup (.*)-(.*)-(.*) (.*)-(.*) GMT/", $backup_name, $results)) {
                    $timestamp = mktime($results[4], $results[5], 0, $results[2], $results[3], $results[1]);
                    $existing_backups_list[] = array('time' => new DateTimeValue($timestamp), 'timestamp' => $timestamp, 'size' => dir_size($existing_backup), 'complete' => backup_module_backup_is_valid($backup_name), 'path' => $existing_backup);
                }
                // if
            }
            // if
        }
        // foreach
    }
    // if
    // sort arrays by date
    usort($existing_backups_list, 'backup_module_compare_backup_dates');
    return $existing_backups_list;
}
コード例 #17
0
ファイル: dbbak.php プロジェクト: cranefly/crane
function get_hander()
{
    global $dbkdir;
    $filedb = array();
    if (is_dir($dbkdir) && file_exists($dbkdir) && dir_size($dbkdir) > 0) {
        $filedb['version'] = VERSION;
        $filedb['time'] = date("Y-m-d H:i:s");
        $filedb['dbsize'] = num_bitunit(dir_size($dbkdir));
    }
    return $filedb;
}
コード例 #18
0
function dir_size($dir)
{
    if (file_exists($dir)) {
    }
    if (!is_dir($dir)) {
        return FALSE;
    }
    $dh = @opendir($dir);
    $size = 0;
    while ($file = @readdir($dh)) {
        if (!($file == ".")) {
            if ($file == "..") {
                break;
            }
        } else {
            continue;
        }
        $path = $dir . "/" . $file;
        if (is_dir($path)) {
            $size += dir_size($path);
        } else {
            if (is_file($path)) {
                $size += filesize($path);
            }
        }
    }
    @closedir($dh);
    return $size;
}
コード例 #19
0
ファイル: admin.php プロジェクト: yunsite/cyaskuc
        admin_footer();
    } else {
        $serverinfo = getenv('OS') . ' / php v' . phpversion();
        $dbversion = $dblink->version();
        if (@ini_get('file_uploads')) {
            $fileupload = $lang['yes'] . ': file ' . ini_get('upload_max_filesize') . ' - form ' . ini_get('post_max_size');
        } else {
            $fileupload = '<font color="red">' . $lang['no'] . '</font>';
        }
        $dbsize = 0;
        $query = $dblink->query("SHOW TABLE STATUS LIKE '{$tablepre}%'", 'SILENT');
        while ($table = $dblink->fetch_array($query)) {
            $dbsize += $table['Data_length'] + $table['Index_length'];
        }
        $dbsize = $dbsize ? sizecount($dbsize) : $lang['unknown'];
        $attachsize = dir_size('./attachments/');
        $attachsize = is_numeric($attachsize) ? sizecount($attachsize) : $lang['unknown'];
        admin_header();
        ?>
		<br /><br />
		<table cellspacing="1" cellpadding="0" width="85%" align="center" class="tableborder">
		<tr><td>
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
			<tr class="header"><td colspan="2"><?php 
        echo $lang['home_sys_info'];
        ?>
</td></tr>
			<tr bgcolor="#FFFFFF"><td width="45%"><?php 
        echo $lang['home_environment'];
        ?>
</td><td><?php 
コード例 #20
0
ファイル: files.php プロジェクト: bklein01/Project-Pier
/**
 * Return size of a specific dir in bytes
 *
 * @access public
 * @param string $dir Directory
 * @return integer
 */
function dir_size($dir)
{
    $totalsize = 0;
    if ($dirstream = @opendir($dir)) {
        while (false !== ($filename = readdir($dirstream))) {
            if ($filename != "." && $filename != "..") {
                $path = with_slash($dir) . $filename;
                if (is_file($path)) {
                    $totalsize += filesize($path);
                }
                if (is_dir($path)) {
                    $totalsize += dir_size($path);
                }
            }
            // if
        }
        // while
    }
    // if
    closedir($dirstream);
    return $totalsize;
}
コード例 #21
0
ファイル: files.php プロジェクト: NaszvadiG/activecollab_loc
/**
 * Walks recursively through directory and calculates its total size - returned in bytes
 *
 * @param string $dir Directory
 * @param boolean $skip_files_starting_with_dot (Hidden files)
 * @return integer
 */
function dir_size($dir, $skip_files_starting_with_dot = true)
{
    $totalsize = 0;
    if ($dirstream = @opendir($dir)) {
        while (false !== ($filename = readdir($dirstream))) {
            if ($skip_files_starting_with_dot) {
                if ($filename != '.' && $filename != '..' && $filename[0] != '.') {
                    $path = with_slash($dir) . $filename;
                    if (is_file($path)) {
                        $totalsize += filesize($path);
                    }
                    if (is_dir($path)) {
                        $totalsize += dir_size($path, $skip_files_starting_with_dot);
                    }
                }
                // if
            } else {
                if ($filename != '.' && $filename != '..') {
                    $path = with_slash($dir) . $filename;
                    if (is_file($path)) {
                        $totalsize += filesize($path);
                    }
                    if (is_dir($path)) {
                        $totalsize += dir_size($path, $skip_files_starting_with_dot);
                    }
                }
                // if
            }
        }
        // while
    }
    // if
    closedir($dirstream);
    return $totalsize;
}
コード例 #22
0
function dir_size($dir, &$older, &$older_accessed)
{
    $handle = opendir($dir);
    $mas = 0;
    while ($file = readdir($handle)) {
        if ($file != '..' && $file != '.') {
            if (is_dir($dir . '/' . $file)) {
                $mas += dir_size($dir . '/' . $file, $older, $older_accessed);
            } else {
                $mas += filesize($dir . '/' . $file);
                if ($older != '') {
                    if (fileatime($dir . '/' . $file) < fileatime($older)) {
                        $older = $dir . '/' . $file;
                    }
                } else {
                    $older = $dir . '/' . $file;
                }
                if ($older_accessed != '') {
                    if (fileatime($dir . '/' . $file) < fileatime($older_accessed)) {
                        $older_accessed = $dir . '/' . $file;
                    }
                } else {
                    $older_accessed = $dir . '/' . $file;
                }
            }
        }
    }
    return $mas;
    // bytes
}
コード例 #23
0
ファイル: common.php プロジェクト: steem/qwp
function dir_size($dir)
{
    $handle = opendir($dir);
    $size = 0;
    while (false !== ($file = readdir($handle))) {
        if (is_dot_dir($file)) {
            continue;
        }
        if (is_dir("{$dir}/{$file}")) {
            $size += dir_size("{$dir}/{$file}");
        } else {
            $size += filesize("{$dir}/{$file}");
        }
    }
    closedir($handle);
    return $size;
}