]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
ripped out last remaining tentacles of old installer from core - just needs removal...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 30 Oct 2010 21:53:58 +0000 (21:53 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 30 Oct 2010 21:53:58 +0000 (21:53 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7141 36083f99-b078-4883-b0ff-0f9b5a30f544

documentation/stubs/config.php
engine/lib/configuration.php
engine/lib/database.php
engine/lib/install.php
engine/lib/sessions.php
engine/lib/sites.php
engine/lib/version.php
engine/start.php

index 8a88fd85b972ffb404f0d16939aa4ed94a38b080..67aab304d00ecc141d7dab1b77849e1f0643de75 100644 (file)
@@ -176,11 +176,11 @@ $CONFIG->sitename;
 $CONFIG->language;
 
 /**
- * Is the database fully installed
+ * Is the site fully installed
  *
- * @global bool $CONFIG->db_installed
+ * @global bool $CONFIG->installed
  */
-$CONFIG->db_installed;
+$CONFIG->installed;
 
 /**
  * The guid of the current site object.
index 27514a0ae7db78c3bb634768737674872cafc26a..9b6386c050f218215bcab4d2b34073ef7422d37f 100644 (file)
  * @subpackage Configuration
  */
 
+/**
+ * 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.
  *
@@ -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
index 4b0a38bb3ef71f791e878ba3c5706f9f3c82a50e..16efb5874dac005387440a973f37539e48693527 100644 (file)
@@ -667,11 +667,6 @@ function run_sql_script($scriptlocation) {
 function db_upgrade($version, $fromdir = "", $quiet = FALSE) {
        global $CONFIG;
 
-       // Elgg and its database must be installed to upgrade it!
-       if (!is_db_installed() || !is_installed()) {
-               return false;
-       }
-
        $version = (int) $version;
 
        if (!$fromdir) {
index c47eedd40e856bc4c70a960af23b64e68ec03614..47ad47e39b228547f3761765070edff7ccd80fce 100644 (file)
@@ -8,55 +8,8 @@
  * @subpackage Installation
  */
 
-/**
- * Returns whether or not the database has been installed
- *
- * @return true|false Whether the database has been installed
- */
-function is_db_installed() {
-       global $CONFIG;
-
-       if (isset($CONFIG->db_installed)) {
-               return $CONFIG->db_installed;
-       }
-
-       if ($dblink = get_db_link('read')) {
-               mysql_query("select name from {$CONFIG->dbprefix}datalists limit 1", $dblink);
-               if (mysql_errno($dblink) > 0) {
-                       return false;
-               }
-       } else {
-               return false;
-       }
-
-       // Set flag if db is installed (if false then we want to check every time)
-       $CONFIG->db_installed = true;
-
-       return true;
-}
-
-/**
- * Returns whether or not other settings have been set
- *
- * @return true|false Whether or not the rest of the installation has been followed through with
- */
+// @todo - remove this internal function as soon as it is pulled from elgg_view()
 function is_installed() {
        global $CONFIG;
-       return datalist_get('installed');
-}
-
-/**
- * Check that installation has completed and the database is populated.
- *
- * @throws InstallationException
- * @return void
- */
-function verify_installation() {
-       $installed = FALSE;
-       try {
-               $installed = is_installed();
-       } catch (DatabaseException $e) {}
-       if (!$installed) {
-               throw new InstallationException(elgg_echo('InstallationException:SiteNotInstalled'));
-       }
-}
+       return $CONFIG->installed;
+}
\ No newline at end of file
index 8879043719732ef52a090c6ac577cafc4fbc0bf0..05258243fbb4af78adade2b04e5022a77ea5f68b 100644 (file)
@@ -51,9 +51,6 @@ function get_loggedin_userid() {
  * @return bool
  */
 function isloggedin() {
-       if (!is_installed()) {
-               return false;
-       }
 
        $user = get_loggedin_user();
 
@@ -71,9 +68,6 @@ function isloggedin() {
  * @return bool
  */
 function isadminloggedin() {
-       if (!is_installed()) {
-               return FALSE;
-       }
 
        $user = get_loggedin_user();
 
@@ -390,10 +384,6 @@ function logout() {
 function session_init($event, $object_type, $object) {
        global $DB_PREFIX, $CONFIG;
 
-       if (!is_db_installed()) {
-               return false;
-       }
-
        // Use database for sessions
        // HACK to allow access to prefix after object destruction
        $DB_PREFIX = $CONFIG->dbprefix;
index d5984a75fd4cad489f19d48d91d739c71f10acd8..960e54ee3bd35f82c83c7fbd4bdf4d653d481ab9 100644 (file)
@@ -409,27 +409,23 @@ function get_site_domain($guid) {
  *
  * @return true
  */
-function sites_init($event, $object_type, $object) {
+function sites_boot($event, $object_type, $object) {
        global $CONFIG;
 
-       if (is_installed() && is_db_installed()) {
-               $site = trigger_plugin_hook("siteid", "system");
-               if ($site === null || $site === false) {
-                       $CONFIG->site_id = (int) datalist_get('default_site');
-               } else {
-                       $CONFIG->site_id = $site;
-               }
-               $CONFIG->site_guid = $CONFIG->site_id;
-               $CONFIG->site = get_entity($CONFIG->site_guid);
-
-               return true;
+       $site = trigger_plugin_hook("siteid", "system");
+       if ($site === null || $site === false) {
+               $CONFIG->site_id = (int) datalist_get('default_site');
+       } else {
+               $CONFIG->site_id = $site;
        }
+       $CONFIG->site_guid = $CONFIG->site_id;
+       $CONFIG->site = get_entity($CONFIG->site_guid);
 
        return true;
 }
 
 // Register event handlers
-register_elgg_event_handler('boot', 'system', 'sites_init', 2);
+register_elgg_event_handler('boot', 'system', 'sites_boot', 2);
 
 // Register with unit test
 register_plugin_hook('unit_test', 'system', 'sites_test');
index c11707417fc3b20a8e1bcd6371b038fd136f7bf6..3e4e0e4f746f950782e81b7417ba4c1dc893336d 100644 (file)
 function upgrade_code($version, $quiet = FALSE) {
        global $CONFIG;
 
-       // Elgg and its database must be installed to upgrade it!
-       if (!is_db_installed() || !is_installed()) {
-               return FALSE;
-       }
-
        $version = (int) $version;
 
        if ($handle = opendir($CONFIG->path . 'engine/lib/upgrades/')) {
index 28f6aa56a70e9c87e3bb8d021203e34121beffaf..6dd227d42566600dce0cf3b028ae12aa15313a91 100644 (file)
@@ -8,7 +8,7 @@
  *     - {@elgg_event plugins_boot system}
  *     - {@elgg_event init system}
  *
- * If Elgg is uninstalled, the browser will be redirected to an
+ * If Elgg is fully uninstalled, the browser will be redirected to an
  * installation page.
  *
  * @see install.php