Jeremy Newman : updating config to parse multiple config files

Jeremy Newman jnewman at winehq.org
Mon Dec 10 11:36:47 CST 2007


Module: website
Branch: master
Commit: 5ba1e596b973f71fb2184ab96cce41928d79a583
URL:    http://source.winehq.org/git/website.git/?a=commit;h=5ba1e596b973f71fb2184ab96cce41928d79a583

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Mon Dec 10 11:33:23 2007 -0600

updating config to parse multiple config files
moving global vars to seperate config file
rename winehq.conf to winehq.conf.sample
this will allow my local development version to have its own config file

---

 include/config.php         |   23 +++++++++++++++--------
 include/globals.conf       |    7 +++++++
 include/incl.php           |    2 +-
 include/winehq.conf.sample |   29 +++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 9 deletions(-)

diff --git a/include/config.php b/include/config.php
index 9d71ad9..c1c6d2e 100644
--- a/include/config.php
+++ b/include/config.php
@@ -11,17 +11,24 @@
  
 class config 
 { 
-    function config ($path = "")
+    function config ()
     {
-        // exit if config not found
-        if (!file_exists($path))
+        // get files passed
+        $files = func_get_args();
+    
+        // loop and parse files
+        foreach ($files as $path)
         {
-            echo 'config file not found!';
-            exit();
-        }
+            // exit if config not found
+            if (!file_exists($path))
+            {
+                echo 'config file not found!';
+                exit();
+            }
         
-        // read global config file
-        $this->readConfig($path);
+            // read global config file
+            $this->readConfig($path);
+        }
         
         // navigation
 	$this->nav = array(
diff --git a/include/globals.conf b/include/globals.conf
new file mode 100644
index 0000000..28029a8
--- /dev/null
+++ b/include/globals.conf
@@ -0,0 +1,7 @@
+# Website Global Vars File
+
+# Snapshot Date
+snapshot_date:  0.9.50
+
+# Current RH Packages Snapshot Date
+snapshot_date_rh:  0.9.2
diff --git a/include/incl.php b/include/incl.php
index 2782197..b63a085 100644
--- a/include/incl.php
+++ b/include/incl.php
@@ -14,7 +14,7 @@
 require($file_root."/include/"."config.php");
 
 // create config object
-$config = new config($file_root."/include/"."winehq.conf");
+$config = new config($file_root."/include/"."winehq.conf", $file_root."/include/"."globals.conf");
 
 // load global libs
 require($file_root."/include/"."html.php");
diff --git a/include/winehq.conf.sample b/include/winehq.conf.sample
new file mode 100644
index 0000000..5048496
--- /dev/null
+++ b/include/winehq.conf.sample
@@ -0,0 +1,29 @@
+# Website Configuration File
+
+# turns debug mode on/off
+debug:          0
+web_debug:      0
+
+# title of this site
+site_name:      Wine HQ
+
+# default theme
+theme:          winehq
+
+# default language
+lang:           en
+
+# available themes
+ at themes:        winehq
+
+# available languages
+ at languages:     en
+
+# base URL for website
+base_url:		http://www.winehq.org
+
+# Path to WWN XML files
+news_xml_path:   news
+
+# Path to WWN XML files
+wwn_xml_path:   wwn




More information about the wine-cvs mailing list