Commit 1fa17a948d8eeedf4400b0d0d7390a61eb8f774b
1 parent
e7c2fcbc
Exists in
master
Otimização da verificação de layers restritos em ogc.php
Showing
4 changed files
with
28 additions
and
28 deletions
Show diff stats
classesphp/funcoes_gerais.php
| ... | ... | @@ -2725,7 +2725,13 @@ function validaAcessoTemas($map_file,$salva = true){ |
| 2725 | 2725 | $existeIndevidos = false; |
| 2726 | 2726 | if(count($indevidos) > 0){ |
| 2727 | 2727 | $existeIndevidos = true; |
| 2728 | - $m = ms_newMapObj($map_file); | |
| 2728 | + if(!is_object($map_file)){ | |
| 2729 | + $m = ms_newMapObj($map_file); | |
| 2730 | + } | |
| 2731 | + else { | |
| 2732 | + $m = $map_file; | |
| 2733 | + $salva = false; | |
| 2734 | + } | |
| 2729 | 2735 | foreach($indevidos as $i){ |
| 2730 | 2736 | $l = $m->getlayerbyname($i); |
| 2731 | 2737 | $l->set("status",MS_DELETE); |
| ... | ... | @@ -2769,24 +2775,14 @@ function listaLayersIndevidos($map_file){ |
| 2769 | 2775 | error_reporting(0); |
| 2770 | 2776 | $indevidos = array(); |
| 2771 | 2777 | $restritos = listaTemasRestritos(); |
| 2772 | - /* | |
| 2773 | - array(1) { | |
| 2774 | - ["_wlocalirestrito"]=> | |
| 2775 | - array(1) { | |
| 2776 | - [0]=> | |
| 2777 | - string(1) "1" | |
| 2778 | - } | |
| 2779 | - } | |
| 2780 | - */ | |
| 2781 | 2778 | if(count($restritos) > 0){ |
| 2782 | 2779 | $gruposusr = listaGruposUsrLogin(); |
| 2783 | - /* | |
| 2784 | - array(1) { | |
| 2785 | - [0]=> | |
| 2786 | - string(1) "1" | |
| 2780 | + if(!is_object($map_file)){ | |
| 2781 | + $m = ms_newMapObj($map_file); | |
| 2782 | + } | |
| 2783 | + else { | |
| 2784 | + $m = $map_file; | |
| 2787 | 2785 | } |
| 2788 | - */ | |
| 2789 | - $m = ms_newMapObj($map_file); | |
| 2790 | 2786 | $c = $m->numlayers; |
| 2791 | 2787 | for ($i=0;$i < $c;++$i) { |
| 2792 | 2788 | $layer = $m->getlayer($i); | ... | ... |
classesphp/mapa_googlemaps.php
| ... | ... | @@ -487,7 +487,10 @@ function salvaCacheImagem(){ |
| 487 | 487 | } |
| 488 | 488 | $c = $cachedir."/googlemaps/$layer/$z/$x"; |
| 489 | 489 | if(!file_exists($c."/$y.png")){ |
| 490 | - mkdir($cachedir."/googlemaps/$layer/$z/$x",0744,true); | |
| 490 | + if(!file_exists($cachedir."/googlemaps/$layer/$z/$x")){ | |
| 491 | + mkdir($cachedir."/googlemaps/$layer/$z/$x",0744,true); | |
| 492 | + chmod($cachedir."/googlemaps/$layer/$z/$x",0744); | |
| 493 | + } | |
| 491 | 494 | $img->saveImage($c."/$y.png"); |
| 492 | 495 | // |
| 493 | 496 | //corta a imagem gerada para voltar ao tamanho normal |
| ... | ... | @@ -495,8 +498,6 @@ function salvaCacheImagem(){ |
| 495 | 498 | if($cortePixels > 0){ |
| 496 | 499 | $img = cortaImagemDisco($c."/$y.png",$cortePixels,256); |
| 497 | 500 | } |
| 498 | - | |
| 499 | - chmod($cachedir."/googlemaps/$layer/$z/$x",0744); | |
| 500 | 501 | chmod($c."/$y.png",0744); |
| 501 | 502 | } |
| 502 | 503 | return $c."/$y.png"; | ... | ... |
classesphp/mapa_openlayers.php
| ... | ... | @@ -503,10 +503,13 @@ function salvaCacheImagem($cachedir,$map,$tms){ |
| 503 | 503 | else{ |
| 504 | 504 | $nome = $cachedir.$tms; |
| 505 | 505 | } |
| 506 | + $nome = str_replace(".png","",$nome); | |
| 506 | 507 | $nome = $nome.".png"; |
| 507 | 508 | if(!file_exists($nome)){ |
| 508 | - @mkdir(dirname($nome),0744,true); | |
| 509 | - chmod(dirname($nome),0744); | |
| 509 | + if(!file_exists(dirname($nome))){ | |
| 510 | + @mkdir(dirname($nome),0744,true); | |
| 511 | + chmod(dirname($nome),0744); | |
| 512 | + } | |
| 510 | 513 | $img->saveImage($nome); |
| 511 | 514 | // |
| 512 | 515 | //corta a imagem gerada para voltar ao tamanho normal | ... | ... |
ogc.php
| ... | ... | @@ -785,12 +785,11 @@ else{ |
| 785 | 785 | // |
| 786 | 786 | processaOutputformatMapfile(); |
| 787 | 787 | $nomeMapfileTmp = str_replace(".map","",$nomeMapfileTmp).".map"; |
| 788 | + restauraConObj($oMap,$postgis_mapa); | |
| 788 | 789 | $oMap->save($nomeMapfileTmp); |
| 789 | - validaAcessoTemas($nomeMapfileTmp,true); | |
| 790 | 790 | |
| 791 | - substituiCon($nomeMapfileTmp,$postgis_mapa); | |
| 792 | - $oMap = ms_newMapobj($nomeMapfileTmp); | |
| 793 | - restauraCon($nomeMapfileTmp,$postgis_mapa); | |
| 791 | + validaAcessoTemas($oMap,true); | |
| 792 | + substituiConObj($oMap,$postgis_mapa); | |
| 794 | 793 | } |
| 795 | 794 | |
| 796 | 795 | if(ob_get_contents ()){ |
| ... | ... | @@ -1208,9 +1207,10 @@ function salvaCacheImagem($cachedir,$map,$tms){ |
| 1208 | 1207 | $nome = $cachedir.$tms; |
| 1209 | 1208 | } |
| 1210 | 1209 | $nome = str_replace(".png","",$nome).".png"; |
| 1211 | - @mkdir(dirname($nome),0744,true); | |
| 1212 | - chmod(dirname($nome),0744); | |
| 1213 | - | |
| 1210 | + if(!file_exists(dirname($nome))){ | |
| 1211 | + @mkdir(dirname($nome),0744,true); | |
| 1212 | + chmod(dirname($nome),0744); | |
| 1213 | + } | |
| 1214 | 1214 | $img->saveImage($nome); |
| 1215 | 1215 | // |
| 1216 | 1216 | //corta a imagem gerada para voltar ao tamanho normal | ... | ... |