From e8c47ee8a098bd4297cbacb6b96ad1768a769628 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 21 Oct 2011 21:09:27 -0400 Subject: Fixes #3994 cleaned up session handling for the installer --- install/ElggInstaller.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'install') diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index c07839065..59ac44dc6 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -562,7 +562,12 @@ class ElggInstaller { * @return string */ protected function getNextStep($currentStep) { - return $this->steps[1 + array_search($currentStep, $this->steps)]; + $index = 1 + array_search($currentStep, $this->steps); + if (isset($this->steps[$index])) { + return $this->steps[$index]; + } else { + return null; + } } /** @@ -735,20 +740,18 @@ class ElggInstaller { protected function finishBootstraping($step) { $dbIndex = array_search('database', $this->getSteps()); - $settingsIndex = array_search('settings', $this->getSteps()); + $adminIndex = array_search('admin', $this->getSteps()); + $completeIndex = array_search('complete', $this->getSteps()); $stepIndex = array_search($step, $this->getSteps()); - if ($stepIndex <= $settingsIndex) { - // install has its own session handling before the db created and set up - session_name('Elgg'); + // To log in the user, we need to use the Elgg core session handling. + // Otherwise, use default php session handling + $useElggSession = ($stepIndex == $adminIndex && $this->isAction) || + $stepIndex == $completeIndex; + if (!$useElggSession) { + session_name('Elgg_install'); session_start(); elgg_unregister_event_handler('boot', 'system', 'session_init'); - } else if (!$this->isAction && $stepIndex == ($settingsIndex + 1)) { - // now using Elgg session handling so need to pass forward the system messages - // this is called on the GET of the next step - session_name('Elgg'); - session_start(); - $messages = $_SESSION['msg']; } if ($stepIndex > $dbIndex) { @@ -789,11 +792,6 @@ class ElggInstaller { elgg_trigger_event('boot', 'system'); elgg_trigger_event('init', 'system'); - - // @hack finish the process of pushing system messages into new session - if (!$this->isAction && $stepIndex == ($settingsIndex + 1)) { - $_SESSION['msg'] = $messages; - } } } @@ -811,6 +809,8 @@ class ElggInstaller { $CONFIG->wwwroot = $this->getBaseUrl(); $CONFIG->url = $CONFIG->wwwroot; $CONFIG->path = dirname(dirname(__FILE__)) . '/'; + $CONFIG->lastcache = 0; + $CONFIG->context = array(); } /** @@ -1398,6 +1398,7 @@ class ElggInstaller { set_config('default_access', $submissionVars['siteaccess'], $site->getGUID()); set_config('allow_registration', TRUE, $site->getGUID()); set_config('walled_garden', FALSE, $site->getGUID()); + set_config('allow_user_default_access', '', $site->getGUID()); $this->enablePlugins(); -- cgit v1.2.3 From a18ba9dad699ca785e4d8fc37a5fe95a060584e0 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Fri, 21 Oct 2011 21:30:01 -0400 Subject: Fixes #3995 the batch installer now skips the settings file creation step if settings.php already exists --- install/ElggInstaller.php | 21 +++++++++++++++++---- install/cli/sample_installer.php | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'install') diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index 59ac44dc6..657f0907f 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -39,6 +39,7 @@ class ElggInstaller { ); protected $status = array( + 'config' => FALSE, 'database' => FALSE, 'settings' => FALSE, 'admin' => FALSE, @@ -119,6 +120,9 @@ class ElggInstaller { * account. If it fails, an exception is thrown. It does not check any of * the requirements as the multiple step web installer does. * + * If the settings.php file exists, it will use that rather than the parameters + * passed to this function. + * * @param array $params Array of key value pairs * @param bool $createHtaccess Should .htaccess be created * @@ -169,15 +173,22 @@ class ElggInstaller { } } - if (!$this->createSettingsFile($params)) { - throw new InstallationException(elgg_echo('install:error:settings')); + $this->setInstallStatus(); + + if (!$this->status['config']) { + if (!$this->createSettingsFile($params)) { + throw new InstallationException(elgg_echo('install:error:settings')); + } } if (!$this->connectToDatabase()) { throw new InstallationException(elgg_echo('install:error:databasesettings')); } - if (!$this->installDatabase()) { - throw new InstallationException(elgg_echo('install:error:cannotloadtables')); + + if (!$this->status['database']) { + if (!$this->installDatabase()) { + throw new InstallationException(elgg_echo('install:error:cannotloadtables')); + } } // load remaining core libraries @@ -597,6 +608,8 @@ class ElggInstaller { $this->loadSettingsFile(); + $this->status['config'] = TRUE; + // must be able to connect to database to jump install steps $dbSettingsPass = $this->checkDatabaseSettings( $CONFIG->dbuser, diff --git a/install/cli/sample_installer.php b/install/cli/sample_installer.php index 10838b562..954169a6a 100644 --- a/install/cli/sample_installer.php +++ b/install/cli/sample_installer.php @@ -15,6 +15,7 @@ $params = array( // site settings 'sitename' => '', + 'siteemail' => '', 'wwwroot' => '', 'dataroot' => '', -- cgit v1.2.3 From e66bfc0434876327e7993382041db51d21b60f42 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 2 Nov 2011 22:17:08 -0400 Subject: input lib depends on pageowner lib now --- engine/start.php | 5 +++-- install/ElggInstaller.php | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'install') diff --git a/engine/start.php b/engine/start.php index fc3aa004e..00bdc3197 100644 --- a/engine/start.php +++ b/engine/start.php @@ -60,7 +60,8 @@ $lib_dir = dirname(__FILE__) . '/lib/'; */ $required_files = array( 'elgglib.php', 'views.php', 'access.php', 'system_log.php', 'export.php', - 'sessions.php', 'languages.php', 'input.php', 'cache.php', 'output.php' + 'sessions.php', 'languages.php', 'pageowner.php', 'input.php', 'cache.php', + 'output.php' ); // include bootstraping libs @@ -96,7 +97,7 @@ $lib_files = array( 'extender.php', 'filestore.php', 'group.php', 'location.php', 'mb_wrapper.php', 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', - 'opendd.php', 'pagehandler.php', 'pageowner.php', 'pam.php', 'plugins.php', + 'opendd.php', 'pagehandler.php', 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php', diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php index 657f0907f..d556ba744 100644 --- a/install/ElggInstaller.php +++ b/install/ElggInstaller.php @@ -728,8 +728,9 @@ class ElggInstaller { // bootstrapping with required files in a required order $required_files = array( - 'elgglib.php', 'views.php', 'access.php', 'system_log.php', 'export.php', 'configuration.php', - 'sessions.php', 'languages.php', 'input.php', 'cache.php', 'output.php' + 'elgglib.php', 'views.php', 'access.php', 'system_log.php', 'export.php', + 'configuration.php', 'sessions.php', 'languages.php', 'pageowner.php', + 'input.php', 'cache.php', 'output.php', ); foreach ($required_files as $file) { @@ -785,7 +786,7 @@ class ElggInstaller { 'memcache.php', 'metadata.php', 'metastrings.php', 'navigation.php', 'notification.php', 'objects.php', 'opendd.php', 'pagehandler.php', - 'pageowner.php', 'pam.php', 'plugins.php', + 'pam.php', 'plugins.php', 'private_settings.php', 'relationships.php', 'river.php', 'sites.php', 'statistics.php', 'tags.php', 'user_settings.php', 'users.php', 'upgrade.php', 'web_services.php', -- cgit v1.2.3