adds generic method for getting the hostname
authorCornelius Weiß <mail@corneliusweiss.de>
Tue, 29 Apr 2014 13:13:03 +0000 (15:13 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 29 Apr 2014 13:13:36 +0000 (15:13 +0200)
- we may add an config entry for this later

Change-Id: I7029950563ead0efcfcf96604da0ed89e7aa9ab3
Reviewed-on: http://gerrit.tine20.com/customers/572
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/TestServer.php
tine20/Tinebase/Core.php

index ef6213c..cfcdd29 100644 (file)
@@ -64,6 +64,7 @@ class TestServer
         Zend_Registry::set('testConfig', $config);
 
         $_SERVER['DOCUMENT_ROOT'] = $config->docroot;
+        $_SERVER['REQUEST_URI'] = '';
 
         Tinebase_Core::initFramework();
 
index 372b493..951f9d8 100644 (file)
@@ -1592,6 +1592,23 @@ class Tinebase_Core
     }
     
     /**
+     * returns protocol + hostname
+     * 
+     * @return string
+     */
+    public static function getHostname()
+    {
+        $hostname = self::get('HOSTNAME');
+        if (! $hostname) {
+            $request = new Sabre\HTTP\Request();
+            $hostname = str_replace($request->getUri(), '', $request->getAbsoluteUri());
+            self::set('HOSTNAME', $hostname);
+        }
+        
+        return $hostname;
+    }
+    
+    /**
      * Singleton instance
      *
      * @return Zend_Scheduler