diff --git a/platform/global_settings.tpl.php b/platform/global_settings.tpl.php
new file mode 100644
index 0000000..7a5e75d
--- /dev/null
+++ b/platform/global_settings.tpl.php
@@ -0,0 +1,2 @@
+<?php print '<?php '; ?>
+# global settings.php
diff --git a/platform/provision_drupal.drush.inc b/platform/provision_drupal.drush.inc
index 196d982..70acb7b 100644
--- a/platform/provision_drupal.drush.inc
+++ b/platform/provision_drupal.drush.inc
@@ -164,16 +164,6 @@ function _provision_drupal_site_installed($url) {
 }
 
 /**
- * The default template to use while generating config files.
- *
- * @return
- *   The default template for the config file
- */
-function _provision_drupal_default_template() {
-  return file_get_contents(dirname(__FILE__) .'/provision_drupal_settings.tpl.php');
-}
-
-/**
  * Generate a settings file for the site.
  *
  * @param url
@@ -183,27 +173,14 @@ function _provision_drupal_default_template() {
  *   because the modules might provide additional information about the site.
  */
 function _provision_drupal_create_settings_file($url = NULL) {
-  $options = drush_get_merged_options();
-
-  // As of Drupal 7 there is no more mysqli type
-  if (drush_drupal_major_version() >= 7) {
-    $options['db_type'] = ($options['db_type'] == 'mysqli') ? 'mysql' : $options['db_type'];
-  }
-
-  $options['extra_config'] = "# Extra configuration from modules:\n";
-  $options['extra_config'] .= join("\n", drush_command_invoke_all('provision_drupal_config', $url, $options));
-
-  drush_log(dt("Generate settings.php file"));
   if (provision_service('file')->exists('sites/' . $url . '/settings.php')->status()) {
     provision_service('file')->chmod('sites/' . $url . '/settings.php', 0640)
       ->succeed('Changed permissions of settings.php to @perm')
       ->fail('Could not change permissions of settings.php to @perm');
   }
 
-  $fp = provision_service('file')->path('fopen', 'sites/' . $url . '/settings.php', 'w');
-  $text =  _provision_drupal_default_template();
-  fwrite($fp, "<?php\n". provision_render_config($text, $options));
-  fclose($fp);
+  $config = new provisionConfig_drupal_settings(drush_get_merged_options());
+  $config->write();
 
   # Change the permissions of the file
   provision_service('file')->chmod('sites/' . $url . '/settings.php', 0440)
@@ -215,6 +192,24 @@ function _provision_drupal_create_settings_file($url = NULL) {
     ->fail('Could not change group ownership of settings.php to @gid');
 }
 
+class provisionConfig_drupal_settings extends provisionConfig {
+  public $template = 'provision_drupal_settings.tpl.php';
+  public $description = 'Drupal settings.php file';
+
+  function filename() {
+    return $this->data['sites_path'] . '/' . $this->data['site_url'] . '/settings.php';
+  }
+
+  function process() {
+    if (drush_drupal_major_version() >= 7) {
+      $this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type'];
+    }
+
+    $this->data['extra_config'] = "# Extra configuration from modules:\n";
+    $this->data['extra_config'] .= join("\n", drush_command_invoke_all('provision_drupal_config', $this->data['site_url'], $this->data));
+  }
+}
+
 /**
  * Create the directories needed to host a drupal site
  * 
diff --git a/platform/provision_drupal_settings.tpl.php b/platform/provision_drupal_settings.tpl.php
index ff1b449..8122b09 100644
--- a/platform/provision_drupal_settings.tpl.php
+++ b/platform/provision_drupal_settings.tpl.php
@@ -1,3 +1,4 @@
+<?php print '<?php' ?>
   /**
    * The database credentials are stored in the Apache vhost config
    * of the associated site with SetEnv parameters.
diff --git a/platform/verify.provision.inc b/platform/verify.provision.inc
index 0b3f79e..b019392 100644
--- a/platform/verify.provision.inc
+++ b/platform/verify.provision.inc
@@ -28,14 +28,10 @@ function drush_provision_drupal_provision_verify($url = null) {
     provision_service('file')->create_dir(drush_get_option('config_path'), dt('Provision configuration'), 0711);
     provision_service('file')->create_dir(drush_get_option('config_path') . '/includes', dt('Provision PHP configuration'), 0711);
     if (!provision_service('file')->exists(drush_get_option('config_path') . '/includes/global.inc')->succeed('Global configuration file exists')->status()) {
-      # create an empty global.inc so the include doesn't fail with
-      # open_basedir restrictions
-      if (!$file = provision_service('file')->path('fopen', drush_get_option('config_path') .  '/includes/global.inc', 'a')) {
-        drush_set_error('PROVISION_FRAMEWORK_ERROR', dt('Cannot create global settings configuration'));
-      } else {
-        fwrite($file, "<?php # global settings.php");
-        fclose($file);
-      }
+      // Create an empty global.inc so the include doesn't fail with
+      // open_basedir restrictions
+      $config = new provisionConfig_global_settings(drush_get_merged_options());
+      $config->write();
     }
     provision_service('file')->create_dir(drush_get_option('backup_path'), dt('Backup'), 0700);
     provision_service('file')->writable(drush_get_option('sites_path'))
@@ -57,6 +53,17 @@ function drush_provision_drupal_provision_verify($url = null) {
   }
 }
 
+class provisionConfig_global_settings extends provisionConfig {
+  public $template = 'global_settings.tpl.php';
+  public $description = 'Global settings.php file';
+
+  function filename() {
+    return $this->data['config_path'] . '/includes/global.inc';
+  }
+
+  function process() {
+  }
+}
 
 /**
  * Implementation of hook_provision_post_verify
diff --git a/provision.inc b/provision.inc
index 6ec6c75..58e9645 100644
--- a/provision.inc
+++ b/provision.inc
@@ -135,43 +135,6 @@ function provision_save_platform_data() {
 }
 
 /**
- * @defgroup provisionvalues Value replacement support for the provisioning framework
- * @{
- */
-
-/**
- * Generate the text for a config file using php
- */
-function provision_render_config($template, $variables) {
-  drush_errors_off();
-  extract($variables, EXTR_SKIP);  // Extract the variables to a local namespace
-  ob_start();                      // Start output buffering
-  eval('?'.'>' . $template);                 // Generate content
-  $contents = ob_get_contents();   // Get the contents of the buffer
-  ob_end_clean();                  // End buffering and discard
-  drush_errors_on();
-  return $contents;                // Return the contents
-}
-
-/**
- * Write a config based on a template
- *
- * @see provision_render_config()
- */
-function provision_write_config($drush_option, $file, $template, $data) {
-  $file = provision_service('file')->path('fopen', drush_get_option($drush_option) . '/' . $file, 'w');
-  $text = provision_render_config($template, $data);
-  fwrite($file, $text);
-  fclose($file);
-}
-
-
-/**
- * @} End of "defgroup provisionvalues".
- */
-
-
-/**
  * Remove files or directories, recursively
  *
  * This was taken from imagecache.module, with slight modifications:
diff --git a/ssl/provision_ssl.drush.inc b/ssl/provision_ssl.drush.inc
index ee977f0..3766a94 100644
--- a/ssl/provision_ssl.drush.inc
+++ b/ssl/provision_ssl.drush.inc
@@ -24,14 +24,8 @@ function provision_ssl_provision_apache_vhost_config($url, $options) {
     if ($options['ssl_redirect']) {
       // That's pretty bad, but if we *don't* do that, the vhost is never updated after the first write
       // XXX: we need a better way to identify if this is legit
-      if (provision_service('file')->exists(drush_get_option('vhost_path') . '/' . $url . '_80')->status()) {
-        drush_log(dt('Overwriting existing vhost %url:80 with redirection', array('%url' => $url)), 'warning');
-      }
-      $newoptions = $options;
-      // in the redirection template, the ServerName is the first alias in the list
-      array_push($newoptions['aliases'], $options['site_url']);
-      $newoptions['site_port'] = 80;
-      provision_write_config('vhost_path', $url . '_80', _provision_apache_redirect_template(), $newoptions);
+      $config = new provisionConfig_ssl_vhost(drush_get_merged_options());
+      $config->write();
     }
     return array("php_value session.cookie_secure 1", "SSLEngine On");
   } else {
@@ -39,6 +33,20 @@ function provision_ssl_provision_apache_vhost_config($url, $options) {
   }
 }
 
+class provisionConfig_ssl_vhost extends provisionConfig {
+  public $template = '../http/apache/vhost_redirect.tpl.php';
+  public $description = 'Redirect for SSL';
+
+  function filename() {
+    return $this->data['vhost_path'] . '/' . $this->data['site_url'] . '_80';
+  }
+
+  function process() {
+    array_push($this->data['aliases'], $this->data['site_url']);
+    $this->data['site_port'] = 80;
+  }
+}
+
 /**
  * Implementation of hook_provision_apache_delete_vhost()
  *
