Commit d6010a29f8492019e148e496ef675c62614723f5

Authored by Starlone Passos
1 parent 655b36ce

Enviando sistemasOperacionais por servico separado

rn/MdEstatisticasAgendamentoRN.php
... ... @@ -35,6 +35,9 @@ class MdEstatisticasAgendamentoRN extends InfraRN {
35 35  
36 36 $velocidades = $coletor->obterVelocidadePorCidade();
37 37 $enviar->enviarVelocidades($velocidades, $id);
  38 +
  39 + $sistemasOperacionaisUsuarios = $coletor->obterSistemasOperacionaisUsuarios();
  40 + $enviar->enviarSistemasUsuarios($sistemasOperacionaisUsuarios, $id);
38 41  
39 42 LogSEI::getInstance()->gravar(InfraDebug::getInstance()->getStrDebug(),InfraLog::$INFORMACAO);
40 43  
... ...
rn/MdEstatisticasColetarRN.php
... ... @@ -47,7 +47,6 @@ class MdEstatisticasColetarRN extends InfraRN {
47 47 $ind['modulos'] = $this->obterPlugins();
48 48 $ind['extensoes'] = $this->obterQuantidadeDocumentosExternosPorExtensao();
49 49 $ind['anexosTamanhos'] = $this->obterTamanhoDocumentosExternos();
50   - $ind['sistemasOperacionaisUsuarios'] = $this->obterSistemasOperacionaisUsuarios();
51 50 $ind['navegadores'] = $this->obterNavegadores();
52 51  
53 52 InfraDebug::getInstance()->gravar('Ind: ' . json_encode($ind), InfraLog::$INFORMACAO);
... ... @@ -164,6 +163,9 @@ class MdEstatisticasColetarRN extends InfraRN {
164 163 private function obterNavegadores(){
165 164 $query = "select count(*) as quantidade, identificacao as nome, versao from infra_navegador group by identificacao,versao";
166 165 $rs = BancoSEI::getInstance()->consultarSql($query);
  166 + foreach ($rs as $r) {
  167 + $r['nome'] = utf8_encode($r['nome']);
  168 + }
167 169  
168 170 InfraDebug::getInstance()->gravar('SEI13 - Quantidade de Navegadores: ' . json_encode($rs), InfraLog::$INFORMACAO);
169 171 return $rs;
... ... @@ -362,37 +364,6 @@ class MdEstatisticasColetarRN extends InfraRN {
362 364 return $resultado;
363 365 }
364 366  
365   - private function obterSistemasOperacionaisUsuarios(){
366   - $sgbd = $this->obterTipoSGBD();
367   - if ($sgbd == 'Oracle') {
368   - $query = "select distinct to_char(user_agent) as nome from infra_auditoria where user_agent is not null";
369   - } else {
370   - $query = "select distinct user_agent as nome from infra_auditoria where user_agent is not null";
371   - }
372   - $sistemas = BancoSEI::getInstance()->consultarSql($query);
373   -
374   - $lista = array();
375   - foreach($sistemas as $r) {
376   - $texto = $r['nome'];
377   - $inicio = strpos($texto, '(');
378   - if ($inicio !== false) {
379   - $fim = strpos($texto, ')', $inicio);
380   - $nome = substr($texto, $inicio + 1, $fim - $inicio -1);
381   - array_push($lista, $nome);
382   - }
383   - }
384   - $lista = array_unique($lista);
385   -
386   - $sistemas = array();
387   - foreach($lista as $n) {
388   - $result = array('nome'=>$n);
389   - array_push($sistemas, $result);
390   - }
391   -
392   - InfraDebug::getInstance()->gravar('SEI26 - Sistemas Operacionais dos Clientes: ' . json_encode($sistemas), InfraLog::$INFORMACAO);
393   - return $sistemas;
394   - }
395   -
396 367 private function obterUsoMemoria(){
397 368 $memoria = memory_get_usage();
398 369 InfraDebug::getInstance()->gravar('SEI18 - Quantidade de byte de uso de memoria: ' . json_encode($memoria), InfraLog::$INFORMACAO);
... ... @@ -475,6 +446,37 @@ class MdEstatisticasColetarRN extends InfraRN {
475 446 InfraDebug::getInstance()->gravar('SEI27 - Quantidade de acessos por dia: ' . json_encode($rs), InfraLog::$INFORMACAO);
476 447 return $rs;
477 448 }
  449 +
  450 + public function obterSistemasOperacionaisUsuarios(){
  451 + $sgbd = $this->obterTipoSGBD();
  452 + if ($sgbd == 'Oracle') {
  453 + $query = "select distinct to_char(user_agent) as nome from infra_auditoria where user_agent is not null";
  454 + } else {
  455 + $query = "select distinct user_agent as nome from infra_auditoria where user_agent is not null";
  456 + }
  457 + $sistemas = BancoSEI::getInstance()->consultarSql($query);
  458 +
  459 + $lista = array();
  460 + foreach($sistemas as $r) {
  461 + $texto = $r['nome'];
  462 + $inicio = strpos($texto, '(');
  463 + if ($inicio !== false) {
  464 + $fim = strpos($texto, ')', $inicio);
  465 + $nome = substr($texto, $inicio + 1, $fim - $inicio -1);
  466 + array_push($lista, $nome);
  467 + }
  468 + }
  469 + $lista = array_unique($lista);
  470 +
  471 + $sistemas = array();
  472 + foreach($lista as $n) {
  473 + $result = array('nome'=>$n);
  474 + array_push($sistemas, $result);
  475 + }
  476 +
  477 + InfraDebug::getInstance()->gravar('SEI26 - Sistemas Operacionais dos Clientes: ' . json_encode($sistemas), InfraLog::$INFORMACAO);
  478 + return $sistemas;
  479 + }
478 480  
479 481 }
480 482 ?>
... ...
rn/MdEstatisticasEnviarRN.php
... ... @@ -46,6 +46,17 @@ class MdEstatisticasEnviarRN extends InfraRN {
46 46 InfraDebug::getInstance()->gravar('URL: ' . json_encode($obj), InfraLog::$INFORMACAO);
47 47 return $this->doPost($url, $obj, false);
48 48 }
  49 +
  50 + public function enviarSistemasUsuarios($sistemasOperacionaisUsuarios, $id) {
  51 + $url = $this->url . '/sistemasoperacionais';
  52 + InfraDebug::getInstance()->gravar('URL: ' . $url, InfraLog::$INFORMACAO);
  53 + $obj = array(
  54 + id => $id,
  55 + sistemasOperacionaisUsuarios => $sistemasOperacionaisUsuarios
  56 + );
  57 + InfraDebug::getInstance()->gravar('URL: ' . json_encode($obj), InfraLog::$INFORMACAO);
  58 + return $this->doPost($url, $obj, false);
  59 + }
49 60  
50 61 private function doPost($url, $json, $isjson=true) {
51 62 $data = json_encode($json);
... ...