[mapserver-commits] r12326 - trunk/mapserver/mapcache/src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:17:08 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:17:08 -0700 (Fri, 26 Aug 2011)
New Revision: 12326
Modified:
trunk/mapserver/mapcache/src/cache_disk.c
trunk/mapserver/mapcache/src/tileset.c
Log:
suppress debugging message.
be more precise in how we compute grid limits (take metatiling into account).
closes issue 58.
thomas.bonfort | 2011-03-07 13:15:52 +0100 (Mon, 07 Mar 2011)
Modified: trunk/mapserver/mapcache/src/cache_disk.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_disk.c 2011-08-26 11:17:03 UTC (rev 12325)
+++ trunk/mapserver/mapcache/src/cache_disk.c 2011-08-26 11:17:08 UTC (rev 12326)
@@ -107,6 +107,29 @@
}
static void _geocache_cache_disk_delete(geocache_context *ctx, geocache_tile *tile) {
+ apr_status_t ret;
+ char errmsg[120];
+ char *filename;
+ apr_file_t *f;
+ _geocache_cache_disk_tile_key(ctx, tile, &filename);
+ GC_CHECK_ERROR(ctx);
+
+ /* delete the tile file if it already exists */
+ if((ret = apr_file_open(&f, filename,APR_FOPEN_READ,APR_OS_DEFAULT, ctx->pool)) == APR_SUCCESS) {
+ apr_file_close(f);
+ ret = apr_file_remove(filename,ctx->pool);
+ if(ret != APR_SUCCESS) {
+ ctx->set_error(ctx, 500, "failed to remove existing file %s: %s",filename, apr_strerror(ret,errmsg,120));
+ return; /* we could not delete the file */
+ }
+ } else {
+ int code = 500;
+ if(ret == ENOENT) {
+ code = 404;
+ }
+ ctx->set_error(ctx, code, "failed to remove file %s: %s",filename, apr_strerror(ret,errmsg,120));
+ return; /* we could not open the file */
+ }
}
@@ -206,6 +229,17 @@
return;
}
*hackptr2 = '/';
+
+ /* delete the tile file if it already exists */
+ if((ret = apr_file_open(&f, filename,APR_FOPEN_READ,APR_OS_DEFAULT, ctx->pool)) == APR_SUCCESS) {
+ apr_file_close(f);
+ ret = apr_file_remove(filename,ctx->pool);
+ if(ret != APR_SUCCESS) {
+ ctx->set_error(ctx, 500, "failed to remove existing file %s: %s",filename, apr_strerror(ret,errmsg,120));
+ return; /* we could not create the file */
+ }
+ }
+
#ifdef HAVE_SYMLINK
if(((geocache_cache_disk*)tile->tileset->cache)->symlink_blank) {
Modified: trunk/mapserver/mapcache/src/tileset.c
===================================================================
--- trunk/mapserver/mapcache/src/tileset.c 2011-08-26 11:17:03 UTC (rev 12325)
+++ trunk/mapserver/mapcache/src/tileset.c 2011-08-26 11:17:08 UTC (rev 12326)
@@ -352,5 +352,26 @@
}
}
}
+
+void geocache_tileset_tile_delete(geocache_context *ctx, geocache_tile *tile) {
+ int i;
+ /*delete the tile itself*/
+ tile->tileset->cache->tile_delete(ctx,tile);
+ GC_CHECK_ERROR(ctx);
+
+ geocache_metatile *mt = _geocache_tileset_metatile_get(ctx, tile);
+ for(i=0;i<mt->ntiles;i++) {
+ geocache_tile *subtile = &mt->tiles[i];
+ /* skip deleting the actual tile */
+ if(subtile->x == tile->x && subtile->y == tile->y) continue;
+ subtile->tileset->cache->tile_delete(ctx,tile);
+ /* silently pass failure if the tile was not found */
+ if(ctx->get_error(ctx) == 404) {
+ ctx->clear_errors(ctx);
+ }
+ GC_CHECK_ERROR(ctx);
+ }
+}
+
/* vim: ai ts=3 sts=3 et sw=3
*/
More information about the mapserver-commits
mailing list