aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2011-06-18 23:18:13 +0200
committerLaurent Bachelier <laurent@bachelier.name>2011-06-18 23:18:48 +0200
commit11ac4e6eef6e41c4d23edb7b56415a1fb34f2057 (patch)
tree0eb3b9b1181e104b384723647321f502e241d3fa
parentThe Application determines the "web" path (diff)
downloadsymfttpd-11ac4e6eef6e41c4d23edb7b56415a1fb34f2057.tar.xz
The Application determines the genconf path
This allows for different rewrite rules by application.
-rw-r--r--lib/Application.php10
-rw-r--r--lib/Symfony1.php11
-rwxr-xr-xspawn6
3 files changed, 26 insertions, 1 deletions
diff --git a/lib/Application.php b/lib/Application.php
index 693bf6f..8c9bf96 100644
--- a/lib/Application.php
+++ b/lib/Application.php
@@ -19,4 +19,14 @@ abstract class Application
return $this->project_path;
}
+
+ /**
+ * Get the command to launch to get the rewriting rules.
+ * The PHP executable should be %PHP%, and be replaced at runtime.
+ *
+ * @return string Command
+ *
+ * @author Laurent Bachelier <laurent@bachelier.name>
+ */
+ abstract public function getGenconfCmd();
}
diff --git a/lib/Symfony1.php b/lib/Symfony1.php
index 006e720..75312bf 100644
--- a/lib/Symfony1.php
+++ b/lib/Symfony1.php
@@ -98,4 +98,15 @@ class Symfony1 extends Application
return $this->project_path.'/web';
}
+
+ /**
+ * @see Application::getGenconfCmd
+ *
+ * @author Laurent Bachelier <laurent@bachelier.name>
+ */
+ public function getGenconfCmd()
+ {
+
+ return '%PHP% '.escapeshellarg(realpath(dirname(__FILE__)).'/../genconf').' -p '.escapeshellarg($this->getWebPath());
+ }
}
diff --git a/spawn b/spawn
index 9f808a8..8a313d0 100755
--- a/spawn
+++ b/spawn
@@ -84,7 +84,11 @@ catch (ExecutableNotFoundError $e)
if ($options['genconf_cmd'] === false)
{
- $options['genconf_cmd'] = $options['php_cmd'].' '.escapeshellarg(realpath(dirname(__FILE__)).'/genconf').' -p '.escapeshellarg($application->getWebPath());
+ $options['genconf_cmd'] = str_replace(
+ '%PHP%',
+ $options['php_cmd'],
+ $application->getGenconfCmd()
+ );
}
Template::writeConfig($options);