Commit 595f8c47377d219d225fe226a41cf09c76fe4f9e

Authored by Marcelo Linhares Castro
1 parent db14a60b
Exists in master

Catch de erro em recuperacao de sistemas operacionais e tambem na leitura do dir…

…etorio de dados do sei. A pedido da UFC
Showing 1 changed file with 15 additions and 3 deletions   Show diff stats
rn/MdEstatisticasColetarRN.php
@@ -144,8 +144,16 @@ class MdEstatisticasColetarRN extends InfraRN @@ -144,8 +144,16 @@ class MdEstatisticasColetarRN extends InfraRN
144 $bytestotal = 0; 144 $bytestotal = 0;
145 $path = realpath($path); 145 $path = realpath($path);
146 if ($path !== false) { 146 if ($path !== false) {
147 - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object) {  
148 - $bytestotal += $object->getSize(); 147 + try{
  148 + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object) {
  149 + try{
  150 + $bytestotal += $object->getSize();
  151 + }catch(Exception $e1){
  152 + $bytestotal += 0;
  153 + }
  154 + }
  155 + }catch(Exception $e2){
  156 + $bytestotal = 0;
149 } 157 }
150 } 158 }
151 return $bytestotal; 159 return $bytestotal;
@@ -480,7 +488,11 @@ class MdEstatisticasColetarRN extends InfraRN @@ -480,7 +488,11 @@ class MdEstatisticasColetarRN extends InfraRN
480 } else { 488 } else {
481 $query = "select distinct user_agent as nome from infra_auditoria where user_agent is not null"; 489 $query = "select distinct user_agent as nome from infra_auditoria where user_agent is not null";
482 } 490 }
483 - $sistemas = BancoSEI::getInstance()->consultarSql($query); 491 + try{
  492 + $sistemas = BancoSEI::getInstance()->consultarSql($query);
  493 + } catch (Exception $e) {
  494 + $sistemas = array(array('nome'=>'(XX)'));
  495 + }
484 496
485 $lista = array(); 497 $lista = array();
486 foreach ($sistemas as $r) { 498 foreach ($sistemas as $r) {