Index: trunk/core/install/step_templates/root_password.tpl =================================================================== diff -u -N --- trunk/core/install/step_templates/root_password.tpl (revision 0) +++ trunk/core/install/step_templates/root_password.tpl (revision 6691) @@ -0,0 +1,16 @@ + + + Root Password*: + + + + + + + + Confirm Root Password*: + + + + + \ No newline at end of file Index: trunk/core/install/step_templates/install_setup.tpl =================================================================== diff -u -N --- trunk/core/install/step_templates/install_setup.tpl (revision 0) +++ trunk/core/install/step_templates/install_setup.tpl (revision 6691) @@ -0,0 +1,51 @@ + + + In order to use the installation tool, please provide your Intechnic account information: + + + + + Username*: + + + + + + + + Password*: + + + + + + + + + + + + + 'Upgrade In-Portal', + 1 => 'Clean out the In-Portal database and reinstall', + 4 => 'Clean out the In-Portal database and reinstall from backup', + 2 => 'Install to a new database', + 3 => 'Update License Information', + 5 => 'Change Database Configuration', + 7 => 'Fix Paths', + ); + + $td_class = 'table_color1'; + foreach ($options as $option_key => $option_title) { + $checked = $this->GetVar('inp_opt') == $option_key ? ' checked' : ''; + echo sprintf($option_tpl, $option_key, $checked, $option_title, $td_class); + $td_class = ($td_class == 'table_color1') ? 'table_color2' : 'table_color1'; + } + +?> \ No newline at end of file Index: trunk/core/install.php =================================================================== diff -u -N -r6685 -r6691 --- trunk/core/install.php (.../install.php) (revision 6685) +++ trunk/core/install.php (.../install.php) (revision 6691) @@ -70,7 +70,11 @@ */ var $steps = Array( 'fresh_install' => Array ('check_paths', 'db_config', 'root_password', 'choose_modules', 'finish'), - 'already_installed' => Array ('installed_select', 'finish'), + 'already_installed' => Array ('install_setup'), + + 'upgrade' => Array ('install_setup',/* ..., */ 'finish'), + 'db_reconfig' => Array ('install_setup',/* ..., */ 'finish'), + 'fix_paths' => Array ('install_setup',/* ..., */ 'finish'), ); @@ -80,7 +84,7 @@ * @var Array */ - var $skipApplicationSteps = Array ('check_paths', 'db_config'); + var $skipApplicationSteps = Array ('check_paths', 'db_config', 'install_setup'); // remove install_setup when application will work separately from install /** * Folders that should be writeable to continue installation @@ -108,33 +112,49 @@ $this->INIFile = FULL_PATH.'/config.php'; $this->StepDBFile = FULL_PATH.'/'.REL_PATH.'/install/steps_db.xml'; + $base_path = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); + $this->baseURL = 'http://'.$_SERVER['HTTP_HOST'].$base_path.'/core/install/'; + set_error_handler( Array(&$this, 'ErrorHandler') ); if (file_exists($this->INIFile)) { // if config.php found, then check his write permission too $this->writeableFolders[] = '/config.php'; } + $this->systemConfig = $this->ParseConfig(true); + $this->systemConfig['Misc']['WriteablePath'] = '/system'; // for development purposes + $this->currentStep = $this->GetVar('step'); - if (!$this->stepsPreset) { - $this->stepsPreset = 'fresh_install'; - } + $this->SelectPreset(); if (!$this->currentStep) { // first step of current preset reset($this->steps[$this->stepsPreset]); $this->currentStep = current($this->steps[$this->stepsPreset]); } - $this->systemConfig = $this->ParseConfig(true); - - $this->systemConfig['Misc']['WriteablePath'] = '/system'; // for development purposes - $this->InitStep(); + } + + /** + * Selects preset to proceed based on various criteria + * + */ + function SelectPreset() + { + $preset = 'fresh_install'; - $base_path = rtrim(preg_replace('/'.preg_quote(rtrim(REL_PATH, '/'), '/').'$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/'); - $this->baseURL = 'http://'.$_SERVER['HTTP_HOST'].$base_path.'/core/install/'; + if (file_exists($this->INIFile) && $this->GetVar('step') === false) { + // only at installation first step + $status = $this->CheckDatabase(false); + if ($status && $this->AlreadyInstalled()) { + $preset = 'already_installed'; + } + } + + $this->stepsPreset = $preset; } function GetVar($name) @@ -148,16 +168,13 @@ */ function InitStep() { - $go_next = $this->GetVar('step') === false ? false : true; - $this->InitApplication(); switch ($this->currentStep) { case 'check_paths': foreach ($this->writeableFolders as $folder_path) { $file_path = FULL_PATH.$folder_path; if (!is_writable($file_path)) { - $go_next = false; $this->errorMessage = 'Install cannot write to specified folder in the root directory of your installation'; break; } @@ -184,6 +201,25 @@ } } break; + + case 'choose_modules': + // if no modules found, then proceed to next step + $modules = $this->ScanModules(); + if (!$modules) { + $this->currentStep = $this->GetNextStep(); + } + break; + + case 'install_setup': + $next_preset = $this->GetVar('preset'); + if (!$next_preset) { + // if preset was not choosen, then raise error + $this->errorMessage = 'Please select action to perform'; + } + else { + // if preset was choosen, then check root password entered + } + break; } $this->PerformValidation(); // returns validation status (just in case) @@ -218,7 +254,7 @@ if (!$status) break; // 2. check permissions, that use have in this database - $status = $this->CheckDatabase(true); + $status = $this->CheckDatabase(); break; case 'root_password': @@ -348,8 +384,18 @@ return $this->Conn->errorCode == 0; } - function CheckDatabase($check_installed = false) + /** + * Checks if core is already installed + * + * @return bool + */ + function AlreadyInstalled() { + return $this->TableExists('ConfigurationAdmin'); //,Category,Permissions'); + } + + function CheckDatabase($check_installed = true) + { // perform various check type to database specified // 1. user is allowed to connect to database // 2. user has all types of permissions in database @@ -385,11 +431,8 @@ if ($status) { // if statements work & connection made, then check table existance - $already_installed = $this->TableExists('ConfigurationAdmin,Category,Permissions'); - - if ($check_installed && $already_installed) { - // already installed at that location - $this->errorMessage = 'An In-Portal Database already exists at this location'; // : 'An In-Portal Database was not found at this location'; + if ($check_installed && $this->AlreadyInstalled()) { + $this->errorMessage = 'An In-Portal Database already exists at this location'; return false; } } @@ -483,159 +526,50 @@ } /** + * Returns modules list found in modules folder + * + * @return Array + */ + function ScanModules() + { + static $modules = null; + + if (!isset($modules)) { + $modules = Array(); + $fh = opendir(MODULES_PATH); + while (($sub_folder = readdir($fh))) { + $folder_path = MODULES_PATH.'/'.$sub_folder; + if ($sub_folder != '.' && $sub_folder != '..' && is_dir($folder_path)) { + if ($sub_folder == 'core') { + // skip modules here + continue; + } + // this is folder in MODULES_PATH directory + if (file_exists($folder_path.'/install.php') && file_exists($folder_path.'/install/install_schema.sql')) { + $modules[] = $sub_folder; + } + } + } + } + + return $modules; + } + + /** * Returns content to show for current step * * @return string */ function GetStepBody() { - ob_start(); - switch ($this->currentStep) { - case 'check_paths': - ?> - - %s - %s - - writeableFolders as $folder_path) { - $file_path = FULL_PATH.$folder_path; - $folder_status = is_writable($file_path) ? 'OK' : 'FAILED'; - echo sprintf($folder_tpl, $file_path, $folder_status); - } - break; - - case 'db_config': - ?> - - Server Type*: - - - - - - - Hostname*: - - - - - - - Database Name*: - - - - - - - Database User Name*: - - - - - - - Database User Password: - - - - - - - Table Name Prefix: - - - - - - - - Root Password: - - - - - - - - Confirm Root Password: - - - - - - - - - - - - - - - In-portal has successfully been installed on your server. - Click the button below to log into the site administration - using the root password you just configured.
- - - currentStep.'.tpl'; + if (file_exists($step_template)) { + ob_start(); + include_once ($step_template); + return ob_get_clean(); } - return ob_get_clean(); + return '{step template "'.$this->currentStep.'" missing}'; } /** Index: trunk/core/install/step_templates/choose_modules.tpl =================================================================== diff -u -N --- trunk/core/install/step_templates/choose_modules.tpl (revision 0) +++ trunk/core/install/step_templates/choose_modules.tpl (revision 6691) @@ -0,0 +1,16 @@ + + + + + + +ScanModules(); + foreach ($modules as $module) { + echo sprintf($module_tpl, $module); + } +?> \ No newline at end of file Index: trunk/core/install/step_templates/db_config.tpl =================================================================== diff -u -N --- trunk/core/install/step_templates/db_config.tpl (revision 0) +++ trunk/core/install/step_templates/db_config.tpl (revision 6691) @@ -0,0 +1,51 @@ + + Server Type*: + + + + + + + Hostname*: + + + + + + + Database Name*: + + + + + + + Database User Name*: + + + + + + + Database User Password: + + + + + + + Table Name Prefix: + + + + \ No newline at end of file Index: trunk/core/install/steps_db.xml =================================================================== diff -u -N -r6685 -r6691 --- trunk/core/install/steps_db.xml (.../steps_db.xml) (revision 6685) +++ trunk/core/install/steps_db.xml (.../steps_db.xml) (revision 6691) @@ -12,7 +12,7 @@ The root user cannot be used to access the front-end of the system, so it is recommended that you create additional users with admin privlidges.

]]> - + Select the In-Portal modules you wish to install. The modules listed to the right are all modules included in this installation that are licensed to run on this server.

]]>
@@ -25,4 +25,19 @@ for the latest news, module releases and support.

*Make sure to clean your browser' cache after upgrading In-portal version

]]>
+ + A Configuration file has been detected on your system and it appears In-Portal is correctly installed. + In order to work with the maintenance functions provided to the left you must provide the Intechnic + Username and Password you used when obtaining the license file residing on the server, or your admin Root password. + (Use Username 'root' if using your root password)

+

To removing your existing database and start with a fresh installation, select the first option + provided. Note that this operation cannot be undone and no backups are made! Use at your own risk.

+

If you wish to scrap your current installation and install to a new location, choose the second option. + If this option is selected you will be prompted for new database configuration information.

+

The Update License Information option is used to update your In-Portal license data. Select this option if you have + modified your licensing status with Intechnic, or you have received new license data via email

+

The Fix Paths option should be used when the location of the In-portal files has changed. + For example, if you moved them from one folder to another. It will update all settings and ensure the + program is operational at the new location.

]]> +
\ No newline at end of file Index: trunk/core/install/step_templates/check_paths.tpl =================================================================== diff -u -N --- trunk/core/install/step_templates/check_paths.tpl (revision 0) +++ trunk/core/install/step_templates/check_paths.tpl (revision 6691) @@ -0,0 +1,16 @@ + + + %s + %s + +writeableFolders as $folder_path) { + $file_path = FULL_PATH.$folder_path; + $folder_status = is_writable($file_path) ? 'OK' : 'FAILED'; + echo sprintf($folder_tpl, $file_path, $folder_status); + } +?> \ No newline at end of file Index: trunk/core/install/step_templates/finish.tpl =================================================================== diff -u -N --- trunk/core/install/step_templates/finish.tpl (revision 0) +++ trunk/core/install/step_templates/finish.tpl (revision 6691) @@ -0,0 +1,7 @@ + + + In-portal has successfully been installed on your server. + Click the button below to log into the site administration + using the root password you just configured.
+ + \ No newline at end of file