Commit b3f758614fb95f530f4a50259d71c1bc79c4113e
1 parent
5c827e07
Exists in
master
Atualizando coleta e implementando envio dos hashs dos arquivos do SEI
Showing
3 changed files
with
25 additions
and
11 deletions
Show diff stats
rn/MdEstatisticasAgendamentoRN.php
... | ... | @@ -75,6 +75,12 @@ class MdEstatisticasAgendamentoRN extends InfraRN |
75 | 75 | $recursos = $coletor->obterQuantidadeRecursos($dataultimorecurso); |
76 | 76 | $this->gravarLog('Coletado. Enviar: '); |
77 | 77 | $enviar->enviarRecursos($recursos, $id); |
78 | + | |
79 | + $this->gravarLog('Enviado. Coletar o hash dos arquivos do SEI: '); | |
80 | + $filesHash = $coletor->obterHashs(); | |
81 | + $this->gravarLog('Coletado. Enviar: '); | |
82 | + $enviar->enviarHashs($filesHash, $id); | |
83 | + | |
78 | 84 | $this->gravarLog('Enviado: '); |
79 | 85 | |
80 | 86 | $this->gravarLog('Finalizado'); | ... | ... |
rn/MdEstatisticasColetarRN.php
... | ... | @@ -47,13 +47,12 @@ class MdEstatisticasColetarRN extends InfraRN |
47 | 47 | $ind['modulos'] = $this->obterPlugins(); |
48 | 48 | $ind['extensoes'] = $this->obterQuantidadeDocumentosExternosPorExtensao(); |
49 | 49 | $ind['anexosTamanhos'] = $this->obterTamanhoDocumentosExternos(); |
50 | - $ind['filehashIndicador'] = $this->obterHashs(); | |
51 | 50 | return $ind; |
52 | 51 | } catch (Exception $e) { |
53 | 52 | InfraDebug::getInstance()->setBolLigado(false); |
54 | 53 | InfraDebug::getInstance()->setBolDebugInfra(false); |
55 | 54 | InfraDebug::getInstance()->setBolEcho(false); |
56 | - throw new InfraException('Erro processando estatísticas do sistema.', $e); | |
55 | + throw new InfraException('Erro processando estatÃsticas do sistema.', $e); | |
57 | 56 | } |
58 | 57 | } |
59 | 58 | |
... | ... | @@ -68,7 +67,7 @@ class MdEstatisticasColetarRN extends InfraRN |
68 | 67 | |
69 | 68 | private $IG = array('sei/temp', 'sei/config/ConfiguracaoSEI.php', 'sei/config/ConfiguracaoSEI.exemplo.php'); |
70 | 69 | |
71 | - private static function getDirContents($dir, &$results = array(), $ignorar = array('sei/temp', 'sei/config/ConfiguracaoSEI.php', 'sei/config/ConfiguracaoSEI.exemplo.php')){ | |
70 | + private static function getDirContents($dir, &$results = array(), $ignorar = array('sei/temp', 'sei/config/ConfiguracaoSEI.php', 'sei/config/ConfiguracaoSEI.exemplo.php', '.vagrant', '.git')){ | |
72 | 71 | |
73 | 72 | $files = scandir($dir); |
74 | 73 | |
... | ... | @@ -87,18 +86,18 @@ class MdEstatisticasColetarRN extends InfraRN |
87 | 86 | return $results; |
88 | 87 | } |
89 | 88 | |
90 | - private function obterHashs(){ | |
89 | + public function obterHashs(){ | |
91 | 90 | |
92 | 91 | $a = MdEstatisticasColetarRN::getDirContents(DIR_SEI_CONFIG . '/../../'); |
93 | 92 | $objConfiguracaoSEI = ConfiguracaoSEI::getInstance(); |
94 | 93 | |
95 | 94 | if ($objConfiguracaoSEI->isSetValor('SEI','Modulos')){ |
96 | 95 | |
97 | - foreach($objConfiguracaoSEI->getValor('SEI','Modulos') as $strModulo => $strPathModulo){ | |
96 | + foreach($objConfiguracaoSEI->getValor('SEI','Modulos') as $strModulo => $strPathModulo){ | |
98 | 97 | $reflectionClass = new ReflectionClass($strModulo); |
99 | 98 | $classe = $reflectionClass->newInstance(); |
100 | 99 | $arrModulos[$strModulo] = array('modulo' => $strModulo, 'path' => $strPathModulo, 'versao' => $classe->getVersao()); |
101 | - } | |
100 | + } | |
102 | 101 | } |
103 | 102 | |
104 | 103 | foreach ($a as $key => $value) { |
... | ... | @@ -113,11 +112,11 @@ class MdEstatisticasColetarRN extends InfraRN |
113 | 112 | } |
114 | 113 | } |
115 | 114 | |
116 | - $b[] = array('file' => $value, | |
117 | - 'hash' => hash_file('sha256', $value), | |
118 | - 'modulo' => $m, | |
119 | - 'versao_modulo' => $version, | |
120 | - 'versao_sei' => SEI_VERSAO); | |
115 | + $b[] = array('file' => $value, | |
116 | + 'hash' => hash_file('sha256', $value), | |
117 | + 'modulo' => $m, | |
118 | + 'versaoModulo' => $version, | |
119 | + 'versaoSei' => SEI_VERSAO); | |
121 | 120 | } |
122 | 121 | |
123 | 122 | return $b; | ... | ... |
rn/MdEstatisticasEnviarRN.php
... | ... | @@ -88,6 +88,15 @@ class MdEstatisticasEnviarRN extends InfraRN |
88 | 88 | return $this->doPost($url, $obj, false); |
89 | 89 | } |
90 | 90 | |
91 | + public function enviarHashs($hashs, $id) { | |
92 | + $url = $this->url . '/fileshashs'; | |
93 | + $obj = array( | |
94 | + id => $id, | |
95 | + filesHashs => $hashs | |
96 | + ); | |
97 | + return $this->doPost($url, $obj, false); | |
98 | + } | |
99 | + | |
91 | 100 | public function autenticar() { |
92 | 101 | $json = array( |
93 | 102 | username => $this->orgaoSigla, | ... | ... |