Example #1
0
 public function index()
 {
     $M = M();
     $tabs = $M->query('SHOW TABLE STATUS');
     $total = 0;
     foreach ($tabs as $k => $v) {
         $tabs[$k]['size'] = byteFormat($v['Data_length'] + $v['Index_length']);
         $total += $v['Data_length'] + $v['Index_length'];
     }
     //dump($tabs);
     //echo __APP__."/Public/data/";
     // echo  $this->export($tablename="");
     //  echo $this->restore("./Public/backup/20130704091642_tao_group_v1.sql");
     $this->assign("list", $tabs);
     $this->assign("total", byteFormat($tota));
     $this->assign("tables", count($tabs));
     $this->display();
 }
 public function _after_list(&$voList)
 {
     $FileUtil = new FileUtil();
     $MisFileManagerAccessDao = M("mis_file_manager_access");
     $extensionArr = C('TRANSFORM_SWF');
     $extensionIMG = C('IMG_file');
     $extensionArr = array_merge($extensionArr, $extensionIMG);
     $extensionArr[] = 'pdf';
     foreach ($voList as $key => $val) {
         $file = "MisFileManager/" . $val['filepath'];
         $voList[$key]["codeurl"] = base64_encode($file);
         if ($val["type"] != 2) {
             if ($val["type"] == 0) {
                 $voList[$key]['size'] = byteFormat(filesize(UPLOAD_PATH . $file));
                 $fileinfo = pathinfo($val['uploadname']);
                 if (in_array(strtolower($fileinfo['extension']), $extensionArr)) {
                     $voList[$key]['isplay'] = C("FILE_OFFICEONLINE");
                     //是否显示在线查看
                 }
                 $voList[$key]['ext'] = "文件";
             } else {
                 $voList[$key]['size'] = byteFormat($FileUtil->dirsize(UPLOAD_PATH . $file));
                 $voList[$key]['ext'] = "文件夹";
             }
         } else {
             if ($val["stype"] == 1) {
                 $voList[$key]['ext'] = "文章";
             }
         }
         $voList[$key]["ifread"] = $this->parentRecursionAccess($voList[$key]['id'], "ifread");
         $voList[$key]["ifprint"] = $this->parentRecursionAccess($voList[$key]['id'], "ifprint");
         $voList[$key]["ifexecute"] = $this->parentRecursionAccess($voList[$key]['id'], "ifexecute");
         //echo $ifread."__".$ifread."__".$ifread."<br>";
         //$byuserall = $MisFileManagerAccessDao->where('fid ='.$val['id'].' and userid = 0')->find();
         //$byself = $MisFileManagerAccessDao->where('fid ='.$val['id'].' and userid = '.$_SESSION[C('USER_AUTH_KEY')])->find();
         //
         //if($byuserall["ifprint"] || $byself["ifprint"] ) $voList[$key]["ifprint"] = 1;
         //if($byuserall["ifread"] || $byself["ifread"] ) $voList[$key]["ifread"] = 1;
         //if($byuserall["ifexecute"] || $byself["ifexecute"]) $voList[$key]["ifexecute"] = 1;
     }
     // print_R($voList);
 }
