Author: jablko
Date: 2008-10-07 17:56:47 -0700 (Tue, 07 Oct 2008)
New Revision: 1445

Modified:
   trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php
Log:
Factor code to set or unset no_script_name in settings.yml contents into a 
static function, which can be called from the hosting application.


Modified: trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php
===================================================================
--- trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php 2008-10-07 
23:49:25 UTC (rev 1444)
+++ trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php 2008-10-08 
00:56:47 UTC (rev 1445)
@@ -307,6 +307,23 @@
     return $htaccess;
   }
 
+  public static function setNoScriptName($noScriptName, $settingsYmlContents)
+  {
+    // TODO: Make this pattern more robust, or parse the YAML?
+    $pattern = '/^(prod:\v+  .settings:)(?:\v+    no_script_name:\h*[^\v]+)?/';
+
+    $replacement = '\1';
+    if ($noScriptName)
+    {
+      $replacement .= <<<EOF
+
+    no_script_name: true
+EOF;
+    }
+
+    return preg_replace($pattern, $replacement, $settingsYmlContents);
+  }
+
   public static function checkSettingsYml($noScriptName)
   {
     $settingsYml = array();
@@ -329,20 +346,8 @@
       }
     }
 
-    // TODO: Make this pattern more robust, or parse the YAML?
-    $pattern = '/^(prod:\v+  .settings:)(?:\v+    no_script_name:\h*[^\v]+)?/';
+    $settingsYmlContents = sfInstall::setNoScriptName($noScriptName, 
$settingsYmlContents);
 
-    $replacement = '\1';
-    if ($noScriptName)
-    {
-      $replacement .= <<<EOF
-
-    no_script_name: true
-EOF;
-    }
-
-    $settingsYmlContents = preg_replace($pattern, $replacement, 
$settingsYmlContents);
-
     if (false === file_put_contents($settingsYmlPath, $settingsYmlContents))
     {
       $settingsYml['notWritable'] = 'notWritable';


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to