[icinga-checkins] icinga.org: icingaweb2/master: CLI/Webserver Setup: Rename webPath to urlPath

git at icinga.org git at icinga.org
Thu Nov 13 15:10:34 CET 2014


Module: icingaweb2
Branch: master
Commit: 7c8e9e6f5649c71912b3d5af555dcbbbc37d09b4
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=7c8e9e6f5649c71912b3d5af555dcbbbc37d09b4

Author: Eric Lippmann <eric.lippmann at netways.de>
Date:   Thu Nov 13 14:18:14 2014 +0100

CLI/Webserver Setup: Rename webPath to urlPath

This is how the apache docs call it. Nginx speaks of uri.

refs #6120

---

 .../setup/application/clicommands/ConfigCommand.php    |    6 +++---
 modules/setup/library/Setup/Webserver.php              |   16 ++++++++--------
 modules/setup/library/Setup/Webserver/Apache.php       |    4 ++--
 modules/setup/library/Setup/Webserver/Nginx.php        |    6 +++---
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/setup/application/clicommands/ConfigCommand.php b/modules/setup/application/clicommands/ConfigCommand.php
index 660207d..6765725 100644
--- a/modules/setup/application/clicommands/ConfigCommand.php
+++ b/modules/setup/application/clicommands/ConfigCommand.php
@@ -102,8 +102,8 @@ class ConfigCommand extends Command
         } catch (ProgrammingError $e) {
             $this->fail($this->translate('Unknown type') . ': ' . $type);
         }
-        $path = $this->params->get('path', $webserver->getWebPath());
-        if (! is_string($path) || strlen(trim($path)) === 0) {
+        $urlPath = $this->params->get('path', $webserver->getUrlPath());
+        if (! is_string($urlPath) || strlen(trim($urlPath)) === 0) {
             $this->fail($this->translate('The argument --path expects a URL path'));
         }
         $documentRoot = $this->params->get('root', $this->params->get('document-root', $webserver->getDocumentRoot()));
@@ -121,7 +121,7 @@ class ConfigCommand extends Command
         $webserver
             ->setDocumentRoot($documentRoot)
             ->setConfigDir($configDir)
-            ->setWebPath($path);
+            ->setUrlPath($urlPath);
         $config = $webserver->generate() . "\n";
         if (($file = $this->params->get('file')) !== null) {
             if (file_exists($file) === true) {
diff --git a/modules/setup/library/Setup/Webserver.php b/modules/setup/library/Setup/Webserver.php
index 40951f6..2449f9b 100644
--- a/modules/setup/library/Setup/Webserver.php
+++ b/modules/setup/library/Setup/Webserver.php
@@ -20,11 +20,11 @@ abstract class Webserver
     protected $documentRoot;
 
     /**
-     * Web path
+     * URL path of Icinga Web 2
      *
      * @var string
      */
-    protected $webPath = '/icingaweb';
+    protected $urlPath = '/icingaweb';
 
     /**
      * Path to Icinga Web 2's configuration files
@@ -61,12 +61,12 @@ abstract class Webserver
         $template = $this->getTemplate();
 
         $searchTokens = array(
-            '{webPath}',
+            '{urlPath}',
             '{documentRoot}',
             '{configDir}',
         );
         $replaceTokens = array(
-            $this->getWebPath(),
+            $this->getUrlPath(),
             $this->getDocumentRoot(),
             $this->getConfigDir()
         );
@@ -88,9 +88,9 @@ abstract class Webserver
      *
      * @return  $this
      */
-    public function setWebPath($urlPath)
+    public function setUrlPath($urlPath)
     {
-        $this->webPath = '/' . ltrim(trim((string) $urlPath), '/');
+        $this->urlPath = '/' . ltrim(trim((string) $urlPath), '/');
         return $this;
     }
 
@@ -99,9 +99,9 @@ abstract class Webserver
      *
      * @return string
      */
-    public function getWebPath()
+    public function getUrlPath()
     {
-        return $this->webPath;
+        return $this->urlPath;
     }
 
     /**
diff --git a/modules/setup/library/Setup/Webserver/Apache.php b/modules/setup/library/Setup/Webserver/Apache.php
index f35c695..79d81eb 100644
--- a/modules/setup/library/Setup/Webserver/Apache.php
+++ b/modules/setup/library/Setup/Webserver/Apache.php
@@ -17,7 +17,7 @@ class Apache extends Webserver
     protected function getTemplate()
     {
             return  <<<'EOD'
-Alias {webPath} "{documentRoot}"
+Alias {urlPath} "{documentRoot}"
 
 <Directory "{documentRoot}">
     Options SymLinksIfOwnerMatch
@@ -42,7 +42,7 @@ Alias {webPath} "{documentRoot}"
 
     <IfModule mod_rewrite.c>
         RewriteEngine on
-        RewriteBase {webPath}/
+        RewriteBase {urlPath}/
         RewriteCond %{REQUEST_FILENAME} -s [OR]
         RewriteCond %{REQUEST_FILENAME} -l [OR]
         RewriteCond %{REQUEST_FILENAME} -d
diff --git a/modules/setup/library/Setup/Webserver/Nginx.php b/modules/setup/library/Setup/Webserver/Nginx.php
index 3364561..fd5e92d 100644
--- a/modules/setup/library/Setup/Webserver/Nginx.php
+++ b/modules/setup/library/Setup/Webserver/Nginx.php
@@ -19,7 +19,7 @@ class Nginx extends Webserver
     protected function getTemplate()
     {
         return <<<'EOD'
-location ~ ^{webPath}/index\.php(.*)$ {
+location ~ ^{urlPath}/index\.php(.*)$ {
   # fastcgi_pass 127.0.0.1:9000;
   fastcgi_pass unix:/var/run/php5-fpm.sock;
   fastcgi_index index.php;
@@ -28,10 +28,10 @@ location ~ ^{webPath}/index\.php(.*)$ {
   fastcgi_param ICINGAWEB_CONFIGDIR {configDir};
 }
 
-location ~ ^{webPath}(.+)? {
+location ~ ^{urlPath}(.+)? {
   alias {documentRoot};
   index index.php;
-  try_files $1 $uri $uri/ {webPath}/index.php$is_args$args;
+  try_files $1 $uri $uri/ {urlPath}/index.php$is_args$args;
 }
 EOD;
     }



More information about the icinga-checkins mailing list