2008-01-23 Thomas Hempel <thomas@typo3-unleashed.net>
* Bugfix: removed a needless comma in sysext/cms/ext_tables.sql (line 160)
+ * Installer: Improved the installer module.
+ - The result of the previous steps is now displayed
+ - Fixed some issues with "previous" button
+ * Installer: Improved database and table creation
* Installer: added new option BE/RTE_imageStorageDir. related to issue #7185
* Installer: Added some styles for deliverable lists
foreach ($data as $singleElement) {
switch ($singleElement['status']) {
case 'ok':
- $style = ' style="list-style-image: url('.$this->pObj->getBasicsObject()->getInstallerWebPath().'imgs/icons/ok.png)"';
+ $style = 'list-style-image: url('.$this->pObj->getBasicsObject()->getInstallerWebPath().'imgs/icons/ok.png)';
break;
case 'warning':
- $style = ' style="list-style-image: url('.$this->pObj->getBasicsObject()->getInstallerWebPath().'imgs/icons/warning.png)"';
+ $style = 'list-style-image: url('.$this->pObj->getBasicsObject()->getInstallerWebPath().'imgs/icons/warning.png)';
break;
default:
$style = '';
break;
}
- $content .= '<li'.$style.'>'.$this->render($singleElement).'</li>';
+ $content .= $this->renderTag('li', $this->render($singleElement), array('style' => $style));
}
- $content = '<ul>'.$content.'</ul>';
+ $content = $this->renderTag('ul', $content);
}
return $content;
* @param string message
*/
public function addMessage($message) {
- $this->lastMessage .= $message;
+ $this->lastMessage .= '<br />'.$message;
}
/**
if ($clear) {
$this->clearLastMessage();
}
- return $result;
+ return empty($result) ? false : $result;
}
/**
return false;
}
} else {
- // database coul not be selected
+ // database could not be selected
return false;
}
$t3lib_install = t3lib_div::makeInstance('t3lib_install');
$statements = $t3lib_install->getStatementArray($tblFileContent, 1);
- list($statements_table, $insertCount) = $t3lib_install->getCreateTables($statements, 1);
+ // list($statements_table, $insertCount) = $t3lib_install->getCreateTables($statements, 1);
// create tables and count them
$createCount = 0;
- foreach ($statements as $tableName => $query) {
+ $error = false;
+ $resultItems = array();
+ foreach ($statements as $queryIndex => $query) {
+
+ eregi('^create[[:space:]]*table[[:space:]]*[`]?([[:alnum:]_]*)[`]?',substr($query,0,100),$reg);
+ $tableName = trim($reg[1]);
+
$res = $GLOBALS['TYPO3_DB']->admin_query($query);
- $createCount++;
+ if (!$res) {
+ if (!array_key_exists($tableName, $resultItems)) {
+ $error = true;
+ $resultItems[$tableName] = array ('status' => 'warning', 'type' => 'plain', 'value' => sprintf($this->get_LL('msg_database_warning_tablecreatefailed'), $tableName, $GLOBALS['TYPO3_DB']->sql_error(), $query));
+ }
+ } else {
+ $resultItems[$tableName] = array ('status' => 'ok', 'type' => 'plain', 'value' => sprintf($this->get_LL('label_tablecreated'), $tableName));
+ $createCount++;
+ }
}
// Make a database comparison because some tables that are defined twice have not been created at this point. This applies to the "pages.*" fields defined in sysext/cms/ext_tables.sql for example.
if (is_array($update_statements['add'])) {
foreach ($update_statements['add'] as $statement) {
$res = $GLOBALS['TYPO3_DB']->admin_query($statement);
+ if (!$res) {
+ $this->addError($this->get_LL('msg_database_warning_failedstatement').$statement);
+ $error = true;
+ }
}
}
- return true;
+ $this->pObj->getViewObject()->addMessage($this->pObj->getViewObject()->render(array(
+ array('type' => 'plain', 'value' => $this->pObj->getViewObject()->renderTag('strong', ($error) ? $this->get_LL('msg_database_warning_failedstatements') : $this->get_LL('msg_database_tablescreated'))),
+ array('type' => 'list', 'value' => $resultItems)))
+ );
+
+ return ($error) ? false : true;
}
/**
);
$GLOBALS['TYPO3_DB']->exec_INSERTquery('be_users', $insertFields);
-
+
+ $this->pObj->getViewObject()->addMessage(sprintf($this->get_LL('msg_database_admincreated'), strtolower($this->env['createadmin_username'])));
+
return true;
}
<label index="title_typo_db_username">Database username</label>
<label index="title_typo_db_password">Database password</label>
<label index="title_typo_db">TYPO3 database</label>
+ <label index="title_typo_db_new">New Database</label>
<label index="title_analyze_compareFile">Compare against default database</label>
<label index="title_analyze_staticTables">Reload static tables</label>
<label index="label_line">Line</label>
<label index="label_selectall">Select all</label>
<label index="label_deselectall">Deselect all</label>
+ <label index="label_tablecreated">The table "%s" where created successfully</label>
<label index="msg_database_error_cantconnect">Can't connect to database-server!</label>
<label index="msg_database_error_cantselectdb">Can't select database "%s"</label>
<label index="msg_database_warning_selectdb">Please select a database or fill in a name for a new database.</label>
<label index="msg_database_warning_invalidname">The NEW database name "%s" was not alphanumeric, a-zA-Z0-9_-</label>
<label index="msg_database_warning_failedstatements">Some statements failed to execute due to SQL errors. They are detailed below.</label>
+ <label index="msg_database_warning_failedstatement">The following statement could not be executed: </label>
+ <label index="msg_database_warning_tablecreatefailed">The table "%s" could not be create<br />Message: %s<br />Query: %s</label>
<label index="msg_database_updateneeded">Table and field definitions should be updated!<br /> There seems to be a number of differences between the database and the selected SQL-file. Please select which statements you want to execute in order to update your database:</label>
<label index="msg_database_noupdateneeded">Table and field definitions are OK.<br />The tables and fields in the current database correspond perfectly to the database in the selected SQL-file.</label>
<label index="msg_database_reloadstaticdata">Check in the form below for which static table you want to load or reload the data. Be careful if the table already exists: it will be dropped before the data is loaded, so any changes will be lost.</label>
<label index="msg_database_staticdatareloaded">Table "%s" was (re)created successfully and %d rows of data were loaded.</label>
+ <label index="msg_database_tablescreated">All tables where created successfully. See a list of created tables below.</label>
+ <label index="msg_database_admincreated">An admin user with username "%s" was created successfully.</label>
+
</languageKey>
</data>
</T3locallang>
\ No newline at end of file
'hidden' => array (
'step' => $this->step-1,
'mode' => '123',
- 'state' => 'post'
+ 'state' => 'pre'
),
)
);
'###MSG_TITLE###' => $this->get_LL('msg_step'.$this->step.'_title'),
'###MSG_DESCRIPTION###' => $this->get_LL('msg_step'.$this->step.'_description'),
'###BTN_BACK###' => $btnBack,
- '###CONTENT###' => $stepResult
+ '###CONTENT###' => $stepResult,
+ '###PREV_RESULT###' => $this->pObj->getViewObject()->getLastMessage(true)
);
if (count($this->pObj->getViewObject()->getErrors('general')) > 0) {
return false;
}
- // process pre state
+ // process pre state - result is true if this state is not configured
if (isset($this->stepConfig[$this->step]['pre'])) {
$preResult = $this->executeStepState('pre');
} else {
// exit if pre checks are not sucessfull
if ($preResult === false) {
// depending on preMode we only skip state main or stop here immediately
- if (!isset($this->stepConfig[$this->step]['preMode']) &&Ê(!strcmp($this->stepConfig[$this->step]['preMode'], 'skipMain'))) {
+ if (!isset($this->stepConfig[$this->step]['preMode']) &&Ê($this->stepConfig[$this->step]['preMode'] != 'skipMain')) {
return false;
} else {
$this->env['state'] = 'post';
if ($this->env['state'] == 'post') {
// execute process methods (has to be configured)
$processResult = $this->executeStepState('post');
- $this->env['state'] = NULL;
+ $this->env['state'] = 'pre';
// go to next step if process was ok
if ($processResult === true) {
// execute main state (has to be configured!)
$mainResult = $this->executeStepState('main');
-
+
if ($mainResult === false) {
return false;
}
return $stateResult;
}
+ /**
+ * Receives a state config and executs the respective method and returns the result
+ *
+ * @param mixed $stateMethod: The method to call and the optional the type.
+ * @param array $formElements: An array that collects the form elements for the step (PASS BY REFERENCE)
+ * @return False if somethign went wrong, otherwise the result of the called method
+ */
private function dispatchStateMethod($stateMethod, &$formElements) {
$result = true;
if ($stateMethod['type'] == 'label') {
<label index="msg_step1_title">Database connection</label>
<label index="msg_step1_description">Please enter the information for connecting to your prefered database.</label>
+ <label index="msg_step2_title">Select /create database</label>
+ <label index="msg_step2_description">Please select an existing database from the dropdown box or enter a name in the input field to create a new database.</label>
+
<label index="msg_step4_title">Create admin user</label>
<label index="msg_step4_description">Your database is set up sucessfully. Now we have to create an admin account for logging into the backend.</label>
<body>
<div id="outer-block">
<h1>###STEP###</h1>
+ ###PREV_RESULT###
<h2>###MSG_TITLE###</h2>
<div class="description">###MSG_DESCRIPTION###</div>