Example #3
0
function V($view, $data = array(), $fileCacheMin = 0)
{
    if (defined('APP_TIME_SPEND')) {
        Error('500', 'You have already loaded a view,function V can not used twice in a method !');
    }
    $view_file = VIEW_PATH . $view . '.php';
    if (is_file($view_file)) {
        is_array($data) || empty($data) || Error('500', 'param to view ' . $view_file . ' show be an array');
        empty($data) || extract($data);
        GZIP ? ob_start("ob_gzhandler") : ob_start();
        define('APP_TIME_SPEND', round(microtime(true) - APP_START_TIME, 4));
        //耗时
        define('APP_MEMORY_SPEND', byteFormat(memory_get_usage() - APP_START_MEMORY));
        require $view_file;
        if ($fileCacheMin) {
            $GLOBALS['APP']['cache']['time'] = $fileCacheMin * 60;
            $GLOBALS['APP']['cache']['file'] = true;
        }
        if (isset($GLOBALS['APP']['cache'])) {
            $expires_time = intval(time() + $GLOBALS['APP']['cache']['time']);
            if ($GLOBALS['APP']['cache']['file']) {
                $contents = ob_get_contents();
                $cache_file = APP_PATH . 'cache/' . md5(implode('-', $GLOBALS['APP']['router'])) . '.html';
                file_put_contents($cache_file, $contents);
                touch($cache_file, $expires_time);
                header("Expires: " . gmdate("D, d M Y H:i:s", $expires_time) . " GMT");
                header("Cache-Control: max-age=" . $GLOBALS['APP']['cache']['time']);
                header('Last-Modified: ' . gmdate('D, d M y H:i:s', time()) . ' GMT');
                ob_end_flush();
                flush();
            } else {
                header("Expires: " . gmdate("D, d M Y H:i:s", $expires_time) . " GMT");
                header("Cache-Control: max-age=" . $GLOBALS['APP']['cache']['time']);
                header('Last-Modified: ' . gmdate('D, d M y H:i:s', time()) . ' GMT');
                ob_end_flush();
                flush();
            }
        } else {
            ob_end_flush();
            flush();
        }
    } else {
        Error('404', 'view file ' . $view_file . ' does not exists ');
    }
}
function printTotalDiskBar($dup, $name = "", $dsu, $dts)
{
    // Using autoByteFormat() the amount of space will be formatted as GB or TB as needed.
    if ($dup < 95) {
        $progress = "progress-bar";
    } else {
        if ($dup >= 95 && $dup < 99) {
            $progress = "progress-bar progress-bar-warning";
        } else {
            $progress = "progress-bar progress-bar-danger";
        }
    }
    if ($name != "") {
        echo '<!-- ' . $name . ' -->';
    }
    echo '<div class="exolight">';
    if ($name != "") {
        echo $name . ": ";
    }
    echo number_format($dup, 0) . "%";
    echo '<div rel="tooltip" data-toggle="tooltip" data-placement="bottom" title="' . byteFormat(autoByteFormat($dsu)[0], autoByteFormat($dsu)[1], autoByteFormat($dsu)[2]) . ' free out of ' . byteFormat(autoByteFormat($dts)[0], autoByteFormat($dts)[1], autoByteFormat($dts)[2]) . '" class="progress">';
    echo '<div class="' . $progress . '" style="width: ' . $dup . '%"></div>';
    echo '</div>';
    echo '</div>';
}
Example #5
0
function printDiskBarGB($dup, $name = "", $dsu, $dts)
{
    if ($dup < 90) {
        $progress = "progress-bar";
    } else {
        if ($dup >= 90 && $dup < 95) {
            $progress = "progress-bar progress-bar-warning";
        } else {
            $progress = "progress-bar progress-bar-danger";
        }
    }
    if ($name != "") {
        echo '<!-- ' . $name . ' -->';
    }
    echo '<div class="exolight">';
    if ($name != "") {
        echo $name . ": ";
    }
    echo number_format($dup, 0) . "%";
    echo '<div rel="tooltip" data-toggle="tooltip" data-placement="bottom" title="' . byteFormat($dsu, "GB", 0) . ' / ' . byteFormat($dts, "GB", 0) . '" class="progress">';
    echo '<div class="' . $progress . '" style="width: ' . $dup . '%"></div>';
    echo '</div>';
    echo '</div>';
}
 public function repair()
 {
     $M = M("Admin");
     if (IS_POST) {
         if (empty($_POST['table']) || count($_POST['table']) == 0) {
             die(json_encode(array("status" => 0, "info" => "请选择要处理的表")));
         }
         $table = implode(',', $_POST['table']);
         if ($_POST['act'] == 'repair') {
             if ($M->query("REPAIR TABLE {$table} ")) {
                 die(json_encode(array("status" => 1, "info" => "修复表成功", 'url' => U('SysData/repair'))));
             }
         } elseif ($_POST['act'] == 'optimize') {
             if ($M->query("OPTIMIZE TABLE {$table}")) {
                 die(json_encode(array("status" => 1, "info" => "优化表成功", 'url' => U('SysData/repair'))));
             }
         }
         die(json_encode(array("status" => 0, "info" => "请选择操作")));
     } else {
         $tabs = $M->query('SHOW TABLE STATUS');
         $totalsize = array('table' => 0, 'index' => 0, 'data' => 0, 'free' => 0);
         $tables = array();
         foreach ($tabs as $k => $table) {
             $table['size'] = byteFormat($table['Data_length'] + $table['Index_length']);
             $totalsize['table'] += $table['Data_length'] + $table['Index_length'];
             $totalsize['data'] += $table['Data_length'];
             $table['Data_length'] = byteFormat($table['Data_length']);
             $totalsize['index'] += $table['Index_length'];
             $table['Index_length'] = byteFormat($table['Index_length']);
             $totalsize['free'] += $table['Data_free'];
             $table['Data_free'] = byteFormat($table['Data_free']);
             $tables[] = $table;
         }
         $this->assign("list", $tables);
         $this->assign("totalsize", $totalsize);
         $this->display();
     }
 }
/**
 * Get the memory used
 */
function memoryUsage($memName = "execution_time", $byteFormat = true)
{
    $totMem = memory_get_usage() - $GLOBALS['memoryCounter'][$memName];
    return $byteFormat ? byteFormat($totMem) : $totMem;
}
Example #8
0
echo $file;
?>
">
			<li><img class="th" style="max-width:80%; max-height:80%;" src="uploads/<?php 
echo $file;
?>
"></li>
		</a>
	</ul>
</div>
<div class="row">
	<h2> Image Information </h2>
	<div class="large-12 columns">
			<div class="panel">
				<p>Size: <?php 
echo byteFormat(filesize('uploads/' . $file), "MB");
?>
<br>Date Uploaded: <?php 
echo date("F j, Y, g:i a", filemtime('uploads/' . $file));
?>
<br>Tags Found: <?php 
echo $tagsNum;
?>
</p>
			</div>
	</div>
</div>
<div class="row">
	<h2> Raw Text Output </h2>
	<div class="large-12 columns">
			<div class="panel">
Example #9
0
 /**
  * Read backup ZIP SQL file list
  * @author linxinliang<*****@*****.**>
  * @return array
  */
 private function getZipFilesList()
 {
     $list = array();
     $size = 0;
     $handle = opendir(DatabaseBackDir . "Zip/");
     while ($file = readdir($handle)) {
         if ($file != "." && $file != "..") {
             $tem = array();
             $tem['file'] = $file;
             //  checkCharset($file);
             $_size = filesize(DatabaseBackDir . "Zip/{$file}");
             $tem['size'] = byteFormat($_size);
             $tem['time'] = date("Y-m-d H:i:s", filectime(DatabaseBackDir . "Zip/{$file}"));
             $size += $_size;
             $list[] = $tem;
         }
     }
     return array("list" => $list, "size" => byteFormat($size));
 }