check that the hostname is configured
authorChristian Weiske <cweiske@cweiske.de>
Tue, 4 Jan 2011 18:32:49 +0000 (19:32 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 4 Jan 2011 18:32:49 +0000 (19:32 +0100)
Wrt3g/Config.php

index 5036f7d0a2266e2f32d4e0b9f0beb8320cdef730..fc058edb4940bd551adb17bfbf2653db0c9f3fff 100644 (file)
@@ -102,6 +102,8 @@ class Wrt3g_Config
             2
         );
 
+        $this->verify();
+
         if (isset($options['save'])) {
             $this->save($file);
         }
@@ -201,6 +203,22 @@ class Wrt3g_Config
         $this->logger->log('Saving config into file ' . $file, 2);
         $cfg->writeConfig($file, 'inifile');
     }
+
+
+
+    /**
+     * Verifies that all required options are set
+     *
+     * @return void
+     *
+     * @throw Exception When something is missing
+     */
+    protected function verify()
+    {
+        if ($this->host == '') {
+            throw new Exception('Hostname missing');
+        }
+    }
 }
 
 ?>
\ No newline at end of file