aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/install.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-17 16:49:21 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-17 16:49:21 +0000
commit0f2e67985d80ad91cd000e33d6e8a7751121d370 (patch)
tree8833d61e09436b2d409f5238a8e65741dd720636 /engine/lib/install.php
parentd203a2e6f4bb69b9b33e157c130eab6408ebce89 (diff)
downloadelgg-0f2e67985d80ad91cd000e33d6e8a7751121d370.tar.gz
elgg-0f2e67985d80ad91cd000e33d6e8a7751121d370.tar.bz2
CLOSED - #34: Install process must be completely graphical
http://trac.elgg.org/elgg/ticket/34 git-svn-id: https://code.elgg.org/elgg/trunk@951 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/install.php')
-rw-r--r--engine/lib/install.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/lib/install.php b/engine/lib/install.php
index 16f000ee7..b348ab9b2 100644
--- a/engine/lib/install.php
+++ b/engine/lib/install.php
@@ -38,6 +38,29 @@
return datalist_get('installed');
}
+
+ /**
+ * Copy and create a new settings.php from settings.example.php, substituting the variables in
+ * $vars where appropriate.
+ *
+ * $vars is an associate array of $key => $value, where $key is the variable text you wish to substitute (eg
+ * CONFIG_DBNAME will replace {{CONFIG_DBNAME}} in the settings file.
+ *
+ * @param array $vars The array of vars
+ * @param string $in_file Optional input file (if not settings.example.php)
+ * @return string The file containing substitutions.
+ */
+ function create_settings(array $vars, $in_file="engine/settings.example.php")
+ {
+ $file = file_get_contents($in_file);
+
+ if (!$file) return false;
+
+ foreach ($vars as $k => $v)
+ $file = str_replace("{{".$k."}}", $v, $file);
+
+ return $file;
+ }
/**
* Initialisation for installation functions