/** * Created by PhpStorm. * User: Administrator * Date: 15-7-11 * Time: 上午10:26 */ function dirSize($directory) { $dir_size = 0; //累加各种文件大小 if ($dir_handle = @opendir($directory)) { //打开目录,,并判断是否能成功打开,@使用不显示错误。 while ($filename = readdir($dir_handle)) { //循环遍历目录下的所有文件 if ($filename != "." && $filename != "..") { //排除两个特殊的目录 $subFile = $directory . "/" . $filename; //将目录下的子文件和当前目录相连 if (is_dir($subFile)) { //如果子文件是目录,则递归 $dir_size += dirSize($subFile); } if (is_file($subFile)) { // 如果是文件,则直接计算filesize大小并累加 $dir_size += filesize($subFile); } } } closedir($dir_handle); //最后一定要记得关闭文件句柄 return $dir_size; //返回输入目录的大小,单位是byte } }
private function getServerFiles($serversList, $id) { $res = array(); $tasksData = $serversList->data[$id]['tasks']; foreach (glob(__archiveDIR . "servers/{$id}/*") as $path) { $name = 'Undefined'; $subId = str_replace(__archiveDIR . "servers/{$id}/", '', $path); if (isset($tasksData[$subId])) { $name = $tasksData[$subId]['title']; } $res[] = array('id' => $subId, 'name' => $name, 'size' => dirSize($path), 'time' => filectime($path), 'filesCount' => count(glob($path . "/*"))); } return $res; }
private function getLocalFolder() { $res = array(); $tasksList = new JsonDB(__taskdb); foreach (glob(__archiveDIR . 'local/*') as $path) { if (is_dir($path)) { $id = str_replace(__archiveDIR . 'local/', '', $path); $name = 'Undefined'; if (isset($tasksList->data[$id])) { $name = $tasksList->data[$id]['title']; } $res[$id] = array('id' => $id, 'name' => $name, 'size' => dirSize($path), 'time' => filectime($path), 'filesCount' => count(glob($path . "/*"))); } } return $res; }
/** * 递归获取文件夹大小 * @param $path * @return int */ function dirSize($path) { $sum = 0; //global $sum; $handle = opendir($path); while (($item = readdir($handle)) !== false) { if ($item != '.' && $item != '..') { if (is_file($path . '/' . $item)) { $sum += filesize($path . '/' . $item); } if (is_dir($path . '/' . $item)) { /*$func = __FUNCTION__; $func($path.'/'.$item);*/ $sum += dirSize($path . '/' . $item); //递归获取文件夹的大小 } } } closedir($handle); return $sum; }
<link href="../../../etc/styles/<?php echo $currentuser['usertheme']; ?> /css/<?php echo $currentuser['usercss']; ?> .css" rel="stylesheet" type="text/css"> <script src="../assets/ajaxsbmt.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-latest.js"></script> <body style="background: #F3F3F3;"> <div style="margin-left:20px;margin-right:20px;"> <div class="zform_wrapper"> <h2>Backup your hosting account files</h2> <p>Your data is ready to be backed up. This proccess can take a lot of time, depending on your directory size. When finished you will be prompted to download your archive.</p> <p>Current public directory size: <b><?php echo fs_director::ShowHumanFileSize(dirSize(ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . "/public_html")); ?> </b></p> <div id="BackupSubmit" style="height:100%;margin:auto;"> <form name="doBackup" action="response_normal.php" method="post" onsubmit="xmlhttpPost('dobackup.php?id=<?php echo $userid; ?> ', 'doBackup', 'BackupResult', 'Compressing your data, please wait...<br><img src=\'../assets/bar.gif\'>'); return false;"> <table class="zform"> <tr valign="top"> <th nowrap="nowrap"><button class="fg-button ui-state-default ui-corner-all" id="SubmitBackup" type="submit" name="inBackUp" value="">Backup Now</button></th> <td><input type="hidden" name="inDownLoad" id="inDownLoad" value="1" /></td> </tr> </table> </form> </div>
?> <!-- 读取目录的操作--> <?php if($info['dir']){ $i=$i==null?1:$i; foreach($info['dir'] as $val){ $p=$path."/".$val; ?> <tr> <td><?php echo $i;?></td> <td><?php echo $val;?></td> <td><?php $src=filetype($p)=="file"?"file_ico.png":"folder_ico.png";?><img src="images/<?php echo $src;?>" alt="" title="文件"/></td> <td><?php $sum=0; echo transByte(dirSize($p));?></td> <td><?php $src=is_readable($p)?"correct.png":"error.png";?><img class="small" src="images/<?php echo $src;?>" alt=""/></td> <td><?php $src=is_writable($p)?"correct.png":"error.png";?><img class="small" src="images/<?php echo $src;?>" alt=""/></td> <td><?php $src=is_executable($p)?"correct.png":"error.png";?><img class="small" src="images/<?php echo $src;?>" alt=""/></td> <td><?php echo date("Y-m-d H:i:s",filectime($p));?></td> <td><?php echo date("Y-m-d H:i:s",filemtime($p));?></td> <td><?php echo date("Y-m-d H:i:s",fileatime($p));?></td> <td> <a href="index.php?path=<?php echo $p;?>" ><img class="small" src="images/show.png" alt="" title="查看"/></a>| <a href="index.php?act=renameFolder&path=<?php echo $path;?>&dirname=<?php echo $p;?>"><img class="small" src="images/rename.png" alt="" title="重命名"/></a>| <a href="index.php?act=copyFolder&path=<?php echo $path;?>&dirname=<?php echo $p;?>"><img class="small" src="images/copy.png" alt="" title="复制"/></a>| <a href="index.php?act=cutFolder&path=<?php echo $path;?>&dirname=<?php echo $p;?>"><img class="small" src="images/cut.png" alt="" title="剪切"/></a>| <a href="#" onclick="delFolder('<?php echo $p;?>','<?php echo $path;?>')"><img class="small" src="images/delete.png" alt="" title="删除"/></a>| </td> </tr> <?php
/** * Rutina encargada de leer los directorios, subdirectorios y archivos de * una determinada $ruta * $catalogo: catalogo al que corresponden los archivos * $ruta: ruta a leer */ function listar_directorios_ruta($catalogo, $ruta) { header("Content-type: text/html; charset=UTF-8"); // abrir un directorio y listarlo recursivo if (is_dir($ruta)) { if ($dh = opendir($ruta)) { while (($file = readdir($dh)) !== false) { //esta línea la utilizaríamos si queremos listar todo lo que hay en el directorio //mostraría tanto archivos como directorios if ($file != '.' && $file != '..') { include "conn.php"; //conexion a postgresql $conn = pg_connect("host={$dbhost} port={$dbport} dbname={$dbname} user={$dbuser} password={$dbpass}") or die('<div width="100%" class="error">OCURRIO UN ERROR AL INTENTAR CONECTAR A LA BASE DE DATOS <B>' . $dbname . ' </B></div>'); $filetype = filetype($ruta . $file); switch ($filetype) { case 'dir': $extension = 'dir'; $size = sprintf("%u", dirSize($ruta . $file)); break; //Obteniendo la extension del archivo //Obteniendo la extension del archivo default: //try{ $extension = strtolower(substr(strrchr($ruta . $file, "."), 1)); //Lee correctamente archivos mayores a 4GB $size = GetRealSize($ruta . $file); break; } $file_temp = strtolower(limpia($file)); $ruta_temp = strtolower(limpia($ruta)); //String para ingresar el archivo $query = "insert into archivo values('{$catalogo}','{$file_temp}','{$size}','{$extension}','{$ruta_temp}');"; if ($debug) { echo $query . "<br>"; } //Ingresando el archivo $result = pg_query($conn, $query); if (!$result) { mensaje("Nombre Archivo: " . $file_temp, pg_last_error($conn)); } pg_close($conn); } //if para saber si el elemento es un directorio if (is_dir($ruta . $file) && $file != "." && $file != "..") { //solo si el archivo es un directorio, distinto que "." y ".." //echo "<br>Directorio: $ruta$file"; listar_directorios_ruta($catalogo, $ruta . $file . "/"); } } closedir($dh); } } else { echo "<br>No es ruta valida" + $ruta; } }
function getSize($dirFile, $mode = 'file') { if ('file' == $mode) { $stats = stat($dirFile); } elseif ('dir' == $mode) { $stats['size'] = dirSize($dirFile); } if (empty($stats['size'])) { $stats['_size'] = ''; } elseif ($stats['size'] < 1024) { $stats['_size'] .= ' B'; } elseif ($stats['size'] < 1048576) { $stats['_size'] = round($stats['size'] / 1024) . ' KB'; } else { $stats['_size'] = round($stats['size'] / 1048576, 2) . ' MB'; } return $stats; }
?> </td> <td><?php echo $val; ?> </td> <td><?php $src = filetype($p) == "file" ? "file_ico.png" : "folder_ico.png"; ?> <img src="images/<?php echo $src; ?> " alt="" title="文件"/></td> <td><?php $sum = 0; echo transByte(dirSize($p)); ?> </td> <td><?php $src = is_readable($p) ? "correct.png" : "error.png"; ?> <img class="small" src="images/<?php echo $src; ?> " alt=""/></td> <td><?php $src = is_writable($p) ? "correct.png" : "error.png"; ?> <img class="small" src="images/<?php echo $src; ?>
<?php //Testing //$dir= "sample/4mh11me"; //Production $clg = $_POST["clg"]; $code = $_POST["code"]; $year = $_POST["year"]; $branch = $_POST["branch"]; $dir = "sample/" . $clg . $code . $year . $branch; function dirSize($directory) { $size = 0; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) { $size += $file->getSize(); } return round($size / 1024) . " kb"; } $fi = new FilesystemIterator($dir, FilesystemIterator::SKIP_DOTS); $arr = array('fileN' => iterator_count($fi), 'size' => dirSize($dir)); echo json_encode($arr);
<div class="moduleContent" align=left> <?php $localModules = getLocalList(); if ($localModules[0] == "") { echo "<center>" . $strings["modules-installed-noModules"] . "</center>"; } else { #$usbPresent = (exec("mount | grep \"on /usb\" -c") >= 1)?true:false; $usbModules = false; $moduleArray = array(); foreach ($localModules as $module) { $usbModules = false; $module = explode("|", $module); if ($module[2] == "internal") { $size = dirSize("/pineapple/infusions/" . $module[0]); } else { $size = dirSize("/pineapple/infusions/usbInfusions/" . $module[0]); } if ($module[4] == "") { $supportLink = ""; } else { $supportLink = "<a href=\"" . $module[4] . "\" target=\"_blank\">" . $strings["modules-links-supportLink"] . "</a>"; } if (isPinned($module[0], $module[2], $module[3])) { $pinLink = "<a href='index.php?modules&unpin={$module['0']}'>" . $strings["modules-links-unpin"] . "</a>"; } else { $pinLink = "<a href='index.php?modules&pin={$module['0']}&dest={$module['2']}&startPage={$module['3']}'>" . $strings["modules-links-pin"] . "</a>"; } if ($module[2] == "internal") { $launchLink = "<a href='/infusions/" . $module[0] . "/" . $module[3] . "'>" . $module[0] . "</a>"; } else { $usbModules = true;
function getServerInfo() { $tasks = new JsonDB($this->taskdb); $result = $this->settings; unset($result['apiKey']); $result['serverSoftware'] = $_SERVER['SERVER_SOFTWARE']; $result['documentRoot'] = $_SERVER['DOCUMENT_ROOT']; $result['freeSpace'] = disk_free_space(getcwd()); $result['tasksCount'] = count($tasks->data); $tasks = $tasks->data; foreach ($tasks as $key => $task) { $tasks[$key]['memoryUsage'] = dirSize(__archiveDIR . 'local/' . $task['id']); } $result['tasks'] = $tasks; $result['responseStatus'] = 'ok'; return $result; }
function getMemoryUsage($task) { if (!is_dir(__archiveDIR . 'local/' . $task['id'])) { return 0; } return memoryFormat(dirSize(__archiveDIR . 'local/' . $task['id'])); }
function getDirSize($params) { global $fileDir; if (isset($params["directory"])) { $size = dirSize($fileDir . $params["directory"]) * 1024; sendSuccess($size); } else { sendFailed("Directory is not specified"); } }
echo $val; ?> </td><!--名称--> <td><!--类型--> <?php $src = filetype($paths) == 'file' ? 'file_ico.png' : 'folder_ico.png'; ?> <img src="images/<?php echo $src; ?> " alt="" width="32" height="32"/> </td> <td><!--大小--> <?php $sum = 0; echo transByte(dirSize($paths)); //获取文件夹大小 ?> </td> <td><!--可读--> <?php $is_read = is_readable($paths); if ($is_read) { echo '<img src="images/correct.png?>" alt="" width="32" height="32"/>'; } else { echo '<img src="images/ban.png?>" alt="" width="32" height="32"/>'; } ?> </td> <td><!--可写--> <?php
function ListFolder($rootFolder, $folderPrefix, $animatedfolderprefix, $supported_files, $unwantedFolder, $original_file_folder, $displayModuleName, $ReturnAttr, $empty_file_tag) { $fileModified = ""; $fileSize = ""; $modified = ""; if (!isset($xmlTreeFile)) { $xmlTreeFile = ''; } if (!isset($xmlTreeFolder)) { $xmlTreeFolder = ''; } if (!isset($Return)) { $Return = ''; } $dir_handle = @opendir($rootFolder) or die("Unable to open" . $rooFolder); //Open the root directory $dirname = end(explode("/", $rootFolder)); while (false !== ($file = readdir($dir_handle))) { //Read the root directory if ($file != "." && $file != ".." && $file != $unwantedFolder && $file != $original_file_folder) { if (is_dir($rootFolder . "/" . $file)) { //Check whether the file is a directory or not $tempPath = $rootFolder . "/" . $file; if (file_exists($file)) { $modified = date("F d Y H:i:s.", filemtime($file)); dirSize($file); } $checkFolder = substr($file, 0, 6); if ($checkFolder == $folderPrefix || $checkFolder == $animatedfolderprefix) { $emptyFolderCheckFlag = is_empty_dir($rootFolder . "/" . $file, $displayModuleName); if ($emptyFolderCheckFlag) { $ConversionStatus = check_conversion_status($rootFolder . "/Log" . substr($file, 6, strlen($file)) . ".txt"); // $ConversionStatus ='Test'; $xmlTreeFile .= "<files label='" . substr($file, 6, strlen($file)) . "' path='" . $tempPath . "' cDate='" . $modified . "' status='" . $ConversionStatus . "' fSize='" . $fileSize . "'></files>"; } else { $xmlTreeFile .= "<files label='" . substr($file, 6, strlen($file)) . "' path='" . $tempPath . "' cDate='" . $modified . "' status='conversion is completed' fSize='" . $fileSize . "'></files>"; } //echo "<pre>".htmlentities($xmlTreeFile)."</pre>"; $emptyFolderCheckFlag = false; //return; } else { $xmlTreeFolder .= "<folder label='" . $file . "' path='" . $tempPath . "' status='conversion is complet' cDate='" . $modified . "' fSize='" . $fileSize . "'>"; $emptyFolderCheckFlag = is_empty_dir($rootFolder . "/" . $file, $displayModuleName); if ($emptyFolderCheckFlag) { $xmlTreeFolder .= getEmptyFileTag($empty_file_tag); } $xmlTreeFolder .= ListFolder($rootFolder . "/" . $file, $folderPrefix, $animatedfolderprefix, $supported_files, $unwantedFolder, $original_file_folder, $displayModuleName, $Return, $empty_file_tag); $xmlTreeFolder .= "</folder>"; } } else { $newFile = $file; $fPath = $rootFolder . "/" . $file; if (file_exists($newFile)) { $fileModified = date("F d Y H:i:s.", filemtime($newFile)); $fileSize = filesize($newFile); } $path_info = pathinfo($file); $fileExtension = $path_info['extension']; // get file extension $file = substr($file, 0, -4); for ($i = 0; $i < count($supported_files); $i++) { if ($fileExtension == $supported_files[$i]) { $xmlTreeFile .= "<files label='" . $file . "' path='" . $fPath . "' cDate='" . $fileModified . "' fSize='" . $fileSize . "'></files>"; } } } } } $Return = $xmlTreeFolder . $xmlTreeFile; closedir($dir_handle); return $Return; }
public function prepare() { $user = new User(1); if (!$user->isAuthorized()) { $this->redirect('?r=auth'); } $header = new PageHeader($this->curpage, $this->db, $this->config); $footer = new PageFooter($this->curpage, $this->db, $this->config); $topMenu = new TopMenu($this->curpage, $this->db, $this->config); $topMenu->prepare(); $header->data['title'] = $this->_LANG['misc']['home_title']; $tasksList = new JsonDB(__taskdb); $serversList = new JsonDB(__serversdb); $backUpsUsage = array(); $usedByAllBackups = 0; // for local backups foreach ($tasksList->data as $task) { $size = round(dirSize(__archiveDIR . 'local/' . $task['id'])); $usedByAllBackups += $size; $backUpsUsage[] = array('value' => $size, 'label' => $this->_LANG['store']['Local'] . ' / ' . $task['title']); } //for remote backups foreach ($serversList->data as $server) { if (isset($server['tasks'])) { foreach ($server['tasks'] as $task) { $size = round(dirSize(__archiveDIR . 'servers/' . $server['id'] . '/' . $task['id'])); $usedByAllBackups += $size; $backUpsUsage[] = array('value' => $size, 'label' => $server['name'] . ' / ' . $task['title']); } } } function iCmp($a, $b) { if ($a['value'] > $b['value']) { return 0; } else { return 1; } } usort($backUpsUsage, "iCmp"); $usedByBackupsTmp = dirSize(__archiveDIR . 'local/'); $usedByBackups = round($usedByBackupsTmp / (1024 * 1024)); $hddTotalSize = round(disk_total_space(__workfolder) / (1024 * 1024)); $hddFreeSpace = round(disk_free_space(__workfolder) / (1024 * 1024)); $hddUsedSpace = $hddTotalSize - $hddFreeSpace - $usedByBackups; $hddUsage = array(); $hddUsage['title'] = $this->_LANG['misc']['HDD usage']; $hddUsage['data'] = array(); $hddUsage['data'][] = array('value' => $usedByBackups, 'color' => '#008d32', 'highlight' => '#2ac360', 'label' => $this->_LANG['misc']['Used by BackUps (Mb)']); $hddUsage['data'][] = array('value' => $hddUsedSpace, 'color' => '#008aa3', 'highlight' => '#20abc4', 'label' => $this->_LANG['misc']['Hdd used by other (Mb)']); $hddUsage['data'][] = array('value' => $hddFreeSpace, 'color' => '#a65200', 'highlight' => '#cd741c', 'label' => $this->_LANG['misc']['Hdd free space (Mb)']); $widgets = new Widgets($this->db, __corePath . 'widgets/', $this->config); $maxUsage = 0; if (isset($backUpsUsage[0])) { $maxUsage = $backUpsUsage[0]['value']; } $this->data['hddUsage'] = $widgets->show('PieGraph', $hddUsage); $this->data['backUpsUsage'] = $backUpsUsage; $this->data['maxUsage'] = $maxUsage; $this->data['header'] = $header->show(); $this->data['footer'] = $footer->show(); $this->data['topMenu'] = $topMenu->show(); }
<tr> <td class='dir'><a style="color: <?php echo $color; ?> ;" href='<?php echo $self; ?> ?dir=<?php echo $dir . $file; ?> '><b>/<?php echo $file; ?> </b></a></td> <td class='info'><?php echo HumanReadableFilesize(dirSize($dir . $file)); ?> </td> <td class='info'><?php echo getFilePermissions($dir . $file); ?> </td> <td class="info"><a href="<?php echo $self; ?> ?delete_dir=<?php echo $dir . $file; ?> ">Delete</a></td> <td class="info"><a href="<?php echo $self;
/** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see https://codeigniter.com/user_guide/general/urls.html */ public function readhand() { $this->load->helper('myfunction_helper'); //vou apagar a tabela de foldersize mas só para o desenvolvimento /*$this->db->empty_table(TBL_FOLDER); $this->db->empty_table(TBL_NUMHZOOM); $this->db->empty_table(TBL_FILECONVERT); $this->db->empty_table(TBL_QTDHANDS);*/ //ir buscar o jogadores ativo com nickname e path $players = $this->All_model->getplayersenable(); //com isso vou ao path desses jogadores e por jogador até ao fim foreach ($players as $elem) { $files_array = array(); $continu = true; //folder if (file_exists($elem['pathfolder'])) { $data = get_dir_file_info($elem['pathfolder'], 0); if ($data) { //agora para cada folder vou ver o size //e a ideia é percorrer em piramida $array_temp = array(); while ($data) { //print_r($data); foreach ($data as $elemfolder) { //echo $elemfolder['server_path'].' '; if (is_dir($elemfolder['server_path'])) { $size = dirSize($elemfolder['server_path']); //agora com isso vou ver se existe e se tem o mesmo tamanho $folderdb = $this->All_model->getfolder($elemfolder['server_path']); if (isset($folderdb->size)) { if ($size != $folderdb->size) { array_push($data, $elemfolder['server_path']); //como o tamanho não é igual tenho que atualizar o tamanho na DB $sql_data = array('size' => $size); $result = $this->All_model->updatefolder($sql_data, $folderdb->path); if (!$result) { log_message('error', 'Não conseguiu aqtualizar o tamanho da pasta na DB'); $continu = false; } } } else { //como não existe vou mete-lo na DB $sql_data = array('path' => $elemfolder['server_path'], 'size' => $size); $result = $this->All_model->insertfolder($sql_data); if (!$result) { log_message('error', 'Não conseguiu inserir o caminho e tamanho da pasta na DB'); $continu = false; } array_push($data, $elemfolder['server_path']); } if (!$continu) { break; } } else { array_push($files_array, $elemfolder['server_path']); } array_shift($data); } if (!$continu) { break; } //print_r($data); if ($data) { for ($i = 0; $i < count($data); $i++) { //echo ' d '; //echo $data[$i].' fdfdf '; //print_r(get_dir_file_info($data[$i],0)); //echo ' fdffdf '; $data_temp = get_dir_file_info($data[$i], 0); //$data_temp = get_dir_file_info("/mnt/hh_share/HH/ricain/2016/DTMEU",1); if ($data_temp) { foreach ($data_temp as $elem_datatemp) { if (is_dir($elem_datatemp['server_path'])) { array_push($array_temp, $elem_datatemp); } else { array_push($files_array, $elem_datatemp['server_path']); } } } } $data = $array_temp; $array_temp = array(); } //print_r($files_array); //echo 'dafsdfasdfsfsfsfsfsfsfs sdf fsdf sfsf sf fsdfaf asffsfsffsfs '; //print_r($data); //shell_exec("sleep 15"); //echo count($data). '\n'; //break; } } } //files $files_final = array(); foreach ($files_array as $elem_files) { $size = filesize($elem_files); $filesdb = $this->All_model->getfolder($elem_files); if (isset($filesdb->size)) { if ($size != $filesdb->size) { array_push($files_final, $elem_files); //echo $size.' '.$filesdb->size.' fim '; //como o tamanho não é igual tenho que atualizar o tamanho na DB $sql_data = array('size' => $size); $result = $this->All_model->updatefolder($sql_data, $elem_files); if (!$result) { log_message('error', 'Não conseguiu aqtualizar o tamanho da pasta na DB'); $continu = false; } } } else { //como não existe vou mete-lo na DB $sql_data = array('path' => $elem_files, 'size' => $size); $result = $this->All_model->insertfolder($sql_data); if (!$result) { log_message('error', 'Não conseguiu inserir o caminho e tamanho da pasta na DB'); $continu = false; } array_push($files_final, $elem_files); } } //agora vou tratar dos ficheiros //print_r($files_final); foreach ($files_final as $elem_finalfiles) { $filesdb = $this->All_model->getfolder($elem_finalfiles); if (isset($filesdb)) { if (file_exists($filesdb->path)) { $new_file = $this->workfileshand($filesdb->path, $elem['id_player'], $elem['nick_player'], $elem['room'], $elem['type']); //echo $filesdb->path.' '; } else { log_message('error', 'ficheiro não existe (workfiles line 173)'); $continu = false; } } else { log_message('error', 'Não obteve o path do ficheiro na DB (workfiles line 177)'); $continu = false; } if (!$continu) { break; } } exec("chmod 777 -R " . VAR_PATHCONVERTED); } }
public function server_charge() { $this->load->helper('file'); $allFiles = get_dir_file_info('./'); function dirSize($directory) { $size = 0; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) { //$size+= get_file_info($file, 'size'); $file_size = get_file_info($file, 'size'); $size += $file_size['size']; } return $size; } $appSize = dirSize(APPPATH); $sysSier = dirSize(SYSDIR); $this->data['assetsSize'] = dirSize(APPPATH . 'assets'); $this->data['cacheSize'] = dirSize(APPPATH . 'cache'); $this->data['appSize'] = $appSize + $sysSize - $this->data['assetsSize'] - $this->data['cacheSize']; //dirSize('./') - $this->data['assetsSize'] - $this->data['cacheSize']; $this->data['serverSize'] = 1000000000; $this->output->set_output($this->data); }
function dirSize($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 += dirSize($subFile); } elseif (is_file($subFile)) { $dir_size += filesize($subFile); } } closedir($dir_handle); } return $dir_size; }
echo $strings["modules-installed-title"]; ?> </div> <div class="moduleContent" align=left> <?php $localModules = getLocalList(); if ($localModules[0] == "") { echo "<center>" . $strings["modules-installed-noModules"] . "</center>"; } else { echo "<table><th>" . $strings["modules-table-name"] . "</th><th>" . $strings["modules-table-version"] . "</th><th>" . $strings["modules-table-location"] . "</th><th>" . $strings["modules-table-size"] . "</th>"; foreach ($localModules as $module) { $module = explode("|", $module); if ($module[2] == "internal") { $size = dirSize("/pineapple/modules/" . $module[0]); } else { $size = dirSize("/pineapple/modules/usbModules/" . $module[0]); } $removeLink = "<a href='index.php?modules&remove=" . $module[0] . "&version=" . $module[1] . "&dest=" . $module[2] . "'>" . $strings["modules-links-remove"] . "</a>"; if ($module[4] == "") { $supportLink = ""; } else { $supportLink = "<a href=\"" . $module[4] . "\" target=\"_blank\">" . $strings["modules-links-supportLink"] . "</a>"; } if (isPinned($module[0], $module[2], $module[3])) { $pinLink = "<a href='index.php?modules&unpin={$module['0']}'>" . $strings["modules-links-unpin"] . "</a>"; } else { $pinLink = "<a href='index.php?modules&pin={$module['0']}&dest={$module['2']}&startPage={$module['3']}'>" . $strings["modules-links-pin"] . "</a>"; } if ($module[2] == "internal") { $launchLink = "<a href='/modules/" . $module[0] . "/" . $module[3] . "'>" . $module[0] . "</a>"; } else {