[mapserver-commits] r12209 - in trunk/mapserver/mapcache: . src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:07:21 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:07:21 -0700 (Fri, 26 Aug 2011)
New Revision: 12209
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/src/configuration.c
Log:
add commented version of configuration file
thomas.bonfort | 2011-01-07 13:06:13 +0100 (Fri, 07 Jan 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:07:17 UTC (rev 12208)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:07:21 UTC (rev 12209)
@@ -1,4 +1,4 @@
-<!--comment-->
+<?xml version="1.0" encoding="UTF-8"?>
<geocache>
<grid name="testgrid">
<srs>epsg:4326</srs>
@@ -19,7 +19,7 @@
<srs>epsg:4326</srs>
<wmsparams>
<FORMAT>image/png</FORMAT>
- <LAYERS>basic</LAYERS>
+ <LAYERS>basic</LAYERS>
</wmsparams>
</source>
<source name="osm" type="wms">
@@ -80,6 +80,13 @@
</tileset>
<merge_format>PNGQ_FAST</merge_format>
+ <!-- this is the location where locks will be stored when a tile
+ is not in the cache.
+ this directory MUST exist, and be accessible for reading and
+ writing by the user running apache (usually www-data or nobody)
+ -->
+ <lock_dir>/tmp/mylocks</lock_dir>
+
<services>
<wms>true</wms>
<tms>true</tms>
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:07:17 UTC (rev 12208)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:07:21 UTC (rev 12209)
@@ -22,6 +22,7 @@
#include <apr_strings.h>
#include <apr_hash.h>
#include <apr_file_io.h>
+#include <apr_file_info.h>
geocache_cfg* geocache_configuration_create(apr_pool_t *pool) {
geocache_grid *grid;
@@ -84,7 +85,7 @@
geocache_imageio_create_jpeg_format(pool,"JPEG",95),
"JPEG");
cfg->merge_format = geocache_configuration_get_image_format(cfg,"PNG");
- cfg->lockdir = "/tmp/geocache_locks";
+ cfg->lockdir = NULL;
cfg->reporting = GEOCACHE_REPORT_MSG;
grid = geocache_grid_create(pool);
@@ -726,19 +727,31 @@
return;
}
- /* check our lock directory is valid and writable */
- if(APR_SUCCESS != apr_dir_make_recursive(config->lockdir, APR_OS_DEFAULT, ctx->pool)) {
- ctx->set_error(ctx, GEOCACHE_DISK_ERROR, "failed to create lock directory %s",config->lockdir);
- return;
+ /* check our lock directory exists */
+ if(!config->lockdir) {
+ ctx->set_error(ctx, GEOCACHE_DISK_ERROR, "no lock directory configured."
+ " You should add one with the <lock_dir> configuration tag");
+ return;
+ } else {
+ apr_dir_t *dir;
+ int ret = apr_dir_open(&dir,config->lockdir, ctx->pool);
+ if(APR_SUCCESS != ret) {
+ ctx->set_error(ctx, GEOCACHE_DISK_ERROR, "failed to open directory %s, does it exist?",config->lockdir);
+ return;
+ }
+ apr_dir_close(dir);
+#ifdef notused
+ testlockfilename = apr_psprintf(ctx->pool,"%s/test.lock",config->lockdir);
+ if(apr_file_open(&testlockfile, testlockfilename, APR_FOPEN_CREATE|APR_FOPEN_WRITE,
+ APR_OS_DEFAULT, ctx->pool) != APR_SUCCESS) {
+ ctx->set_error(ctx, GEOCACHE_DISK_ERROR, "failed to create test lockfile %s",testlockfilename);
+ return; /* we could not create the file */
+ }
+ apr_file_close(testlockfile);
+ apr_file_remove(testlockfilename,ctx->pool);
+#endif
}
- testlockfilename = apr_psprintf(ctx->pool,"%s/test.lock",config->lockdir);
- if(apr_file_open(&testlockfile, testlockfilename, APR_FOPEN_CREATE|APR_FOPEN_WRITE,
- APR_OS_DEFAULT, ctx->pool) != APR_SUCCESS) {
- ctx->set_error(ctx, GEOCACHE_DISK_ERROR, "failed to create test lockfile %s",testlockfilename);
- return; /* we could not create the file */
- }
- apr_file_close(testlockfile);
- apr_file_remove(testlockfilename,ctx->pool);
+
if(!config->services[GEOCACHE_SERVICE_WMS] &&
!config->services[GEOCACHE_SERVICE_TMS]) {
More information about the mapserver-commits
mailing list