Skip to content

Commit

Permalink
Merge branch '6.1' into 6.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	loader/build.xml
#	loader/pom.xml
  • Loading branch information
michaeloffner committed Nov 21, 2024
2 parents 450176e + aee2e46 commit 35915ab
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 14 deletions.
68 changes: 62 additions & 6 deletions core/src/main/java/lucee/runtime/config/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,13 @@ else if (old instanceof InputSource) {

//////////////////// caches ////////////////////
{
Struct cache = ConfigWebUtil.getAsStruct("cache", root);
Struct caches = ConfigWebUtil.getAsStruct("caches", root);
Array conns = ConfigWebUtil.getAsArray("connection", cache);
Array acache = ConfigWebUtil.getAsArray("cache", caches);

add(acache, "cacheClasses", root);

// classes
move("cache", "cacheClasses", caches, root);
Struct cache = ConfigWebUtil.getAsStruct("cache", root);
Array conns = ConfigWebUtil.getAsArray("connection", cache);

// defaults
for (String type: ConfigPro.STRING_CACHE_TYPES_MAX) {
Expand Down Expand Up @@ -398,8 +399,35 @@ else if (old instanceof InputSource) {
moveAsBool("useShadow", "componentUseVariablesScope", component, root);

// mappings
Array ctMappings = ConfigWebUtil.getAsArray("mapping", component);
add(ctMappings, "componentMappings", root);
Array comMappings = ConfigWebUtil.getAsArray("mapping", component);
add(comMappings, "componentMappings", root);

// remove and add default mappings
Array arr = Caster.toArray(root.get("componentMappings", null), null);
Struct sct = null;
String v;
boolean hasDefault = false;
if (arr != null && arr.size() > 0) {
arr.size();
for (int i = arr.size(); i > 0; i--) {
sct = Caster.toStruct(arr.get(i, null), null);
if (sct != null) {
v = Caster.toString(sct.get("physical", null), null);
if ("{lucee-web}/components/".equals(v) || "{lucee-server}/components/".equals(v)) arr.removeEL(i);
else if ("{lucee-config}/components/".equals(v)) hasDefault = true;
}
}
}
if (!hasDefault) {
sct = new StructImpl();
sct.setEL("inspectTemplate", "never");
sct.setEL("physical", "{lucee-config}/components/");
try {
arr.insert(1, sct);
}
catch (PageException e) {
}
}
rem("mapping", component);
}

Expand All @@ -416,6 +444,34 @@ else if (old instanceof InputSource) {
move("customTagExtensions", "customTagExtensions", ct, root);
Array ctMappings = ConfigWebUtil.getAsArray("mapping", ct);
add(ctMappings, "customTagMappings", root);

// remove and add default mappings
Array arr = Caster.toArray(root.get("customTagMappings", null), null);
Struct sct = null;
String v;
boolean hasDefault = false;
if (arr != null && arr.size() > 0) {
arr.size();
for (int i = arr.size(); i > 0; i--) {
sct = Caster.toStruct(arr.get(i, null), null);
if (sct != null) {
v = Caster.toString(sct.get("physical", null), null);
if ("{lucee-web}/customtags/".equals(v) || "{lucee-server}/customtags/".equals(v)) arr.removeEL(i);
else if ("{lucee-config}/customtags/".equals(v)) hasDefault = true;
}
}
}
if (!hasDefault) {
sct = new StructImpl();
sct.setEL("inspectTemplate", "never");
sct.setEL("physical", "{lucee-config}/customtags/");
try {
arr.insert(1, sct);
}
catch (PageException e) {
}
}

rem("mapping", ct);
}

Expand Down
20 changes: 20 additions & 0 deletions core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2966,6 +2966,7 @@ else if (hasCS) {
boolean hasSet = false;
Mapping[] mappings = null;
if (hasAccess) {
boolean hasDefault = false;
if (ctMappings.size() > 0) {
Iterator<Object> it = ctMappings.valueIterator();
List<Mapping> list = new ArrayList<>();
Expand All @@ -2980,6 +2981,9 @@ else if (hasCS) {
String archive = getAttr(ctMapping, "archive");
boolean readonly = toBoolean(getAttr(ctMapping, "readonly"), false);
boolean hidden = toBoolean(getAttr(ctMapping, "hidden"), false);
if ("{lucee-web}/customtags/".equals(physical) || "{lucee-server}/customtags/".equals(physical)) continue;
if ("{lucee-config}/customtags/".equals(physical)) hasDefault = true;

short inspTemp = inspectTemplate(ctMapping);
int insTempSlow = Caster.toIntValue(getAttr(ctMapping, "inspectTemplateIntervalSlow"), -1);
int insTempFast = Caster.toIntValue(getAttr(ctMapping, "inspectTemplateIntervalFast"), -1);
Expand All @@ -2996,6 +3000,11 @@ else if (hasCS) {
log(config, log, t);
}
}
if (!hasDefault) {
list.add(new MappingImpl(config, "/default", "{lucee-config}/customtags/", null, ConfigPro.INSPECT_NEVER, -1, -1, true, false, true, true, false, true,
null, -1, -1));
}

mappings = list.toArray(new Mapping[list.size()]);
config.setCustomTagMappings(mappings);
}
Expand Down Expand Up @@ -5312,11 +5321,15 @@ else if (configServer != null) {

}

// sct.setEL("inspectTemplate", "never");
// sct.setEL("physical", "{lucee-config}/components/");

// Web Mapping
Array compMappings = ConfigWebUtil.getAsArray("componentMappings", root);
hasSet = false;
Mapping[] mappings = null;
if (hasAccess) {
boolean hasDefault = false;
if (compMappings.size() > 0) {
Iterator<Object> it = compMappings.valueIterator();
List<Mapping> list = new ArrayList<>();
Expand All @@ -5331,6 +5344,8 @@ else if (configServer != null) {
String archive = getAttr(cMapping, "archive");
boolean readonly = toBoolean(getAttr(cMapping, "readonly"), false);
boolean hidden = toBoolean(getAttr(cMapping, "hidden"), false);
if ("{lucee-web}/components/".equals(physical) || "{lucee-server}/components/".equals(physical)) continue;
if ("{lucee-config}/components/".equals(physical)) hasDefault = true;

String strListMode = getAttr(cMapping, "listenerMode");
if (StringUtil.isEmpty(strListMode)) strListMode = getAttr(cMapping, "listener-mode");
Expand Down Expand Up @@ -5358,6 +5373,11 @@ else if (configServer != null) {
log(config, log, t);
}
}
if (!hasDefault) {
list.add(new MappingImpl(config, "/default", "{lucee-config}/components/", null, ConfigPro.INSPECT_NEVER, -1, -1, true, false, true, true, false, true,
null, -1, -1));
}

mappings = list.toArray(new Mapping[list.size()]);
config.setComponentMappings(mappings);
}
Expand Down
19 changes: 13 additions & 6 deletions core/src/main/java/resource/fld/core-base.fld
Original file line number Diff line number Diff line change
Expand Up @@ -7012,16 +7012,23 @@ Use the GetBaseTemplatePath() function instead.</description>
<name>getTickCount</name>
<class>lucee.runtime.functions.other.GetTickCount</class>
<tte-class>lucee.transformer.cfml.evaluator.func.impl.GetTickCount</tte-class>
<description>Returns the number of milliseconds since the start of the application server</description>
<description>
Returns the elapsed time from a specific reference point, based on the specified `unit`.
The default unit, "milli," represents milliseconds since midnight, January 1, 1970 UTC, and aligns with conventional system time.
The "nano" and "micro" units offer high-resolution timing based on the Java Virtual Machine's internal clock, ideal for measuring elapsed time rather than absolute wall-clock time.
These values are not tied to real-world dates but provide a consistent point of origin within the Java Virtual Machine for accurate time intervals.
This function is well-suited for performance testing, such as timing code execution, by capturing precise intervals.</description>
<argument>
<name>unit</name>
<type>string</type>
<required>No</required>
<description>base unit for the function, valid values are:
- nano: nano seconds
- milli (default): milli seconds
- second: seconds</description>
</argument>
<description>Specifies the unit of time for the returned value. Valid options include:
- **nano**: nanoseconds, representing elapsed time from an arbitrary fixed origin, with high precision for timing purposes.
- **micro**: microseconds, derived from nanoseconds (dividing by 1,000), also measuring elapsed time with high precision.
- **milli** (default): milliseconds, representing the difference between the current time and midnight, January 1, 1970 UTC.
- **second**: seconds, representing elapsed time from the same reference point as milliseconds.</description>

</argument>
<return>
<type>number</type>
</return>
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.164-RC"/>
<property name="version" value="6.2.0.165-RC"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.164-RC</version>
<version>6.2.0.165-RC</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 35915ab

Please sign in to comment.