Skip to content

Commit

Permalink
RFC109: allow substitutions from env vars and in processing entries (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Feb 12, 2015
1 parent a4375e7 commit 65bce48
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -6756,6 +6756,7 @@ static void layerSubstituteString(layerObj *layer, const char *from, const char
/* The bindvalues are most useful when able to substitute values from the URL */
hashTableSubstituteString(&layer->bindvals, from, to);
hashTableSubstituteString(&layer->metadata, from, to);
msLayerSubstituteProcessing( layer, from, to );
for(c=0; c<layer->numclasses;c++) {
classSubstituteString(layer->class[c], from, to);
}
Expand Down Expand Up @@ -6873,6 +6874,10 @@ void msApplyDefaultSubstitutions(mapObj *map)
}

char *_get_param_value(const char *key, char **names, char **values, int npairs) {

if(getenv(key)) { /* envirronment override */
return getenv(key);
}
while(npairs) {
npairs--;
if(strcasecmp(key, names[npairs]) == 0) {
Expand Down
7 changes: 7 additions & 0 deletions maplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,13 @@ msLayerSetProcessingKey( layerObj *layer, const char *key, const char *value)
}
}

void msLayerSubstituteProcessing( layerObj *layer, const char *from, const char *to ) {
int i;
for( i = 0; i < layer->numprocessing; i++ ) {
layer->processing[i] = msCaseReplaceSubstring(layer->processing[i], from, to);
}
}

void msLayerAddProcessing( layerObj *layer, const char *directive )

{
Expand Down
1 change: 1 addition & 0 deletions mapserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -2381,6 +2381,7 @@ void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l, char
MS_DLL_EXPORT char *msLayerGetProcessing( layerObj *layer, int proc_index);
MS_DLL_EXPORT char *msLayerGetProcessingKey( layerObj *layer, const char *);
MS_DLL_EXPORT int msLayerClearProcessing( layerObj *layer );
MS_DLL_EXPORT void msLayerSubstituteProcessing( layerObj *layer, const char *from, const char *to );
MS_DLL_EXPORT char *msLayerGetFilterString( layerObj *layer );
MS_DLL_EXPORT int msLayerEncodeShapeAttributes( layerObj *layer, shapeObj *shape);

Expand Down
2 changes: 1 addition & 1 deletion msautotest
Submodule msautotest updated from 947c31 to 44fa17

0 comments on commit 65bce48

Please sign in to comment.