Commit 6aef2a2350a6987ae5b864affd571b2be47e075d
1 parent
6bf172d6
Exists in
master
and in
7 other branches
Inclusão de rotina para remoção de cache quando um mapfile é salvo via editor de…
… mapfiles ou via edição com i3Geo
Showing
6 changed files
with
75 additions
and
21 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/editormapfile.php
... | ... | @@ -1159,7 +1159,7 @@ function clonarMapfile() |
1159 | 1159 | } |
1160 | 1160 | function refazerLayer() |
1161 | 1161 | { |
1162 | - global $nomelayer, $codigomap, $locaplic; | |
1162 | + global $nomelayer, $codigomap, $locaplic, $dir_tmp, $cachedir; | |
1163 | 1163 | |
1164 | 1164 | $maporigem = $_GET["maporigem"]; |
1165 | 1165 | |
... | ... | @@ -1210,6 +1210,11 @@ function refazerLayer() |
1210 | 1210 | } |
1211 | 1211 | $mapatema->save($arqtema); |
1212 | 1212 | removeCabecalho($arqtema); |
1213 | + //apaga o cache | |
1214 | + include($locaplic."/admin1/php/funcoesAdmin.php"); | |
1215 | + \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigomap, $cachedir, $dir_tmp); | |
1216 | + | |
1217 | + | |
1213 | 1218 | return array("data"=>"ok"); |
1214 | 1219 | } |
1215 | 1220 | return "erro"; |
... | ... | @@ -2500,9 +2505,11 @@ function removeCabecalho($arq,$symbolset=true) |
2500 | 2505 | //remove o cache OGC |
2501 | 2506 | $nomeMapfileTmp = $dir_tmp."/ogc_".md5($arq).".map"; |
2502 | 2507 | $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp); |
2503 | - $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); | |
2504 | - chmod($nomeMapfileTmp,0777); | |
2505 | - unlink($nomeMapfileTmp); | |
2508 | + $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); | |
2509 | + if(file_exists($nomeMapfileTmp)){ | |
2510 | + chmod($nomeMapfileTmp,0777); | |
2511 | + unlink($nomeMapfileTmp); | |
2512 | + } | |
2506 | 2513 | //echo $nomeMapfileTmp;exit; |
2507 | 2514 | //remove o cache OGC |
2508 | 2515 | $handle = fopen($arq, "r"); | ... | ... |
admin1/catalogo/mapfile/editor/funcoes.php
... | ... | @@ -217,6 +217,9 @@ function salvaMapfile() { |
217 | 217 | } |
218 | 218 | $resultado = \admin\php\funcoesAdmin\i3GeoAdminUpdate ( $dbhw, "i3geoadmin_temas", $dataCol, "WHERE codigo_tema = '$codigo'" ); |
219 | 219 | } |
220 | + | |
220 | 221 | \admin\php\funcoesAdmin\removeCabecalhoMapfile ( $mapfile ); |
222 | + \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigo, $_SESSION["cachedir"], $_SESSION["dir_tmp"]); | |
223 | + | |
221 | 224 | } |
222 | 225 | ?> |
223 | 226 | \ No newline at end of file | ... | ... |
admin1/index.php
... | ... | @@ -42,6 +42,8 @@ $_SESSION["logTransacoes"] = $logTransacoes; |
42 | 42 | unset($logTransacoes); |
43 | 43 | $_SESSION["dir_tmp"] = $dir_tmp; |
44 | 44 | unset($dir_tmp); |
45 | +$_SESSION["cachedir"] = $cachedir; | |
46 | +unset($cachedir); | |
45 | 47 | $_SESSION["mensagemInicia"] = $mensagemInicia; |
46 | 48 | unset($mensagemInicia); |
47 | 49 | $_SESSION["i3geoPermiteLoginIp"] = $i3geoPermiteLoginIp; | ... | ... |
admin1/php/funcoesAdmin.php
... | ... | @@ -830,4 +830,54 @@ function fileContemString($arq,$s){ |
830 | 830 | fclose($handle); |
831 | 831 | return $valid; |
832 | 832 | } |
833 | +function limpaCacheImg($locaplic, $codigo, $cachedir, $dir_tmp){ | |
834 | + if(empty($dir_tmp)){ | |
835 | + return false; | |
836 | + } | |
837 | + $mapfile = $locaplic . "/temas/" . $codigo . ".map"; | |
838 | + if (! file_exists ( $mapfile )) { | |
839 | + return false; | |
840 | + } | |
841 | + $mapa = ms_newMapObj ( $mapfile ); | |
842 | + $nomes = $mapa->getalllayernames (); | |
843 | + if ($cachedir != "") { | |
844 | + $d = $cachedir; | |
845 | + } else { | |
846 | + $d = $dir_tmp . "/cache"; | |
847 | + } | |
848 | + foreach ( $nomes as $nome ) { | |
849 | + $nome = str_replace ( ".", "", $nome ); | |
850 | + $nome = strip_tags ( $nome ); | |
851 | + $nome = htmlspecialchars ( $nome, ENT_QUOTES ); | |
852 | + $dirs [] = $d . "/" . $nome; | |
853 | + $dirs [] = $d . "/googlemaps/" . $nome; | |
854 | + $dirs [] = $d . "/wmts/" . $nome; | |
855 | + foreach ( $dirs as $dir ) { | |
856 | + \admin\php\funcoesAdmin\rrmdirImg ( $dir ); | |
857 | + } | |
858 | + } | |
859 | + $nome = $nomes[0]; | |
860 | + if(file_exists($d . "/" . $nome) || file_exists($d . "/googlemaps/" . $nome) || file_exists($d . "/wmts/" . $nome)){ | |
861 | + return false; | |
862 | + } else { | |
863 | + return true; | |
864 | + } | |
865 | +} | |
866 | +function rrmdirImg($dir) { | |
867 | + if (is_dir ( $dir )) { | |
868 | + $objects = scandir ( $dir ); | |
869 | + foreach ( $objects as $object ) { | |
870 | + if ($object != "." && $object != "..") { | |
871 | + if (filetype ( $dir . "/" . $object ) == "dir") { | |
872 | + \admin\php\funcoesAdmin\rrmdirImg ( $dir . "/" . $object ); | |
873 | + } else { | |
874 | + $object = str_replace ( ".png", "", $object ) . ".png"; | |
875 | + chmod ( $dir . "/" . $object, 077 ); | |
876 | + unlink ( $dir . "/" . $object ); | |
877 | + } | |
878 | + } | |
879 | + } | |
880 | + reset ( $objects ); | |
881 | + } | |
882 | +} | |
833 | 883 | ?> | ... | ... |
temas/_lbiomashp.map
... | ... | @@ -3,23 +3,19 @@ MAP |
3 | 3 | SYMBOLSET "../symbols/simbolosv6.sym" |
4 | 4 | LAYER |
5 | 5 | CONNECTION "" |
6 | - DATA "biomas.shp" | |
6 | + DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | |
7 | 7 | METADATA |
8 | - "METAESTAT_ID_MEDIDA_VARIAVEL" "" | |
9 | - "cache" "nao" | |
10 | 8 | "TIP" "CD_LEGENDA" |
9 | + "cache" "sim" | |
11 | 10 | "olopacity" "" |
12 | 11 | "CLASSE" "sim" |
13 | 12 | "permitekmz" "SIM" |
14 | - "temporizador" "" | |
15 | 13 | "gmopacity" "" |
16 | 14 | "gmstatus" "" |
17 | 15 | "ITENSDESC" "Teste de acentuação" |
18 | - "iconetema" "" | |
19 | - "editavel" "" | |
20 | - "ESCALA" "250000" | |
21 | 16 | "TILES" "SIM" |
22 | - "METAESTAT_CODIGO_TIPO_REGIAO" "" | |
17 | + "ESCALA" "250000" | |
18 | + "editavel" "" | |
23 | 19 | "arquivotemaoriginal" "" |
24 | 20 | "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909" |
25 | 21 | "olstatus" "" |
... | ... | @@ -29,22 +25,18 @@ MAP |
29 | 25 | "permitecomentario" "NAO" |
30 | 26 | "DATAORIGINAL" "" |
31 | 27 | "PLUGINI3GEO" "" |
32 | - "metaestat" "" | |
33 | 28 | "escondido" "NAO" |
34 | - "esquematabelaeditavel" "" | |
35 | 29 | "download" "SIM" |
30 | + "esquematabelaeditavel" "" | |
36 | 31 | "itembuscarapida" "CD_LEGENDA" |
37 | - "arquivokmz" "" | |
38 | - "arquivodownload" "" | |
39 | 32 | "ITENS" "CD_LEGENDA" |
40 | - "transitioneffect" "NAO" | |
41 | - "permiteogc" "SIM" | |
42 | 33 | "permitekml" "SIM" |
43 | - "TEMA" "Biomas shapefile (acentuação)" | |
34 | + "permiteogc" "SIM" | |
35 | + "transitioneffect" "NAO" | |
44 | 36 | "convcaracter" "SIM" |
45 | - "colunageometria" "" | |
37 | + "TEMA" "Biomas shapefile (acentuação)" | |
46 | 38 | "colunaidunico" "" |
47 | - "cortepixels" "" | |
39 | + "colunageometria" "" | |
48 | 40 | "identifica" "sim" |
49 | 41 | "tabelaeditavel" "" |
50 | 42 | END # METADATA | ... | ... |