本文整理汇总了PHP中getDirectorySize函数的典型用法代码示例。如果您正苦于以下问题:PHP getDirectorySize函数的具体用法?PHP getDirectorySize怎么用?PHP getDirectorySize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDirectorySize函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDirectorySize
function getDirectorySize($path)
{
$totalsize = 0;
$totalcount = 0;
$dircount = 0;
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
$nextpath = $path . '/' . $file;
if ($file != '.' && $file != '..' && !is_link($nextpath)) {
if (is_dir($nextpath)) {
$dircount++;
$result = getDirectorySize($nextpath);
$totalsize += $result['size'];
$totalcount += $result['count'];
$dircount += $result['dircount'];
} elseif (is_file($nextpath)) {
$totalsize += filesize($nextpath);
$totalcount++;
}
}
}
}
closedir($handle);
$total['size'] = $totalsize;
$total['count'] = $totalcount;
$total['dircount'] = $dircount;
return $total;
}
示例2: calculateTotalFileUploadUsage
/**
* This function calculates how much space is actually used by all files uploaded
* using the File Upload question type
*
* @returns integer Actual space used in MB
*/
function calculateTotalFileUploadUsage()
{
global $uploaddir;
$sQuery = 'select sid from {{surveys}}';
$oResult = dbExecuteAssoc($sQuery);
//checked
$aRows = $oResult->readAll();
$iTotalSize = 0.0;
foreach ($aRows as $aRow) {
$sFilesPath = $uploaddir . '/surveys/' . $aRow['sid'] . '/files';
if (file_exists($sFilesPath)) {
$iTotalSize += (double) getDirectorySize($sFilesPath);
}
}
return (double) $iTotalSize / 1024 / 1024;
}
示例3: executesql_returnArray
if ($subdomain == 'centerlimit') {
continue;
}
if ($status == 'Y') {
echo "<tr>";
}
if ($status == 'N') {
echo "<tr class='inactive'>";
}
$tdclass = $tdclass == "evenrow" ? "oddrow" : "evenrow";
$uname = executesql_returnArray("select variablevalue from " . $dbname . ".sadmin where variable='sadminusername'");
$password = executesql_returnArray("select variablevalue from " . $dbname . ".sadmin where variable='sadminpass'");
$curusers = executesql_returnArray("select count(username) as curnoofusers from " . $dbname . ".users");
$expensesCount = executesql_returnArray("select count(sno) as expensesCount from " . $dbname . ".expenses ");
$target_path = "../attachments/" . $subdomain . "/";
$tmp = getDirectorySize($target_path);
$currentsize = ceil($tmp['size'] / (1024 * 1024));
?>
<td class="<?php
echo $tdclass;
?>
" TITLE="<?php
echo $uname . "/" . $password;
?>
"><?php
echo $clientName;
?>
</td>
<td class="<?php
echo $tdclass;
?>
示例4: COUNT
* @author SteamFriends Development Team
* @version 1.0.0
* @copyright SourceBans (C)2007 SteamFriends.com. All rights reserved.
* @package SourceBans
* @link http://www.sourcebans.net
*
* @version $Id: page.admin.php 186 2008-12-23 18:40:09Z peace-maker $
* =============================================================================
*/
if (!defined("IN_SB")) {
echo "You should not be here. Only follow links!";
die;
}
global $userbank, $theme;
$counts = $GLOBALS['db']->GetRow("SELECT \r\n\t\t\t\t\t\t\t\t (SELECT COUNT(bid) FROM `" . DB_PREFIX . "_banlog`) AS blocks, \r\n\t\t\t\t\t\t\t\t (SELECT COUNT(bid) FROM `" . DB_PREFIX . "_bans`) AS bans,\r\n\t\t\t\t\t\t\t\t (SELECT COUNT(aid) FROM `" . DB_PREFIX . "_admins` WHERE aid > 0) AS admins,\r\n\t\t\t\t\t\t\t\t (SELECT COUNT(subid) FROM `" . DB_PREFIX . "_submissions` WHERE archiv = '0') AS subs,\r\n\t\t\t\t\t\t\t\t (SELECT COUNT(subid) FROM `" . DB_PREFIX . "_submissions` WHERE archiv > 0) AS archiv_subs,\r\n\t\t\t\t\t\t\t\t (SELECT COUNT(pid) FROM `" . DB_PREFIX . "_protests` WHERE archiv = '0') AS protests,\r\n\t\t\t\t\t\t\t\t (SELECT COUNT(pid) FROM `" . DB_PREFIX . "_protests` WHERE archiv > 0) AS archiv_protests,\r\n\t\t\t\t\t\t\t\t (SELECT COUNT(sid) FROM `" . DB_PREFIX . "_servers`) AS servers");
$demsi = getDirectorySize(SB_DEMOS);
$theme->assign('access_admins', $userbank->HasAccess(ADMIN_OWNER | ADMIN_LIST_ADMINS | ADMIN_ADD_ADMINS | ADMIN_EDIT_ADMINS | ADMIN_DELETE_ADMINS));
$theme->assign('access_servers', $userbank->HasAccess(ADMIN_OWNER | ADMIN_LIST_SERVERS | ADMIN_ADD_SERVER | ADMIN_EDIT_SERVERS | ADMIN_DELETE_SERVERS));
$theme->assign('access_bans', $userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN | ADMIN_EDIT_OWN_BANS | ADMIN_EDIT_GROUP_BANS | ADMIN_EDIT_ALL_BANS | ADMIN_BAN_PROTESTS | ADMIN_BAN_SUBMISSIONS));
$theme->assign('access_groups', $userbank->HasAccess(ADMIN_OWNER | ADMIN_LIST_GROUPS | ADMIN_ADD_GROUP | ADMIN_EDIT_GROUPS | ADMIN_DELETE_GROUPS));
$theme->assign('access_settings', $userbank->HasAccess(ADMIN_OWNER | ADMIN_WEB_SETTINGS));
$theme->assign('access_mods', $userbank->HasAccess(ADMIN_OWNER | ADMIN_LIST_MODS | ADMIN_ADD_MODS | ADMIN_EDIT_MODS | ADMIN_DELETE_MODS));
$theme->assign('sb_svn', defined('SB_GIT'));
$theme->assign('demosize', sizeFormat($demsi['size']));
$theme->assign('total_admins', $counts['admins']);
$theme->assign('total_bans', $counts['bans']);
$theme->assign('total_blocks', $counts['blocks']);
$theme->assign('total_servers', $counts['servers']);
$theme->assign('total_protests', $counts['protests']);
$theme->assign('archived_protests', $counts['archiv_protests']);
$theme->assign('total_submissions', $counts['subs']);
示例5: getDirectorySize
?>
</font>
</p>
<ul style="list-style: none;font-size:12px">
<li><a href="http://www.datso.fr/news.html"><?php
echo JText::_('COM_DATSOGALLERY_NEWS');
?>
</a></li>
<li><a href="http://www.datso.fr/video-guidelines.html"><?php
echo JText::_('COM_DATSOGALLERY_FLASH_DEMO');
?>
</a></li>
</ul>
<p>
<?php
$pathorig = getDirectorySize(JPath::clean(JPATH_SITE . $ad_pathoriginals));
echo "<span style=\"font-size:14px;color:#808080\">Details for Originals Picture Path</span>";
echo "<ul style=\"list-style:none;font-size:12px\">\n";
echo "<li>Total size : " . sizeFormat($pathorig['size']) . "</li>\n";
echo "<li>No. of files : " . $pathorig['count'] . "</li>\n";
echo "</ul>";
?>
</p>
</td>
</tr>
</table>
</fieldset>
<?php
echo $tabs->endPanel();
echo $tabs->startPanel('PayPal', "tab10");
示例6: filemtime
}
}
if (!is_file($backup_dir . '/' . $file)) {
continue;
}
if ($older['datetime'] == null) {
$older['file'] = $backup_dir . '/' . $file;
$older['datetime'] = filemtime($backup_dir . '/' . $file);
}
if ($older['datetime'] > filemtime($backup_dir . '/' . $file)) {
$older['file'] = $backup_dir . '/' . $file;
$older['datetime'] = filemtime($backup_dir . '/' . $file);
}
}
if ($older['file'] == null) {
echo __('Erreur aucun fichier à supprimer alors que le dossier fait : ' . getDirectorySize($backup_dir), __FILE__);
}
echo __("\n - Suppression de : ", __FILE__) . $older['file'] . "\n";
if (!unlink($older['file'])) {
$i = 50;
}
$i++;
if ($i > 50) {
echo __("Plus de 50 sauvegardes supprimées. Je m'arrête.\n", __FILE__);
break;
}
}
echo __("OK", __FILE__) . "\n";
global $NO_CLOUD_BAKCUP;
if (!isset($NO_CLOUD_BAKCUP) || $NO_CLOUD_BAKCUP == false) {
if (config::byKey('backup::cloudUpload') == 1 && init('noCloudUpload', 0) == 0) {
示例7: getSizeFromCache
/**
* Get size of path and convert it
* @param string $path
* @return string
*/
function getSizeFromCache($path)
{
return format_bytes(getDirectorySize($path));
}