Commit 62eb9c7d39f4b831f58283a67ec24eb96274baab

Authored by Edmar Moretti
1 parent 3bfcb259

Correção na função de limpeza de cache

admin/admin.db
No preview for this file type
admin/php/editormapfile.php
... ... @@ -244,16 +244,7 @@ switch (strtoupper($funcao))
244 244 $dirs[] = $d."/".$nome;
245 245 $dirs[] = $d."/googlemaps/".$nome;
246 246 foreach($dirs as $dir){
247   - if (is_dir($dir)) {
248   - $objects = scandir($dir);
249   - foreach ($objects as $object) {
250   - if ($object != "." && $object != "..") {
251   - if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
252   - }
253   - }
254   - reset($objects);
255   - rmdir($dir);
256   - }
  247 + rrmdir($dir);
257 248 }
258 249 }
259 250 retornaJSON("ok");
... ... @@ -2125,4 +2116,18 @@ function removeCabecalho($arq,$symbolset=true)
2125 2116 fclose($handle);
2126 2117 chmod($arq, 0666);
2127 2118 }
  2119 +function rrmdir($dir) {
  2120 + if (is_dir($dir)) {
  2121 + chmod($dir,0777);
  2122 + $objects = scandir($dir);
  2123 + foreach ($objects as $object) {
  2124 + if ($object != "." && $object != "..") {
  2125 + chmod($dir."/".$object,0777);
  2126 + if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
  2127 + }
  2128 + }
  2129 + reset($objects);
  2130 + rmdir($dir);
  2131 + }
  2132 +}
2128 2133 ?>
2129 2134 \ No newline at end of file
... ...
classesphp/mapa_googlemaps.php
... ... @@ -297,21 +297,9 @@ else{
297 297 fpassthru(fopen($nomer, 'rb'));
298 298 }
299 299 else{
300   - if(extension_loaded("imagick")){
301   - header('Content-Type: image/png');
302   - $img->saveImage();
303   - }
304   - else{
305   - $nomer = ($img->imagepath)."temp".nomeRand().".png";
306   - $img->saveImage($nomer);
307   - $img = imagecreatefrompng($nomer);
308   - imagealphablending($img, false);
309   - imagesavealpha($img, true);
310   - ob_clean();
311   - echo header("Content-type: image/png \n\n");
312   - imagepng($img);
313   - imagedestroy($img);
314   - }
  300 + //se der erro aqui veja em mapa_googlemaps_alternativo.php
  301 + header('Content-Type: image/png');
  302 + $img->saveImage();
315 303 }
316 304 exit;
317 305 }
... ... @@ -328,6 +316,7 @@ function salvaCacheImagem(){
328 316 if(!file_exists($c."/$y.png")){
329 317 mkdir($cachedir."/googlemaps/$layer/$z/$x",0777,true);
330 318 $img->saveImage($c."/$y.png");
  319 + chmod($cachedir."/googlemaps/$layer/$z/$x",0777);
331 320 chmod($c."/$y.png",0777);
332 321 }
333 322 return $nome;
... ...
classesphp/mapa_openlayers.php
... ... @@ -290,21 +290,9 @@ else{
290 290 else{
291 291 if($img->imagepath == "")
292 292 {echo "Erro IMAGEPATH vazio";exit;}
293   - if(extension_loaded("imagick")){
294   - header('Content-Type: image/png');
295   - $img->saveImage();
296   - }
297   - else{
298   - $nomer = ($img->imagepath)."temp".nomeRand().".png";
299   - $img->saveImage($nomer);
300   - $img = imagecreatefrompng($nomer);
301   - imagealphablending($img, false);
302   - imagesavealpha($img, true);
303   - ob_clean();
304   - echo header("Content-type: image/png \n\n");
305   - imagepng($img);
306   - imagedestroy($img);
307   - }
  293 + //se der erro aqui veja em mapa_openlayers_alternativo.php
  294 + header('Content-Type: image/png');
  295 + $img->saveImage();
308 296 }
309 297 }
310 298 function salvaCacheImagem($cachedir,$map,$tms){
... ... @@ -316,7 +304,8 @@ function salvaCacheImagem($cachedir,$map,$tms){
316 304 $nome = $cachedir.$tms;
317 305 }
318 306 if(!file_exists($nome)){
319   - @mkdir(dirname($nome),0777,true);
  307 + @mkdir(dirname($nome),0777,true);
  308 + chmod(dirname($nome),0777);
320 309 $img->saveImage($nome);
321 310 chmod($nome,0777);
322 311 }
... ...
ms_criamapa.php
... ... @@ -1202,17 +1202,23 @@ function criaDirMapa($dir_tmp,$cachedir="")
1202 1202 {
1203 1203 $tmpdirname = nomeRandomico();
1204 1204 $crdir = @mkdir ($dir_tmp."/".$tmpdirname,0777);
  1205 + chmod($dir_tmp."/".$tmpdirname,0777);
1205 1206 $crdiri = @mkdir ($dir_tmp."/img".$tmpdirname,0777);
  1207 + chmod($dir_tmp."/img".$tmpdirname,0777);
1206 1208 $mapfile = $dir_tmp."/".$tmpdirname."/".$tmpdirname.".map";
1207 1209 $tmpimgname = "img".$tmpdirname;
1208 1210 @mkdir($dir_tmp."/comum",0777);
1209 1211 if($cachedir == ""){
1210 1212 @mkdir($dir_tmp."/cache",0777);
  1213 + chmod($dir_tmp."/cache",0777);
1211 1214 @mkdir($dir_tmp."/cache/googlemaps",0777);
  1215 + chmod($dir_tmp."/cache/googlemaps",0777);
1212 1216 }
1213 1217 else{
1214 1218 @mkdir($cachedir,0777);
  1219 + chmod($cachedir,0777);
1215 1220 @mkdir($cachedir."/googlemaps",0777);
  1221 + chmod($cachedir."/googlemaps",0777);
1216 1222 }
1217 1223 if(file_exists($dir_tmp."/".$tmpdirname))
1218 1224 return array($mapfile,$tmpdirname,$tmpimgname);
... ...
temas/_lbiomashp.map
... ... @@ -6,21 +6,21 @@ MAP
6 6 DATA "/var/www/i3geo/aplicmap/dados/biomas.shp"
7 7 METADATA
8 8 "METAESTAT_ID_MEDIDA_VARIAVEL" ""
9   - "cache" "NAO"
  9 + "cache" "SIM"
10 10 "CLASSE" "SIM"
11 11 "permitekmz" "nao"
12 12 "METAESTAT_CODIGO_TIPO_REGIAO" ""
13 13 "permitedownload" "sim"
14 14 "metaestat" ""
15   - "permitekml" "sim"
16 15 "permiteogc" "sim"
  16 + "permitekml" "sim"
  17 + "convcaracter" ""
17 18 "TEMA" "Biomas shapefile (acentuação)"
18 19 END # METADATA
19 20 NAME "_lbiomashp"
20 21 PROCESSING "ITEMS=CD_LEGENDA"
21 22 STATUS OFF
22 23 TEMPLATE "none.htm"
23   - TILEITEM "location"
24 24 OPACITY 50
25 25 TYPE POLYGON
26 26 UNITS METERS
... ...