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,7 +2725,13 @@ function validaAcessoTemas($map_file,$salva = true){ | ||
2725 | $existeIndevidos = false; | 2725 | $existeIndevidos = false; |
2726 | if(count($indevidos) > 0){ | 2726 | if(count($indevidos) > 0){ |
2727 | $existeIndevidos = true; | 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 | foreach($indevidos as $i){ | 2735 | foreach($indevidos as $i){ |
2730 | $l = $m->getlayerbyname($i); | 2736 | $l = $m->getlayerbyname($i); |
2731 | $l->set("status",MS_DELETE); | 2737 | $l->set("status",MS_DELETE); |
@@ -2769,24 +2775,14 @@ function listaLayersIndevidos($map_file){ | @@ -2769,24 +2775,14 @@ function listaLayersIndevidos($map_file){ | ||
2769 | error_reporting(0); | 2775 | error_reporting(0); |
2770 | $indevidos = array(); | 2776 | $indevidos = array(); |
2771 | $restritos = listaTemasRestritos(); | 2777 | $restritos = listaTemasRestritos(); |
2772 | - /* | ||
2773 | - array(1) { | ||
2774 | - ["_wlocalirestrito"]=> | ||
2775 | - array(1) { | ||
2776 | - [0]=> | ||
2777 | - string(1) "1" | ||
2778 | - } | ||
2779 | - } | ||
2780 | - */ | ||
2781 | if(count($restritos) > 0){ | 2778 | if(count($restritos) > 0){ |
2782 | $gruposusr = listaGruposUsrLogin(); | 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 | $c = $m->numlayers; | 2786 | $c = $m->numlayers; |
2791 | for ($i=0;$i < $c;++$i) { | 2787 | for ($i=0;$i < $c;++$i) { |
2792 | $layer = $m->getlayer($i); | 2788 | $layer = $m->getlayer($i); |
classesphp/mapa_googlemaps.php
@@ -487,7 +487,10 @@ function salvaCacheImagem(){ | @@ -487,7 +487,10 @@ function salvaCacheImagem(){ | ||
487 | } | 487 | } |
488 | $c = $cachedir."/googlemaps/$layer/$z/$x"; | 488 | $c = $cachedir."/googlemaps/$layer/$z/$x"; |
489 | if(!file_exists($c."/$y.png")){ | 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 | $img->saveImage($c."/$y.png"); | 494 | $img->saveImage($c."/$y.png"); |
492 | // | 495 | // |
493 | //corta a imagem gerada para voltar ao tamanho normal | 496 | //corta a imagem gerada para voltar ao tamanho normal |
@@ -495,8 +498,6 @@ function salvaCacheImagem(){ | @@ -495,8 +498,6 @@ function salvaCacheImagem(){ | ||
495 | if($cortePixels > 0){ | 498 | if($cortePixels > 0){ |
496 | $img = cortaImagemDisco($c."/$y.png",$cortePixels,256); | 499 | $img = cortaImagemDisco($c."/$y.png",$cortePixels,256); |
497 | } | 500 | } |
498 | - | ||
499 | - chmod($cachedir."/googlemaps/$layer/$z/$x",0744); | ||
500 | chmod($c."/$y.png",0744); | 501 | chmod($c."/$y.png",0744); |
501 | } | 502 | } |
502 | return $c."/$y.png"; | 503 | return $c."/$y.png"; |
classesphp/mapa_openlayers.php
@@ -503,10 +503,13 @@ function salvaCacheImagem($cachedir,$map,$tms){ | @@ -503,10 +503,13 @@ function salvaCacheImagem($cachedir,$map,$tms){ | ||
503 | else{ | 503 | else{ |
504 | $nome = $cachedir.$tms; | 504 | $nome = $cachedir.$tms; |
505 | } | 505 | } |
506 | + $nome = str_replace(".png","",$nome); | ||
506 | $nome = $nome.".png"; | 507 | $nome = $nome.".png"; |
507 | if(!file_exists($nome)){ | 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 | $img->saveImage($nome); | 513 | $img->saveImage($nome); |
511 | // | 514 | // |
512 | //corta a imagem gerada para voltar ao tamanho normal | 515 | //corta a imagem gerada para voltar ao tamanho normal |
ogc.php
@@ -785,12 +785,11 @@ else{ | @@ -785,12 +785,11 @@ else{ | ||
785 | // | 785 | // |
786 | processaOutputformatMapfile(); | 786 | processaOutputformatMapfile(); |
787 | $nomeMapfileTmp = str_replace(".map","",$nomeMapfileTmp).".map"; | 787 | $nomeMapfileTmp = str_replace(".map","",$nomeMapfileTmp).".map"; |
788 | + restauraConObj($oMap,$postgis_mapa); | ||
788 | $oMap->save($nomeMapfileTmp); | 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 | if(ob_get_contents ()){ | 795 | if(ob_get_contents ()){ |
@@ -1208,9 +1207,10 @@ function salvaCacheImagem($cachedir,$map,$tms){ | @@ -1208,9 +1207,10 @@ function salvaCacheImagem($cachedir,$map,$tms){ | ||
1208 | $nome = $cachedir.$tms; | 1207 | $nome = $cachedir.$tms; |
1209 | } | 1208 | } |
1210 | $nome = str_replace(".png","",$nome).".png"; | 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 | $img->saveImage($nome); | 1214 | $img->saveImage($nome); |
1215 | // | 1215 | // |
1216 | //corta a imagem gerada para voltar ao tamanho normal | 1216 | //corta a imagem gerada para voltar ao tamanho normal |