aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/configuration.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-30 21:53:58 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-30 21:53:58 +0000
commit9795d6a9451c98ae9ea624d4513c3d9c28a78d1a (patch)
treecf45d7b1eb78bdb83a2d317c416d0b9059ead2fb /engine/lib/configuration.php
parentc27eac2d2a970e76a1204757bbe15da8efb2870c (diff)
downloadelgg-9795d6a9451c98ae9ea624d4513c3d9c28a78d1a.tar.gz
elgg-9795d6a9451c98ae9ea624d4513c3d9c28a78d1a.tar.bz2
ripped out last remaining tentacles of old installer from core - just needs removal of install.php when elgg_view() is updated
git-svn-id: http://code.elgg.org/elgg/trunk@7141 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/configuration.php')
-rw-r--r--engine/lib/configuration.php103
1 files changed, 62 insertions, 41 deletions
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index 27514a0ae..9b6386c05 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -18,6 +18,37 @@
*/
/**
+ * Check that installation has completed and the database is populated.
+ *
+ * @throws InstallationException
+ * @return void
+ */
+function verify_installation() {
+ global $CONFIG;
+
+ if (isset($CONFIG->installed)) {
+ return $CONFIG->installed;
+ }
+
+ try {
+ $dblink = get_db_link('read');
+ if (!$dblink) {
+ throw new DatabaseException();
+ }
+
+ mysql_query("SELECT value FROM {$CONFIG->dbprefix}datalists WHERE name = 'installed'", $dblink);
+ if (mysql_errno($dblink) > 0) {
+ throw new DatabaseException();
+ }
+
+ $CONFIG->installed = true;
+
+ } catch (DatabaseException $e) {
+ throw new InstallationException(elgg_echo('InstallationException:SiteNotInstalled'));
+ }
+}
+
+/**
* An array of key value pairs from the datalists table.
*
* Used as a cache in datalist functions.
@@ -40,12 +71,6 @@ $DATALIST_CACHE = array();
function datalist_get($name) {
global $CONFIG, $DATALIST_CACHE;
- // We need this, because sometimes datalists are attempted
- // to be retrieved before the database is created
- if (!is_db_installed()) {
- return false;
- }
-
$name = sanitise_string($name);
if (isset($DATALIST_CACHE[$name])) {
return $DATALIST_CACHE[$name];
@@ -351,43 +376,39 @@ function set_default_config() {
* @elgg_event boot system
* @return true|null
*/
-function configuration_init() {
+function configuration_boot() {
global $CONFIG;
- if (is_installed() || is_db_installed()) {
- $path = datalist_get('path');
- if (!empty($path)) {
- $CONFIG->path = $path;
- }
- $dataroot = datalist_get('dataroot');
- if (!empty($dataroot)) {
- $CONFIG->dataroot = $dataroot;
- }
- $simplecache_enabled = datalist_get('simplecache_enabled');
- if ($simplecache_enabled !== false) {
- $CONFIG->simplecache_enabled = $simplecache_enabled;
- } else {
- $CONFIG->simplecache_enabled = 1;
- }
- $viewpath_cache_enabled = datalist_get('viewpath_cache_enabled');
- if ($viewpath_cache_enabled !== false) {
- $CONFIG->viewpath_cache_enabled = $viewpath_cache_enabled;
- } else {
- $CONFIG->viewpath_cache_enabled = 1;
- }
- if (isset($CONFIG->site) && ($CONFIG->site instanceof ElggSite)) {
- $CONFIG->wwwroot = $CONFIG->site->url;
- $CONFIG->sitename = $CONFIG->site->name;
- $CONFIG->sitedescription = $CONFIG->site->description;
- $CONFIG->siteemail = $CONFIG->site->email;
- }
- $CONFIG->url = $CONFIG->wwwroot;
-
- // Load default settings from database
- get_all_config();
-
- return true;
+ $path = datalist_get('path');
+ if (!empty($path)) {
+ $CONFIG->path = $path;
+ }
+ $dataroot = datalist_get('dataroot');
+ if (!empty($dataroot)) {
+ $CONFIG->dataroot = $dataroot;
+ }
+ $simplecache_enabled = datalist_get('simplecache_enabled');
+ if ($simplecache_enabled !== false) {
+ $CONFIG->simplecache_enabled = $simplecache_enabled;
+ } else {
+ $CONFIG->simplecache_enabled = 1;
}
+ $viewpath_cache_enabled = datalist_get('viewpath_cache_enabled');
+ if ($viewpath_cache_enabled !== false) {
+ $CONFIG->viewpath_cache_enabled = $viewpath_cache_enabled;
+ } else {
+ $CONFIG->viewpath_cache_enabled = 1;
+ }
+ if (isset($CONFIG->site) && ($CONFIG->site instanceof ElggSite)) {
+ $CONFIG->wwwroot = $CONFIG->site->url;
+ $CONFIG->sitename = $CONFIG->site->name;
+ $CONFIG->sitedescription = $CONFIG->site->description;
+ $CONFIG->siteemail = $CONFIG->site->email;
+ }
+ $CONFIG->url = $CONFIG->wwwroot;
+
+ // Load default settings from database
+ get_all_config();
}
-register_elgg_event_handler('boot', 'system', 'configuration_init', 10); \ No newline at end of file
+register_elgg_event_handler('boot', 'system', 'configuration_boot', 10); \ No newline at end of file