]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
Also cache the admin.conf if use_session is set to 1 in config.php3
authorkkalev <kkalev>
Sun, 8 Sep 2002 11:27:32 +0000 (11:27 +0000)
committerkkalev <kkalev>
Sun, 8 Sep 2002 11:27:32 +0000 (11:27 +0000)
Changelog
conf/admin.conf
conf/config.php3

index d6bc1e0087548646f6b1f955d1674370c68de0b8..ce557c27f23a1355643172ab27a553d9f92ea81e 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ Ver 1.60:
 * Call config.php3 before outputing any html.
 * Add sessions in order to cache the various mappings. Add a corresponding configuration directive
   general_use_session. Also add a session cache destroy page.
+* Also cache the admin.conf if use_session is set to 1 in config.php3
 Ver 1.55:
 * Update the FAQ about missing attributes from the user/group edit pages and add a few comments
   in the configuration files
index d7473368091b5989898b13db5e987b021dbd526b..d6276f2afa15be273c42d38573a950802e56348b 100644 (file)
@@ -13,6 +13,8 @@ general_radiusd_base_dir: /usr/local/radiusd
 general_domain: company.com
 #
 # Set it to yes to use sessions and cache the various mappings
+# You can also set use_session = 1 in config.php3 to also cache
+# the admin.conf
 # This feature is considered experimantal for the moment
 general_use_session: no
 
index 1a2f34565d26e6d1e931f29839e7466c386068dc..1fc7124550876eb716701001b984cf546f8066d1 100644 (file)
@@ -1,17 +1,28 @@
 <?php
-$ARR=file("../conf/admin.conf");
-foreach($ARR as $val) {
-       $val=chop($val);
-       if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
-               continue;
-       list($key,$v)=split(":[[:space:]]*",$val,2);
-       if (preg_match("/%\{(.+)\}/",$v,$matches)){
-               $val=$config[$matches[1]];
-               $v=preg_replace("/%\{$matches[1]\}/",$val,$v);
+# If using sessions set use_session to 1 to also cache the config file
+#
+$use_session = 0;
+if ($use_session){
+       // Start session
+       @session_start();
+}
+if (!isset($config)){
+       $ARR=file("../conf/admin.conf");
+       foreach($ARR as $val) {
+               $val=chop($val);
+               if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
+                       continue;
+               list($key,$v)=split(":[[:space:]]*",$val,2);
+               if (preg_match("/%\{(.+)\}/",$v,$matches)){
+                       $val=$config[$matches[1]];
+                       $v=preg_replace("/%\{$matches[1]\}/",$val,$v);
+               }
+               $config["$key"]="$v";
        }
-       $config["$key"]="$v";
+       if ($use_session)
+               session_register('config');
 }
-if ($config[general_use_session] == 'yes'){
+if ($use_session == 0 && $config[general_use_session] == 'yes'){
        // Start session
        @session_start();
 }