From ca4b43c0c94936a2592cb8a86a0631e4cd26d7af Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 3 Mar 2008 13:22:57 +0000 Subject: Installation issues: fixed git-svn-id: https://code.elgg.org/elgg/trunk@57 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/configuration.php | 3 +++ engine/lib/database.php | 18 ++++++------------ engine/schema/mysql.sql | 2 +- engine/settings.example.php | 1 + engine/start.php | 13 +++++++++---- 5 files changed, 20 insertions(+), 17 deletions(-) (limited to 'engine') diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php index 66b36bf63..d60b7b8f3 100644 --- a/engine/lib/configuration.php +++ b/engine/lib/configuration.php @@ -39,6 +39,9 @@ $CONFIG->wwwroot .= str_replace($_SERVER['DOCUMENT_ROOT'],"",$CONFIG->path); } + if (empty($CONFIG->url)) + $CONFIG->url = $CONFIG->wwwroot; + if (empty($CONFIG->sitename)) $CONFIG->sitename = "New Elgg site"; diff --git a/engine/lib/database.php b/engine/lib/database.php index fab73025e..1d78ac310 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -264,11 +264,12 @@ $tables = array(); - if (is_array($result)) { + if (is_array($result) && !empty($result)) { foreach($result as $row) { - foreach($row as $element) { - $tables[] = $element; - } + if (is_array($row) && !empty($row)) + foreach($row as $element) { + $tables[] = $element; + } } } @@ -306,13 +307,6 @@ $statement = str_replace("prefix_",$CONFIG->dbprefix,$statement); if (!empty($statement)) { $result = update_data($statement); - if ($result == false) { - $error = mysql_error(); - $error = trim($error); - if (!empty($error)) { - $errors[] = $error; - } - } } } if (!empty($errors)) { @@ -340,6 +334,6 @@ // Stuff for initialisation - register_event_handler('init','system','init_db',0); + register_event_handler('boot','system','init_db',0); ?> \ No newline at end of file diff --git a/engine/schema/mysql.sql b/engine/schema/mysql.sql index 787a44e15..062541e63 100644 --- a/engine/schema/mysql.sql +++ b/engine/schema/mysql.sql @@ -194,5 +194,5 @@ CREATE TABLE `prefix_sites` ( PRIMARY KEY (`id`) ) ENGINE=MyISAM ; -INSERT INTO `prefix_elggnew`.`sites` (`id` ,`name` ,`domain`) VALUES +INSERT INTO `prefix_sites` (`id` ,`name` ,`domain`) VALUES (1 , 'New Elgg site', ''); diff --git a/engine/settings.example.php b/engine/settings.example.php index e45284685..47f43d05a 100644 --- a/engine/settings.example.php +++ b/engine/settings.example.php @@ -10,6 +10,7 @@ */ global $CONFIG; + $CONFIG = new stdClass; /* * Standard configuration diff --git a/engine/start.php b/engine/start.php index fd61dbd6a..1ed294a03 100644 --- a/engine/start.php +++ b/engine/start.php @@ -82,9 +82,6 @@ throw new InstallationException("Could not load {$file}"); } - // Autodetect some default configuration settings - set_default_config(); - // Load plugins load_plugins(); @@ -94,12 +91,20 @@ } + // Autodetect some default configuration settings + set_default_config(); + // Trigger events - trigger_event('init', 'system'); + trigger_event('boot', 'system'); // Forward if we haven't been installed if ((!is_installed() || !is_db_installed()) && !substr_count($_SERVER["PHP_SELF"],"install.php")) { forward("install.php"); } + + // Trigger events + if (!substr_count($_SERVER["PHP_SELF"],"install.php")) { + trigger_event('init', 'system'); + } ?> \ No newline at end of file -- cgit v1.2.3