Ok! certo..... eu certo.

Valew!!

  ----- Original Message ----- 
  From: Isaac Sampaio 
  To: [email protected] 
  Sent: Wednesday, April 07, 2010 6:49 PM
  Subject: Re: [slack-users] Relatório do Thunder Cache 3


  Olá amigo, edit o arquivo php.ini em /etc/httpd, localize essa linha:


  short_open_tag = Off


  Mude para:


  short_open_tag = On


  Salve e restart o apache.


  Abraços




  2010/4/7 Anderson Rodrigues <[email protected]>

    Alguém sabe come resolver esse problema??

    Instalei o thunder cache 3 em uma máquina com slackware 13.0. O thunder 
está funcionando direitinho com o squid porém, não consigo gerar o relatório. 
Aparece a seguinte mensagem de erro:

    Relatório do Sistema Thunder Cache 3:

    Data de geração: 
    Uso do disco: % 
    exec($sqlC); //exibe os dados cadastrados $economia_domain = 0; 
foreach($db->query("SELECT file, requested, size from thunder") as $roww) { 
$economia_domain += ($roww[2] * $roww[1]); } foreach ($db->query("SELECT 
SUM(requested) FROM thunder") as $row) { $ar = 
getDirectoryInfo("$cache_dir/$domain"); 
$porcent=round(($economia_domain/$ar['size'])*100,2) ?> Domínio Arquivos 
Tamanho Economia Hits Eficiência % 
             % 
          Total     % 


    O sqllite3 está instalado, assim como o php 5.2.10. O que pode ser a causa 
do problema?

    Abaixo é o código php da página:




<?php
/** 
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2008-2009 Thunder Cache
*
* For more information check http://thundercache.org
*
* Get relatories from system
*
* @author Joaquim Pedro (osmano807) <[email protected]>
*/ 

        error_reporting(0);
        $cache_dir = "/thunder";
        
        function disk_use($dir){
                $df = disk_free_space($dir);
                $dt = disk_total_space($dir);
                $du = $dt-$df;
                return ($du / $dt)*100;
        }

        function find_domains($finddir,$prefix=""){
           $domains = array();
           if (!file_exists("$finddir/domain.db")){
                   $dh = opendir($finddir);
                  while(($dir = readdir($dh)) !== false) {
                         if (is_dir("$finddir/$dir") && $dir != ".." && $dir != 
"." ) {
                           foreach (find_domains("$finddir/$dir","$dir/") as 
$dir2){
                                  $domains[] = preg_replace("/\/$/", "", 
$prefix.$dir2);
                           }
                         }
                  }
           } else {
                   $domains[] = $prefix;
           }
           return $domains;
        }

        function getDirectoryInfo($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) && 
strpos($file, ".db") === false)
              {
                if (is_dir ($nextpath))
                {
                  $dircount++;
                  $result = getDirectoryInfo($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;
        }

        function sizeFormat($size){
            if($size<1024)
            {
                return $size." bytes";
            }
            else if($size<(1024*1024))
            {
                $size=round($size/1024,1);
                return $size." KiB";
            }
            else if($size<(1024*1024*1024))
            {
                $size=round($size/(1024*1024),1);
                return $size." MiB";
            }
            else
            {
                $size=round($size/(1024*1024*1024),1);
                return $size." GiB";
            }

        }

        $domains = find_domains($cache_dir);
        $totaleconomy = 0;
        $totalhits = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">     
<head>
                <title>Relatorio Thunder Cache</title>
        <style type="text/css">
                <!--
                table {
                        border: 1px solid #333333;
                        border-collapse:collapse;
                        height:20px;
                        text-align:center;
                        text-transform: none;
                }

                td {
                        padding-right: 30px;
                        padding-left: 30px;
                        height:20px;    
                }

                tr {
                        font-family: Verdana, Arial, Helvetica, sans-serif;
                        font-size: 12px;
                        text-decoration: none;  
                        height:25px;    
                }

                .cabecalho {
                        font-family: Verdana, Arial, Helvetica, sans-serif;
                        font-size: 12px;
                        font-weight: bold;
                        text-transform: uppercase;
                        color: #FFFFFF;
                        text-decoration: none;
                        height:25px;
                        background-color: #666666;
                }
                body {
                        font-family: Verdana, Arial, Helvetica, sans-serif;
                        font-size: 12px;
                        font-weight: bold;
                        text-transform: uppercase;
                        text-align:center;      
                }
                -->
        </style>
        </head>
        <body>
        <div align="center"><font color="#0C70EE"><strong>Relat&oacute;rio do 
Sistema Thunder Cache 3:</strong><br />
        </font><br />
        <strong>Data de gera&ccedil;&atilde;o: <?= date(DATE_RFC822) ?>
        <br>
        Uso do disco: <?= round(disk_use($cache_dir),2) ?> %
        </strong></div>
        <table border="1" align="center">
         <tr class="cabecalho">
           
<td><strong>Dom&iacute;nio</strong></td><td><strong>Arquivos</strong></td><td><strong>Tamanho</strong></td><td><strong>Economia</strong></td><td><strong>Hits</strong></td>
           <td><strong>Efici&ecirc;ncia %</strong></td></tr>
        <?
foreach($domains as $domain) {
        //caso a base de dados não exista, ele tenta criar
        if ($db = new PDO("sqlite:$cache_dir/$domain/domain.db")) {

        //cria a tabela se não existe
        $sqlC ="CREATE TABLE IF NOT EXISTS thunder ('file' varchar(255) primary 
key, 'size' int(10), 'modified' datetime, 'requested' int(10), 'last_request' 
datetime);";
        $db->exec($sqlC);
        
        //exibe os dados cadastrados
        $economia_domain = 0;
        foreach($db->query("SELECT file, requested, size from thunder") as 
$roww) {
                $economia_domain += ($roww[2] * $roww[1]);
        }
        foreach ($db->query("SELECT SUM(requested) FROM thunder") as $row) { 
                $ar = getDirectoryInfo("$cache_dir/$domain"); 
                $porcent=round(($economia_domain/$ar['size'])*100,2)
?>
                <tr><td height="18"><font color="#20A253"><?= $domain 
?></font></td>
                <td height="18"><font color="#20A253"><?=  $ar['count'] 
?></font></td>
                <td height="18"><font color="#20A253"><?= 
sizeFormat($ar['size']) ?></font></td>
                <td height="18"><font color="#20A253"><?= 
sizeFormat("$economia_domain") ?></font></td>
                <td height="18"><font color="#20A253"><?= 
$row['SUM(requested)'] ?></font></td>
                <td height="18"><font color="#20A253"><?= $porcent ?> 
%</td></tr>
                <?
                $totaleconomy += $economia_domain;
                $totalhits += $row['SUM(requested)'];
        
                }
        }
}
?> 
<?php
$ar_root = getDirectoryInfo("$cache_dir");
?>
  <tr><td height="22"><b><font color="#0C70EE">Total</font></b></td>
        <td height="22"><b><font color="#0C70EE"><?= $ar_root['count'] 
?></font></b></td>
        <td height="22"><b><font color="#0C70EE"><?= 
sizeFormat($ar_root['size']) ?></font></b></td>
        <td height="22"><b><font color="#0C70EE"><?= sizeFormat($totaleconomy) 
?></font></b></td>
        <td height="22"><b><font color="#0C70EE"><?= $totalhits 
?></font></b></td>
        <td height="22"><b><font color="#0C70EE"><?= 
round(($totaleconomy/$ar_root['size'])*100,3) ?> %</font></b></td></tr>
 </table>
</body>
</html>


    -- 
    GUS-BR - Grupo de Usuários de Slackware Brasil
    http://www.slackwarebrasil.org/
    http://groups.google.com/group/slack-users-br
     
    Antes de perguntar:
    http://www.istf.com.br/perguntas/
     
    Para sair da lista envie um e-mail para:
    [email protected]



  -- 
  GUS-BR - Grupo de Usuários de Slackware Brasil
  http://www.slackwarebrasil.org/
  http://groups.google.com/group/slack-users-br
   
  Antes de perguntar:
  http://www.istf.com.br/perguntas/
   
  Para sair da lista envie um e-mail para:
  [email protected]

-- 
GUS-BR - Grupo de Usuários de Slackware Brasil
http://www.slackwarebrasil.org/
http://groups.google.com/group/slack-users-br

Antes de perguntar:
http://www.istf.com.br/perguntas/

Para sair da lista envie um e-mail para:
[email protected]

To unsubscribe, reply using "remove me" as the subject.

Responder a