Commit 4998b98740084499861ce02e6d8df8be0d5b16a3
1 parent
cf44712b
Exists in
master
and in
1 other branch
Implementação da busca do hash de cada arquivo instalado
Showing
1 changed file
with
69 additions
and
1 deletions
Show diff stats
rn/MdEstatisticasColetarRN.php
@@ -47,7 +47,7 @@ class MdEstatisticasColetarRN extends InfraRN | @@ -47,7 +47,7 @@ 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 | - | 50 | + $ind['filehashIndicador'] = $this->obterHashs(); |
51 | return $ind; | 51 | return $ind; |
52 | } catch (Exception $e) { | 52 | } catch (Exception $e) { |
53 | InfraDebug::getInstance()->setBolLigado(false); | 53 | InfraDebug::getInstance()->setBolLigado(false); |
@@ -57,6 +57,73 @@ class MdEstatisticasColetarRN extends InfraRN | @@ -57,6 +57,73 @@ class MdEstatisticasColetarRN extends InfraRN | ||
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | + private static function bolArrFindItem($arrNeedle, $strHaystack){ | ||
61 | + $r=false; | ||
62 | + foreach ($arrNeedle as $v) { | ||
63 | + $r=strpos($strHaystack, $v); | ||
64 | + if($r === 0 || $r) return $r; | ||
65 | + } | ||
66 | + return $r; | ||
67 | + } | ||
68 | + | ||
69 | + private $IG = array('sei/temp', 'sei/config/ConfiguracaoSEI.php', 'sei/config/ConfiguracaoSEI.exemplo.php'); | ||
70 | + | ||
71 | + private static function getDirContents($dir, &$results = array(), $ignorar = array('sei/temp', 'sei/config/ConfiguracaoSEI.php', 'sei/config/ConfiguracaoSEI.exemplo.php')){ | ||
72 | + | ||
73 | + $files = scandir($dir); | ||
74 | + | ||
75 | + foreach($files as $key => $value){ | ||
76 | + $path = realpath($dir.DIRECTORY_SEPARATOR.$value); | ||
77 | + if(!MdEstatisticasColetarRN::bolArrFindItem($ignorar, $path)){ | ||
78 | + if(!is_dir($path)) { | ||
79 | + $results[] = $path; | ||
80 | + | ||
81 | + } else if($value != "." && $value != "..") { | ||
82 | + MdEstatisticasColetarRN::getDirContents($path, $results); | ||
83 | + } | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
87 | + return $results; | ||
88 | + } | ||
89 | + | ||
90 | + private function obterHashs(){ | ||
91 | + | ||
92 | + $a = MdEstatisticasColetarRN::getDirContents(DIR_SEI_CONFIG . '/../../sei'); | ||
93 | + $objConfiguracaoSEI = ConfiguracaoSEI::getInstance(); | ||
94 | + | ||
95 | + if ($objConfiguracaoSEI->isSetValor('SEI','Modulos')){ | ||
96 | + | ||
97 | + foreach($objConfiguracaoSEI->getValor('SEI','Modulos') as $strModulo => $strPathModulo){ | ||
98 | + $reflectionClass = new ReflectionClass($strModulo); | ||
99 | + $classe = $reflectionClass->newInstance(); | ||
100 | + $arrModulos[$strModulo] = array('modulo' => $strModulo, 'path' => $strPathModulo, 'versao' => $classe->getVersao()); | ||
101 | + } | ||
102 | + } | ||
103 | + | ||
104 | + foreach ($a as $key => $value) { | ||
105 | + $m=""; | ||
106 | + $version=""; | ||
107 | + | ||
108 | + foreach ($arrModulos as $k => $v) { | ||
109 | + if(strpos($value, 'web/modulos/'.$arrModulos[$k]['path']) !== false){ | ||
110 | + $m = $k; | ||
111 | + $version = $arrModulos[$k]['versao']; | ||
112 | + break; | ||
113 | + } | ||
114 | + } | ||
115 | + | ||
116 | + $b[] = array('file' => $value, | ||
117 | + 'hash' => hash_file('sha256', $value), | ||
118 | + 'modulo' => $m, | ||
119 | + 'versao_modulo' => $version, | ||
120 | + 'versao_sei' => SEI_VERSAO); | ||
121 | + } | ||
122 | + | ||
123 | + return $b; | ||
124 | + | ||
125 | + } | ||
126 | + | ||
60 | private function obterVersaoSEI() { | 127 | private function obterVersaoSEI() { |
61 | return SEI_VERSAO; | 128 | return SEI_VERSAO; |
62 | } | 129 | } |
@@ -474,3 +541,4 @@ class MdEstatisticasColetarRN extends InfraRN | @@ -474,3 +541,4 @@ class MdEstatisticasColetarRN extends InfraRN | ||
474 | } | 541 | } |
475 | } | 542 | } |
476 | ?> | 543 | ?> |
544 | + |