]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
removed several parts of the old installer from the core
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 6 Oct 2010 11:21:47 +0000 (11:21 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 6 Oct 2010 11:21:47 +0000 (11:21 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7021 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/systemsettings/install.php [deleted file]
engine/lib/actions.php
engine/lib/elgglib.php
engine/lib/install.php
engine/start.php
install/languages/en.php
languages/en.php
views/default/settings/install.php [deleted file]

diff --git a/actions/systemsettings/install.php b/actions/systemsettings/install.php
deleted file mode 100644 (file)
index 6f3b75a..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-/**
- * Elgg install site action
- *
- * Creates a new site and sets it as the default
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- */
-
-global $CONFIG;
-define('INSTALLING', TRUE);
-
-// Set failsafe again in case we get an exception thrown
-elgg_set_viewtype('failsafe');
-
-if (is_installed()) {
-       forward();
-}
-
-if (get_input('settings') == 'go') {
-       if (!datalist_get('default_site')) {
-               // Sanitise
-               $path = sanitise_filepath(get_input('path'));
-               $dataroot = sanitise_filepath(get_input('dataroot'));
-               $url = sanitise_filepath(get_input('wwwroot'));
-
-               // Blank?
-               if ($dataroot == "/") {
-                       throw new InstallationException(elgg_echo('InstallationException:DatarootBlank'));
-               }
-
-               // That it's valid
-               if (stripos($dataroot, $path)!==false) {
-                       throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootUnderPath'), $dataroot));
-               }
-
-               // Check data root is writable
-               if (!is_writable($dataroot)) {
-                       throw new InstallationException(sprintf(elgg_echo('InstallationException:DatarootNotWritable'), $dataroot));
-               }
-
-               $site = new ElggSite();
-               $site->name = get_input('sitename');
-               $site->url = $url;
-               $site->description = get_input('sitedescription');
-               $site->access_id = ACCESS_PUBLIC;
-               $guid = $site->save();
-
-               if (!$guid) {
-                       throw new InstallationException(sprintf(elgg_echo('InstallationException:CantCreateSite'), get_input('sitename'), get_input('wwwroot')));
-               }
-
-               $site->email = get_input('siteemail');
-
-               // this is needed to grab plugins
-               $CONFIG->site_guid = $guid;
-               $CONFIG->site = $site;
-
-               datalist_set('installed',time());
-               datalist_set('path', $path);
-               datalist_set('dataroot', $dataroot);
-               datalist_set('default_site', $site->getGUID());
-               datalist_set('version', get_version());
-
-               set_config('view', get_input('view'), $site->getGUID());
-               set_config('language', get_input('language'), $site->getGUID());
-               set_config('default_access', get_input('default_access'), $site->getGUID());
-               set_config('allow_registration', TRUE, $site->getGUID());
-               set_config('walled_garden', FALSE, $site->getGUID());
-
-               $debug = get_input('debug');
-               if ($debug) {
-                       set_config('debug', $debug, $site->getGUID());
-               } else {
-                       unset_config('debug', $site->getGUID());
-               }
-
-               $api = get_input('api');
-               if ($api) {
-                       unset_config('disable_api', $site->getGUID());
-               } else {
-                       set_config('disable_api', 'disabled', $site->getGUID());
-               }
-
-               $https_login = get_input('https_login');
-               if ($https_login) {
-                       set_config('https_login', 1, $site->getGUID());
-               } else {
-                       unset_config('https_login', $site->getGUID());
-               }
-
-               // activate some plugins by default
-               if (isset($CONFIG->default_plugins)) {
-                       if (!is_array($CONFIG->default_plugins)) {
-                               $plugins = explode(',', $CONFIG->default_plugins);
-                       } else {
-                               $CONFIG->default_plugins = $CONFIG->default_plugins;
-                       }
-
-                       foreach ($plugins as $plugin){
-                               enable_plugin(trim($plugin), $site->getGUID());
-                       }
-               } else {
-                       // activate plugins with manifest.xml: elgg_install_state = enabled
-                       $plugins = get_plugin_list();
-                       foreach ($plugins as $plugin) {
-                               if ($manifest = load_plugin_manifest($plugin)) {
-                                       if (isset($manifest['elgg_install_state']) && $manifest['elgg_install_state'] == 'enabled') {
-                                               enable_plugin($plugin);
-                                       }
-                               }
-                       }
-               }
-
-               // reset the views path in case of installing over an old data dir.
-               $dataroot = datalist_get('dataroot');
-               $cache = new ElggFileCache($dataroot);
-               $cache->delete('view_paths');
-
-               system_message(elgg_echo("installation:configuration:success"));
-
-               header("Location: ../../pg/register");
-               exit;
-       }
-}
index 6b29679640e6be0f009c41b52e7a8bc2b84fe7fb..d164b14d6c59089052730063ee84cc6dcfb170e8 100644 (file)
@@ -60,12 +60,9 @@ function action($action, $forwarder = "") {
        // @todo REMOVE THESE ONCE #1509 IS IN PLACE.
        // Allow users to disable plugins without a token in order to
        // remove plugins that are incompatible.
-       // Installation cannot use tokens because it requires site secret to be
-       // working. (#1462)
        // Login and logout are for convenience.
        // file/download (see #2010)
        $exceptions = array(
-               'systemsettings/install',
                'admin/plugins/disable',
                'logout',
                'login',
index c00a88e845cc6bae8e1b397259bdbbab3c968972..16e20ef7c9b44a0aeeb563b75d841f718db89e0e 100644 (file)
@@ -583,73 +583,6 @@ function elgg_get_file_list($directory, $exceptions = array(), $list = array(),
        return $list;
 }
 
-/**
- * Checks that Elgg has been installed and attempts to complete installation if not.
- *
- * This is called by {@link engine/start.php} immediately after Elgg libraries are loaded
- * to check the installation state.
- *
- * Elgg's installation state is determined by (1) the existence of the engine/settings.php
- * file, (2) a .htaccess file, and (3) a populated database.  This function checks
- * for 1 and 2, while 3 is checked by {@link is_installed()} and {@link is_db_installed()}.
- *
- * If settings.php doesn't exist and $_REQUEST['db_install_vars'] is present,
- * this function attempts to write the values from 'db_install_vars' to settings.php.
- *
- * If .htaccess doens't exist this function attempts to copy htaccess_dist to .htaccess.
- *
- * If there are any problems, this function calls {@link register_error()} and returns FALSE.
- * Since this function is called during bootstrapping, the viewtype is failsafe.
- * Returning FALSE results in an InstallationException, which halts execution.
- *
- * @return bool
- */
-function sanitised() {
-       $sanitised = true;
-
-       if (!file_exists(dirname(dirname(__FILE__)) . "/settings.php")) {
-               // See if we are being asked to save the file
-               $save_vars = get_input('db_install_vars');
-               $result = "";
-               if ($save_vars) {
-                       $rtn = db_check_settings($save_vars['CONFIG_DBUSER'],
-                                                                       $save_vars['CONFIG_DBPASS'],
-                                                                       $save_vars['CONFIG_DBNAME'],
-                                                                       $save_vars['CONFIG_DBHOST'] );
-                       if ($rtn == FALSE) {
-                               register_error(elgg_view("messages/sanitisation/dbsettings_error"));
-                               register_error(elgg_view("messages/sanitisation/settings",
-                                                               array(  'settings.php' => $result,
-                                                                               'sticky' => $save_vars)));
-                               return FALSE;
-                       }
-
-                       $result = create_settings($save_vars, dirname(dirname(__FILE__)) . "/settings.example.php");
-
-
-                       if (file_put_contents(dirname(dirname(__FILE__)) . "/settings.php", $result)) {
-                               // blank result to stop it being displayed in textarea
-                               $result = "";
-                       }
-               }
-
-               // Recheck to see if the file is still missing
-               if (!file_exists(dirname(dirname(__FILE__)) . "/settings.php")) {
-                       register_error(elgg_view("messages/sanitisation/settings", array('settings.php' => $result)));
-                       $sanitised = false;
-               }
-       }
-
-       if (!file_exists(dirname(dirname(dirname(__FILE__))) . "/.htaccess")) {
-               if (!@copy(dirname(dirname(dirname(__FILE__))) . "/htaccess_dist", dirname(dirname(dirname(__FILE__))) . "/.htaccess")) {
-                       register_error(elgg_view("messages/sanitisation/htaccess", array('.htaccess' => file_get_contents(dirname(dirname(dirname(__FILE__))) . "/htaccess_dist"))));
-                       $sanitised = false;
-               }
-       }
-
-       return $sanitised;
-}
-
 /**
  * Adds an entry in $CONFIG[$register_name][$subregister_name].
  *
index f1ad74b23287afa648b075bd6c365609ca780b4f..9deec9e26207d233cb0601c45b4105028035feea 100644 (file)
  * @link http://elgg.org/
  */
 
-/**
- * Check that the installed version of PHP meets the minimum requirements (currently 5.2 or greater).
- *
- * @return bool
- */
-function php_check_version() {
-       if (version_compare(phpversion(), '5.1.2', '>=')) {
-               return true;
-       }
-
-       return false;
-}
-
-/**
- * Validate the platform Elgg is being installed on.
- *
- * @throws ConfigurationException if the validation fails.
- * @return bool
- */
-function validate_platform() {
-       // Get database version
-       if (!db_check_version()) {
-               throw new ConfigurationException(elgg_echo('ConfigurationException:BadDatabaseVersion'));
-       }
-
-       // Now check PHP
-       if (!php_check_version()) {
-               throw new ConfigurationException(elgg_echo('ConfigurationException:BadPHPVersion'));
-       }
-
-       // @todo Consider checking for installed modules etc
-       return true;
-}
-
-/**
- * Confirm the settings for the database
- *
- * @param string $user
- * @param string $password
- * @param string $dbname
- * @param string $host
- * @return bool
- * @since 1.7.1
- */
-function db_check_settings($user, $password, $dbname, $host) {
-       $mysql_dblink = mysql_connect($host, $user, $password, true);
-       if ($mysql_dblink == FALSE) {
-               return $FALSE;
-       }
-
-       $result = mysql_select_db($dbname, $mysql_dblink);
-
-       mysql_close($mysql_dblink);
-       
-       return $result;
-}
-
 /**
  * Returns whether or not the database has been installed
  *
@@ -104,37 +47,13 @@ function is_installed() {
        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);
+function verify_installation() {
+       $installed = FALSE;
+       try {
+               $installed = is_installed();
+       } catch (DatabaseException $e) {}
+       if (!$installed) {
+               header("Location: install.php");
+               exit;
        }
-
-       return $file;
-}
-
-/**
- * Initialisation for installation functions
- *
- */
-function install_init() {
-       register_action("systemsettings/install",true);
 }
-
-register_elgg_event_handler("boot","system","install_init");
\ No newline at end of file
index ce011f5c49de17ce1ef7e33a5d896f11fa63deeb..a84a19e0da7099de4559d6743fe371ea68a5ba0a 100644 (file)
@@ -82,7 +82,8 @@ set_exception_handler('__elgg_php_exception_handler');
  * Load the system settings
  */
 if (!include_once(dirname(__FILE__) . "/settings.php")) {
-       throw new InstallationException("Elgg could not load the settings file.");
+       $msg = elgg_echo('InstallationException:CannotLoadSettings');
+       throw new InstallationException($msg);
 }
 
 
@@ -94,7 +95,7 @@ $lib_files = array(
        'admin.php', 'annotations.php', 'api.php', 'cache.php',
        'calendar.php', 'configuration.php', 'cron.php', 'entities.php',
        'export.php', 'extender.php', 'filestore.php', 'group.php',
-       'input.php', 'install.php', 'location.php', 'mb_wrapper.php',
+       'input.php', 'location.php', 'mb_wrapper.php',
        'memcache.php', 'metadata.php', 'metastrings.php', 'notification.php',
        'objects.php', 'opendd.php', 'pagehandler.php',
        'pageowner.php', 'pam.php', 'plugins.php', 'query.php',
@@ -107,20 +108,13 @@ foreach($lib_files as $file) {
        $file = $lib_dir . $file;
        elgg_log("Loading $file...");
        if (!include_once($file)) {
-               throw new InstallationException("Could not load {$file}");
+               $msg = sprint(elgg_echo('InstallationException:MissingLibrary'), $file);
+               throw new InstallationException($msg);
        }
 }
 
-// check if the install was completed
-// @todo move into function
-$installed = FALSE;
-try {
-       $installed = is_installed();
-} catch (DatabaseException $e) {}
-if (!$installed) {
-       header("Location: install.php");
-       exit;
-}
+// confirm that the installation completed successfully
+verify_installation();
 
 // Autodetect some default configuration settings
 set_default_config();
index aadb89f0d3acb53e93834086e21edbe087516228..93bd9e190b7186d806ab0171123ec1730d1252e2 100644 (file)
@@ -112,10 +112,7 @@ If you are ready to proceed, click the Next button.",
        'install:complete:instructions' => 'Your Elgg site is now ready to be used. Click the button below to be taken to your site.',
 
 
-       'InstallationException:UnknownStep' => '%s is an unknown installation step.',
-       'InstallationException:MissingLibrary' => 'Could not load %s',
-       'InstallationException:CannotLoadSettings' => 'Elgg could not load the settings file. It does not exist or there is a file permissions issue.',
-       
+       'InstallationException:UnknownStep' => '%s is an unknown installation step.',   
 
 );
 
index 77ff00a7d69d3cc0009e92d3b801d7a91f7b51f3..5dd1874d7247976a848894e925eae7b86539f59a 100644 (file)
@@ -42,6 +42,9 @@ $english = array(
        'actionloggedout' => "Sorry, you cannot perform this action while logged out.",
        'actionunauthorized' => 'You are unauthorized to perform this action',
 
+       'InstallationException:MissingLibrary' => 'Could not load %s',
+       'InstallationException:CannotLoadSettings' => 'Elgg could not load the settings file. It does not exist or there is a file permissions issue.',
+
        'SecurityException:Codeblock' => "Denied access to execute privileged code block",
        'DatabaseException:WrongCredentials' => "Elgg couldn't connect to the database using the given credentials.",
        'DatabaseException:NoConnect' => "Elgg couldn't select the database '%s', please check that the database is created and you have access to it.",
diff --git a/views/default/settings/install.php b/views/default/settings/install.php
deleted file mode 100644 (file)
index 6fccfb0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-/**
- * Elgg system settings on initial installation
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- */
-
-echo "<p>" . autop(elgg_echo("installation:settings:description")) . "</p>";
-
-echo elgg_view("settings/system",array("action" => "action/systemsettings/install"));
\ No newline at end of file