Ver Fonte

cfgutils: added more to docs for route exists functions

Daniel-Constantin Mierla há 9 anos atrás
pai
commit
472782d2f0
2 ficheiros alterados com 19 adições e 6 exclusões
  1. 9 3
      modules/cfgutils/README
  2. 10 3
      modules/cfgutils/doc/cfgutils_admin.xml

+ 9 - 3
modules/cfgutils/README

@@ -542,7 +542,8 @@ unlock("$rU");
 
 
 4.17. check_route_exists(route)
 4.17. check_route_exists(route)
 
 
-   Check if a route block exists
+   Check if a route block exists. It returns true (1) on found and false
+   on not found or error.
 
 
    Parameters:
    Parameters:
 
 
@@ -553,7 +554,7 @@ unlock("$rU");
 
 
    Example 1.21. check_route_exists() usage
    Example 1.21. check_route_exists() usage
 ...
 ...
-if(check_route_exists("FROGJUMP") {
+if(check_route_exists("JUMP") {
         $var(jumping_frogs) = 1;
         $var(jumping_frogs) = 1;
 };
 };
 ...
 ...
@@ -563,6 +564,9 @@ if(check_route_exists("FROGJUMP") {
    Execute a routing block only if it is defined. If it's not defined,
    Execute a routing block only if it is defined. If it's not defined,
    silently move to the next action in the configuration script.
    silently move to the next action in the configuration script.
 
 
+   It returns the code of last action in the route block, if that exists,
+   or false if the route doesn't exists or was an error executing it.
+
    Parameters:
    Parameters:
 
 
    "name" of a route block in the config file, like "route[FROGJUMP]"
    "name" of a route block in the config file, like "route[FROGJUMP]"
@@ -572,7 +576,9 @@ if(check_route_exists("FROGJUMP") {
 
 
    Example 1.22. route_if_exists() usage
    Example 1.22. route_if_exists() usage
 ...
 ...
-route_if_exists("PRESENCE_SANTA_CLAUS");
+if(route_if_exists("JUMP")) {
+    exit;
+}
 ...
 ...
 
 
 4.19. core_hash(string1, string2, size)
 4.19. core_hash(string1, string2, size)

+ 10 - 3
modules/cfgutils/doc/cfgutils_admin.xml

@@ -529,7 +529,8 @@ unlock("$rU");
 	<section id="cfgutils.f.check_route_exists">
 	<section id="cfgutils.f.check_route_exists">
 		<title><function moreinfo="none">check_route_exists(route)</function></title>
 		<title><function moreinfo="none">check_route_exists(route)</function></title>
 		<para>
 		<para>
-		Check if a route block exists
+		Check if a route block exists. It returns true (1) on found and false on
+		not found or error.
 		</para>
 		</para>
 		<para>Parameters:</para>
 		<para>Parameters:</para>
 		<para>
 		<para>
@@ -543,7 +544,7 @@ unlock("$rU");
 		<title><function moreinfo="none">check_route_exists()</function> usage</title>
 		<title><function moreinfo="none">check_route_exists()</function> usage</title>
 		<programlisting format="linespecific">
 		<programlisting format="linespecific">
 ...
 ...
-if(check_route_exists("FROGJUMP") {
+if(check_route_exists("JUMP") {
 	$var(jumping_frogs) = 1;
 	$var(jumping_frogs) = 1;
 };
 };
 ...
 ...
@@ -556,6 +557,10 @@ if(check_route_exists("FROGJUMP") {
 		Execute a routing block only if it is defined. If it's not defined, silently
 		Execute a routing block only if it is defined. If it's not defined, silently
 		move to the next action in the configuration script.
 		move to the next action in the configuration script.
 		</para>
 		</para>
+		<para>
+		It returns the code of last action in the route block, if that exists, or
+		false if the route doesn't exists or was an error executing it.
+		</para>
 		<para>Parameters:</para>
 		<para>Parameters:</para>
 		<para>
 		<para>
 		<quote>name</quote> of a route block in the config file, like <quote>route[FROGJUMP]</quote>
 		<quote>name</quote> of a route block in the config file, like <quote>route[FROGJUMP]</quote>
@@ -568,7 +573,9 @@ if(check_route_exists("FROGJUMP") {
 		<title><function moreinfo="none">route_if_exists()</function> usage</title>
 		<title><function moreinfo="none">route_if_exists()</function> usage</title>
 		<programlisting format="linespecific">
 		<programlisting format="linespecific">
 ...
 ...
-route_if_exists("PRESENCE_SANTA_CLAUS");
+if(route_if_exists("JUMP")) {
+    exit;
+}
 ...
 ...
 </programlisting>
 </programlisting>
 		</example>
 		</example>