No need the check the syntax of Apache’s configuration files more than once

It’s meaningless to check the syntax of Apache’s configuration files more than once during the same invocation of the startup script for Apache 2.2.x on FreeBSD, when the specified action is, say restart or graceful. Here’s a small patch.

--- apache22    26 Jan 2011 08:29:32 -0000      1.1
+++ apache22    26 Jan 2011 08:39:04 -0000      1.2
@@ -139,13 +139,17 @@

 apache22_checkconfig()
 {
-       if test -f ${apache22_envvars}
-       then
-               . ${apache22_envvars}
-       fi
+       if [ "${apache22_checkconfig_done}" != "apache22_checkconfig_done" ]; then
+               apache22_checkconfig_done="apache22_checkconfig_done";

-       echo "Performing sanity check on apache22 configuration:"
-       eval ${command} ${apache22_flags} -t
+               if test -f ${apache22_envvars};
+               then
+                       . ${apache22_envvars};
+               fi;
+
+               echo "Performing sanity check on apache22 configuration:";
+               eval ${command} ${apache22_flags} -t;
+       fi
 }

 apache22_graceful() {