Commit 7e90e88ceb3156c3300f019ea00dab77b61dac8a

Authored by Starlone Passos
1 parent 80baefff
Exists in master

removendo das querys referencia ao schema para seja dinamico

Showing 1 changed file with 12 additions and 14 deletions   Show diff stats
rn/MdEstatisticasColetarRN.php
@@ -47,7 +47,6 @@ class MdEstatisticasColetarRN extends InfraRN @@ -47,7 +47,6 @@ class MdEstatisticasColetarRN extends InfraRN
47 $ind['modulos'] = $this->obterPlugins(); 47 $ind['modulos'] = $this->obterPlugins();
48 $ind['extensoes'] = $this->obterQuantidadeDocumentosExternosPorExtensao(); 48 $ind['extensoes'] = $this->obterQuantidadeDocumentosExternosPorExtensao();
49 $ind['anexosTamanhos'] = $this->obterTamanhoDocumentosExternos(); 49 $ind['anexosTamanhos'] = $this->obterTamanhoDocumentosExternos();
50 - $ind['filesHashs'] = $this->obterHashs();  
51 50
52 return $ind; 51 return $ind;
53 } catch (Exception $e) { 52 } catch (Exception $e) {
@@ -113,7 +112,7 @@ class MdEstatisticasColetarRN extends InfraRN @@ -113,7 +112,7 @@ class MdEstatisticasColetarRN extends InfraRN
113 break; 112 break;
114 } 113 }
115 } 114 }
116 - 115 +
117 //vamos retirar a parte inicial do dir que nao interessa 116 //vamos retirar a parte inicial do dir que nao interessa
118 $novo_valor = $value; 117 $novo_valor = $value;
119 $pos=MdEstatisticasColetarRN::bolArrFindItem(array('infra/infra', 'sei/', 'sip/'), $novo_valor); 118 $pos=MdEstatisticasColetarRN::bolArrFindItem(array('infra/infra', 'sei/', 'sip/'), $novo_valor);
@@ -121,10 +120,10 @@ class MdEstatisticasColetarRN extends InfraRN @@ -121,10 +120,10 @@ class MdEstatisticasColetarRN extends InfraRN
121 $novo_valor = substr($novo_valor, $pos); 120 $novo_valor = substr($novo_valor, $pos);
122 } 121 }
123 122
124 - $b[] = array('file' => $novo_valor,  
125 - 'hash' => hash_file('sha256', $value),  
126 - 'modulo' => $m,  
127 - 'versaoModulo' => $version, 123 + $b[] = array('file' => $novo_valor,
  124 + 'hash' => hash_file('sha256', $value),
  125 + 'modulo' => $m,
  126 + 'versaoModulo' => $version,
128 'versaoSei' => SEI_VERSAO); 127 'versaoSei' => SEI_VERSAO);
129 } 128 }
130 129
@@ -508,12 +507,11 @@ class MdEstatisticasColetarRN extends InfraRN @@ -508,12 +507,11 @@ class MdEstatisticasColetarRN extends InfraRN
508 $sgbd = $this->obterTipoSGBD(); 507 $sgbd = $this->obterTipoSGBD();
509 $query = ''; 508 $query = '';
510 if ($sgbd == 'MySql') { 509 if ($sgbd == 'MySql') {
511 - $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, identificacao as nome, versao, count(*) as quantidade from sei.infra_navegador where date(dth_acesso) > '%s' and date(dth_acesso) < '%s' group by 1, 2, 3, 4 order by 1,2,3,4"; 510 + $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, identificacao as nome, versao, count(*) as quantidade from infra_navegador where date(dth_acesso) > '%s' and date(dth_acesso) < '%s' group by 1, 2, 3, 4 order by 1,2,3,4";
512 } elseif ($sgbd == 'SqlServer') { 511 } elseif ($sgbd == 'SqlServer') {
513 $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, identificacao as nome, versao, count(*) as quantidade from infra_navegador where dth_acesso > '%s' and dth_acesso < '%s' group by year(dth_acesso), month(dth_acesso), identificacao, versao order by 1,2,3,4"; 512 $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, identificacao as nome, versao, count(*) as quantidade from infra_navegador where dth_acesso > '%s' and dth_acesso < '%s' group by year(dth_acesso), month(dth_acesso), identificacao, versao order by 1,2,3,4";
514 } elseif ($sgbd == 'Oracle'){ 513 } elseif ($sgbd == 'Oracle'){
515 - $query = "SELECT to_char(dth_acesso, 'YYYY') AS ano, to_char(dth_acesso, 'MM') AS mes, identificacao as nome, versao, count(*) as quantidade from sei.infra_navegador WHERE dth_acesso > date '%s' AND dth_acesso < date '%s' group by to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), identificacao, versao order by to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), identificacao, versao";  
516 - // $query = "SELECT to_char(dth_acesso, 'YYYY') AS ano, to_char(dth_acesso, 'MM') AS mes, recurso, count(*) as quantidade FROM sei.infra_auditoria WHERE dth_acesso > date '%s' AND dth_acesso < date '%s' GROUP BY to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), recurso"; 514 + $query = "SELECT to_char(dth_acesso, 'YYYY') AS ano, to_char(dth_acesso, 'MM') AS mes, identificacao as nome, versao, count(*) as quantidade from infra_navegador WHERE dth_acesso > date '%s' AND dth_acesso < date '%s' group by to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), identificacao, versao order by to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), identificacao, versao";
517 } 515 }
518 $lista = array(); 516 $lista = array();
519 if ($query) { 517 if ($query) {
@@ -542,11 +540,11 @@ class MdEstatisticasColetarRN extends InfraRN @@ -542,11 +540,11 @@ class MdEstatisticasColetarRN extends InfraRN
542 $current_month = date("Y-m-01"); 540 $current_month = date("Y-m-01");
543 $sgbd = $this->obterTipoSGBD(); 541 $sgbd = $this->obterTipoSGBD();
544 if ($sgbd == 'MySql') { 542 if ($sgbd == 'MySql') {
545 - $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, recurso, count(*) as quantidade FROM sei.infra_auditoria where date(dth_acesso) > '%s' and date(dth_acesso) < '%s' group by 1, 2, 3 order by 1, 2, 3"; 543 + $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, recurso, count(*) as quantidade FROM infra_auditoria where date(dth_acesso) > '%s' and date(dth_acesso) < '%s' group by 1, 2, 3 order by 1, 2, 3";
546 } elseif ($sgbd == 'SqlServer') { 544 } elseif ($sgbd == 'SqlServer') {
547 $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, recurso, count(*) as quantidade FROM infra_auditoria where dth_acesso > '%s' and dth_acesso < '%s' group by year(dth_acesso), month(dth_acesso), recurso order by 1, 2, 3"; 545 $query = "SELECT year(dth_acesso) as ano, month(dth_acesso) as mes, recurso, count(*) as quantidade FROM infra_auditoria where dth_acesso > '%s' and dth_acesso < '%s' group by year(dth_acesso), month(dth_acesso), recurso order by 1, 2, 3";
548 } elseif ($sgbd == 'Oracle'){ 546 } elseif ($sgbd == 'Oracle'){
549 - $query = "SELECT to_char(dth_acesso, 'YYYY') AS ano, to_char(dth_acesso, 'MM') AS mes, recurso, count(*) as quantidade FROM sei.infra_auditoria WHERE dth_acesso > date '%s' AND dth_acesso < date '%s' GROUP BY to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), recurso"; 547 + $query = "SELECT to_char(dth_acesso, 'YYYY') AS ano, to_char(dth_acesso, 'MM') AS mes, recurso, count(*) as quantidade FROM infra_auditoria WHERE dth_acesso > date '%s' AND dth_acesso < date '%s' GROUP BY to_char(dth_acesso, 'YYYY'), to_char(dth_acesso, 'MM'), recurso";
550 } 548 }
551 if ($query) { 549 if ($query) {
552 $query = sprintf($query, $dataultimorecurso, $current_month); 550 $query = sprintf($query, $dataultimorecurso, $current_month);
@@ -557,15 +555,15 @@ class MdEstatisticasColetarRN extends InfraRN @@ -557,15 +555,15 @@ class MdEstatisticasColetarRN extends InfraRN
557 public function obterQuantidadeLogErro() { 555 public function obterQuantidadeLogErro() {
558 $sgbd = $this->obterTipoSGBD(); 556 $sgbd = $this->obterTipoSGBD();
559 if ($sgbd == 'MySql') { 557 if ($sgbd == 'MySql') {
560 - $query = "select year(dth_log) ano, month(dth_log) mes, week(dth_log) + 1 semana, count(*) as quantidade from sei.infra_log where sta_tipo = 'E' group by 1, 2, 3"; 558 + $query = "select year(dth_log) ano, month(dth_log) mes, week(dth_log) + 1 semana, count(*) as quantidade from infra_log where sta_tipo = 'E' group by 1, 2, 3";
561 } elseif ($sgbd == 'SqlServer') { 559 } elseif ($sgbd == 'SqlServer') {
562 $query = "select year(dth_log) ano, month(dth_log) mes, datepart(week, dth_log) semana, count(*) as quantidade from infra_log where sta_tipo = 'E' group by year(dth_log), month(dth_log), datepart(week, dth_log)"; 560 $query = "select year(dth_log) ano, month(dth_log) mes, datepart(week, dth_log) semana, count(*) as quantidade from infra_log where sta_tipo = 'E' group by year(dth_log), month(dth_log), datepart(week, dth_log)";
563 } elseif ($sgbd == 'Oracle'){ 561 } elseif ($sgbd == 'Oracle'){
564 - $query = "select to_char(dth_log, 'YYYY') AS ano, to_char(dth_log, 'MM') AS mes, to_char(dth_log, 'WW') AS semana, count(*) as quantidade from sei.infra_log where sta_tipo = 'E' GROUP BY to_char(dth_log, 'YYYY'), to_char(dth_log, 'MM'), to_char(dth_log, 'WW')"; 562 + $query = "select to_char(dth_log, 'YYYY') AS ano, to_char(dth_log, 'MM') AS mes, to_char(dth_log, 'WW') AS semana, count(*) as quantidade from infra_log where sta_tipo = 'E' GROUP BY to_char(dth_log, 'YYYY'), to_char(dth_log, 'MM'), to_char(dth_log, 'WW')";
565 } 563 }
566 if ($query) { 564 if ($query) {
567 return BancoSEI::getInstance()->consultarSql($query); 565 return BancoSEI::getInstance()->consultarSql($query);
568 } 566 }
569 } 567 }
570 } 568 }
571 -?>  
572 \ No newline at end of file 569 \ No newline at end of file
  570 +?>