/** * 获取缓存列表 * @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; }
/** * 获取缓存列表 * @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; }
/** * Взять файлы для определенного документа * $param integer $docs_id - ИД документа * @return array Данные выборки */ public static function getDocsFiles($docs_id) { global $DB; $sql = 'SELECT D.*, F.id AS cfile_id, F.size, F.path, F.modified, F.fname FROM docs_files D INNER JOIN file F ON (D.file_id = F.id) WHERE D.docs_id = ?i ORDER BY D.sort'; $data = $DB->rows($sql, (int) $docs_id); if ($data) { foreach ($data as &$file) { $file['ico_class'] = getIcoClassByExt($file['fname']); $file['file_size'] = sizeFormat($file['size']); } self::SelectMinMax($data); } return $data; }
$cor = "progress-bar progress-bar-info"; } elseif ($valor >= 70 && $valor < 90) { $cor = "progress-bar progress-bar-warning"; } elseif ($valor >= 90) { $cor = "progress-bar progress-bar-danger"; } ?> </p> <ul class="list-group"> <li class="list-group-item">Quantidade de arquivos armazenados: <span class="badge"><?php echo $ar['count']; ?> </span></li> <li class="list-group-item">Tamanho Total da pasta: <span class="badge"><?php echo sizeFormat($ar['size']); ?> </span></li> <li class="list-group-item">Espaço máx. recomendado: <span class="badge">500 MB</span></li> </ul> Percentual de espaço ocupado: <div class="progress"> <div class="<?php echo $cor; ?> " role="progressbar" aria-valuenow="<?php echo $valor; ?> " aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $valor; ?>
$totalcount += $valor['files']; $totalsize += $valor['size']; } ?> <tr><td height="22"><b><font color="#0C70EE">Total</font></b></td> <td height="22"><b><font color="#0C70EE"><?php echo number_format($totalcount, 0, "", "'"); ?> </font></b></td> <td height="22"><b><font color="#0C70EE"><?php echo sizeFormat($totalsize); ?> </font></b></td> <td height="22"><b><font color="#0C70EE"><?php echo sizeFormat($totaleconomy); ?> </font></b></td> <td height="22"><b><font color="#0C70EE"><?php echo number_format($totalhits, 1, ".", "'"); ?> </font></b></td> <td height="22"><b><font color="#0C70EE"><?php echo round($totaleconomy / $totalsize * 100, 3); ?> %</font></b></td></tr> </table><br> <table border="1" align="center"><tr><td align="left"><pre> <?php system("free -hm | grep -v \"buffers\\/cache\""); ?>
* @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']); $theme->assign('archived_submissions', $counts['archiv_subs']); $theme->display('page_admin.tpl');
/** * Конвертация размера файла из байтов в мегобайты * * @param integer $size Размер (в байтах) * @return string */ function ConvertBtoMB($size) { return sizeFormat($size); //str_replace(' ', ' ', sizeFormat($size)); }
<P><BR><P> <P><P><HR WIDTH=75%> <h3>Remove Dataset:</h3> <div style="background-color: #EFEFEF; width: 600px; padding: 15px; border: grey 1px dashed;"> <A HREF="/cgi-bin/cravatt/restricted/cimage-dset-remove.pl?function=list" onClick="javascript:return confirm('Are you sure you want to remove data?')">Click here</a> to remove datasets. </div> <P><BR><P> <?php $path = "/srv/www/htdocs/cimage/cimage_data/"; $ar = getDirectorySize($path); //echo "<FONT SIZE=-2 COLOR=999999>$path"; echo "<FONT SIZE=-2 COLOR=999999>"; echo "<BR>Current database size: " . sizeFormat($ar['size']) . "<br>"; //echo "No. of files : ".$ar['count']."<br>"; //echo "No. of directories : ".$ar['dircount']."<br></font>"; ?> </body> </html> <?php function getDirectorySize($path) { $totalsize = 0; $totalcount = 0;
} $setting_row = mysql_fetch_array($setting_query, MYSQL_ASSOC); $row_options['id'] = $setting_row['id']; $row_options['resolutionPx_horizon'] = $setting_row['resolutionPx_horizon']; $row_options['resolutionPx_vertical'] = $setting_row['resolutionPx_vertical']; $row_options['projectionCm_horizon'] = $setting_row['projectionCm_horizon']; $row_options['projectionCm_vertical'] = $setting_row['projectionCm_vertical']; $row_options['directory_allowed_space'] = $setting_row['allowed_diskspace_go']; $row_options['auto_slideshow_activate'] = $setting_row['auto_slideshow_activate']; $row_options['auto_slideshow_time'] = $setting_row['auto_slideshow_time']; $row_options['scale_real_activate'] = $setting_row['scale_real_activate']; $row_options['selection_countdown_time'] = $setting_row['selection_countdown_time']; $galleryDirectory = 'gallery_' . $galleryId . '/'; $path = $destination_folder . $galleryDirectory; $ar = getDirectorySize($path); $row_options['directory_used_space'] = sizeFormat($ar['size']); $json_response_options = array(); array_push($json_response_options, $row_options); echo json_encode($json_response_options); 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);
<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"); ?> <fieldset class="adminform">
?> .png" alt=""> </span> <a href="javascript:void(0)" onclick="xajax_MsgDelFile(<?php echo $cid; ?> ,<?php echo $attach['id']; ?> )" title="Удалить"><img src="/images/btn-remove2.png" alt="Удалить"></a><a href="<?php echo WDCPREFIX; ?> /users/<?php echo $mess['user_login']; ?> /upload/<?php echo $attach['fname']; ?> " target="_blank" class="mime <?php echo getIcoClassByExt($attach['fname']); ?> "><?php echo $attach['ftype']; ?> </a>, <?php echo sizeFormat($attach['size']); ?> </li> <? } ?> <? } ?>
public function download() { $root = 'Public/Files/Home/'; $list = array('0' => $root . 'V2.0.1.pdf', '1' => $root . 'StudentNetwork.pdf', '2' => $root . 'Apple.pdf', '3' => $root . 'Wiring.pdf', '4' => $root . 'VLAN-study.pdf', '5' => $root . 'Windows-console.pdf', '6' => $root . 'Network-exchange.pdf', '7' => $root . 'DG2015Setup-1197E.exe', '8' => $root . 'USB-DB9.exe', '9' => $root . 'chrome-and.apk', '10' => $root . 'chrome-win.exe'); $files = array(); foreach ($list as $key => $item) { $tmp = stat($item); $files[$key]['size'] = sizeFormat($tmp['size']); } // trace($list); $this->assign('files', $files); $this->assign('lists', $list); $log = D('Admin/SystemLog', 'Service'); $this->assign('day_sum', $log->dayhome()); $this->assign('all_sum', $log->allhome()); $this->display(); }
<?php $path = "/project/Mavericks"; $ar = getDirectorySize($path); // echo "<h4>Details for the path : $path</h4>"; // echo "Total size : ".sizeFormat($ar['size'])."<br>"; // echo "No. of files : ".$ar['count']."<br>"; // echo "No. of directories : ".$ar['dircount']."<br>"; return $user_utilization = sizeFormat($ar['size']); return $files = $ar['count']; 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++; } } }
/** * Export records from AMS for PBCore and PREMIS and save all the exported records in zip file using BagIt. * * @return void */ function export_pbcore() { @ini_set("max_execution_time", 999999999999.0); # unlimited @ini_set("memory_limit", "2000M"); # 2GB error_reporting(E_ALL); ini_set('display_errors', 1); $export_job = $this->export_job->get_export_jobs('pbcore'); if (count($export_job) > 0) { $this->export_job->update_job($export_job->id, array('status' => '1')); myLog('Started export for ID =>' . $export_job->id); $bag_name = 'ams_export_' . time(); $bagit_info = array('Source-Organization' => 'WGBH on behalf of the American Archive of Public Broadcasting', 'Organization-Address' => 'Media Library & Archives, One Guest Street, Boston, MA 02135', 'Contact-Name' => 'Casey E. Davis, Project Manager', 'Contact-Phone' => '+1 617-300-5921', 'Contact-Email' => 'info@americanarchive.org ', 'External-Description' => 'The American Archive of Public Broadcasting, a collaboration between WGBH Boston and the Library of Congress, includes millions of records of public television and radio assets contributed by over 100 stations and organizations across the United States.'); $bagit_lib = new BagIt("{$this->bagit_path}{$bag_name}", TRUE, TRUE, FALSE, $bagit_info); $bagit_lib->setHashEncoding('md5'); $total_size = 0; $total_files = 0; if ($export_job->query_loop == 0) { $export_ids = explode(',', $export_job->export_query); foreach ($export_ids as $asset_id) { $this->do_export($asset_id, $total_size, $total_files, $bagit_lib); } } else { for ($i = 0; $i < $export_job->query_loop; $i++) { $query = $export_job->export_query; $query .= ' LIMIT ' . $i * 100000 . ', 100000'; $records = $this->export_job->get_csv_records($query); foreach ($records as $value) { $this->do_export($value->id, $total_size, $total_files, $bagit_lib); } } } $bagit_lib->setBagInfoData('Payload-Oxum', $total_size . '.' . $total_files); $bagit_lib->setBagInfoData('Bagging-Date', date('Y-m-d')); $bagit_lib->setBagInfoData('Bag-Size', sizeFormat($total_size)); $bagit_lib->update(); $bagit_lib->package("{$this->bagit_path}{$bag_name}", 'zip'); exec("rm -rf {$this->temp_path}"); exec("rm -rf {$this->bagit_path}{$bag_name}"); $this->export_job->update_job($export_job->id, array('status' => '1', 'file_path' => "{$this->bagit_path}{$bag_name}.zip")); $user = $this->users->get_user_by_id($export_job->user_id)->row(); $data['user_profile'] = $this->user_profile->get_profile($export_job->user_id)->row(); $data['user'] = $user; $data['export_id'] = $export_job->id; myLog('Sending Email to ' . $user->email); send_email($user->email, $this->config->item('from_email'), 'AMS XML Export', $this->load->view('email/export_pbcore', $data, TRUE)); myLog('email sent successfully ' . $user->email); } else { myLog('No record availabe for export'); } exit_function(); }