From 0f2e67985d80ad91cd000e33d6e8a7751121d370 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 17 Jun 2008 16:49:21 +0000 Subject: 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 --- engine/lib/install.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'engine/lib/install.php') 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 -- cgit v1.2.3