From 245cb11c5855d023d9bd4f7e693f0eafaeb7deb7 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 18 Jan 2009 03:12:00 +0000 Subject: Clean up the var directory creation script --- core/controllers/welcome.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'core/controllers') diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 876e48f9..d91bf0f1 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -492,22 +492,33 @@ class Welcome_Controller extends Template_Controller { } $var_dir = dir(VARPATH); - $init_g3 = array("read()) { if ($entry == "." || $entry == "..") { continue; } - if (is_dir(VARPATH . $entry)) { - $init_g3[] = " if (!@mkdir(\"$entry\");) {"; - $init_g3[] = " throw new Exception(\"Unable to create directory '$entry'\");"; - $init_g3[] = " }"; + if (is_dir(VARPATH . $entry) & $entry != "g3_installer") { + $sub_dirs[] = "\"$entry\""; } - } - $init_g3[] = "}"; + } $var_dir->close(); + + $init_g3 = array_merge($init_g3, array( + "foreach (array(" . implode(", ", $sub_dirs) . ") as \$dir) {", + " if (!@mkdir(\$dir)) {", + " throw new Exception(\"Unable to create directory '\$dir'\");", + " }", + "}")); $install_data = VARPATH . "g3_installer/"; if (!file_exists($install_data)) { -- cgit v1.2.3