Page MenuHomeIn-Portal Phabricator

D481.id.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 5:00 AM

D481.id.diff

Index: branches/5.2.x/core/install.php
===================================================================
--- branches/5.2.x/core/install.php
+++ branches/5.2.x/core/install.php
@@ -569,6 +569,17 @@
// 2. check permissions, that use have in this database
$status = $this->CheckDatabase(($this->currentStep == 'db_config') && !$this->GetVar('UseExistingSetup'));
+
+ if ( $status ) {
+ $db_collation = $this->toolkit->systemConfig->get('DBCollation', 'Database');
+ $sql = 'SHOW COLLATION LIKE ' . $this->Conn->qstr($db_collation);
+ $db_collation_data = $this->Conn->Query($sql);
+
+ if ( !is_array($db_collation_data) || !$db_collation_data ) {
+ $status = false;
+ $this->errorMessage = 'Chosen database collation isn\'t compatible with used MySQL Server version';
+ }
+ }
break;
case 'select_license':
Index: branches/5.2.x/core/install/step_templates/db_config.tpl
===================================================================
--- branches/5.2.x/core/install/step_templates/db_config.tpl
+++ branches/5.2.x/core/install/step_templates/db_config.tpl
@@ -48,11 +48,15 @@
<td align="left">
<select name="DBCollation" class="text">
<?php
- $option_tpl = '<option value="%1$s"%2$s>%1$s</option>'."\n";
- $collations = Array ('utf8_general_ci', 'latin1_swedish_ci');
- foreach ($collations as $collation) {
- $selected = ($collation == $this->toolkit->systemConfig->get('DBCollation', 'Database')) ? ' selected="selected"' : '';
- echo sprintf($option_tpl, $collation, $selected);
+ $option_tpl = '<option value="%1$s"%3$s>%2$s</option>'."\n";
+ $collations = Array (
+ 'utf8_general_ci' => 'utf8_general_ci (MySQL 5.x)',
+ 'utf8mb3_general_ci' => 'utf8mb3_general_ci (MySQL 8.x+)',
+ 'latin1_swedish_ci' => 'latin1_swedish_ci (MySQL 5.x & MySQL 8.x+)',
+ );
+ foreach ($collations as $collation_key => $collation_title) {
+ $selected = ($collation_key == $this->toolkit->systemConfig->get('DBCollation', 'Database')) ? ' selected="selected"' : '';
+ echo sprintf($option_tpl, $collation_key, $collation_title, $selected);
}
?>
</select>
@@ -74,4 +78,4 @@
<input type="radio" name="UseExistingSetup" id="UseExistingSetup_1" value="1"/> <label for="UseExistingSetup_1">Yes</label> <input type="radio" name="UseExistingSetup" id="UseExistingSetup_0" value="0" checked/> <label for="UseExistingSetup_0">No</label>
</td>
</tr>
-<?php } ?>
\ No newline at end of file
+<?php } ?>
Index: branches/5.2.x/core/install/step_templates/db_reconfig.tpl
===================================================================
--- branches/5.2.x/core/install/step_templates/db_reconfig.tpl
+++ branches/5.2.x/core/install/step_templates/db_reconfig.tpl
@@ -48,11 +48,15 @@
<td align="left">
<select name="DBCollation" class="text">
<?php
- $option_tpl = '<option value="%1$s"%2$s>%1$s</option>'."\n";
- $collations = Array ('utf8_general_ci', 'latin1_swedish_ci');
- foreach ($collations as $collation) {
- $selected = ($collation == $this->toolkit->systemConfig->get('DBCollation', 'Database')) ? ' selected="selected"' : '';
- echo sprintf($option_tpl, $collation, $selected);
+ $option_tpl = '<option value="%1$s"%3$s>%2$s</option>'."\n";
+ $collations = Array (
+ 'utf8_general_ci' => 'utf8_general_ci (MySQL 5.x)',
+ 'utf8mb3_general_ci' => 'utf8mb3_general_ci (MySQL 8.x+)',
+ 'latin1_swedish_ci' => 'latin1_swedish_ci (MySQL 5.x/8.x+)',
+ );
+ foreach ($collations as $collation_key => $collation_title) {
+ $selected = ($collation_key == $this->toolkit->systemConfig->get('DBCollation', 'Database')) ? ' selected="selected"' : '';
+ echo sprintf($option_tpl, $collation_key, $collation_title, $selected);
}
?>
</select>
@@ -64,4 +68,4 @@
<td align="left">
<input type="text" name="TablePrefix" class="text" maxlength="7" value="<?php echo $this->toolkit->systemConfig->get('TablePrefix', 'Database'); ?>" />
</td>
-</tr>
\ No newline at end of file
+</tr>
Index: branches/5.2.x/core/install/steps_db.xml
===================================================================
--- branches/5.2.x/core/install/steps_db.xml
+++ branches/5.2.x/core/install/steps_db.xml
@@ -8,7 +8,7 @@
<p><b><i>Database Name</i></b> - name of the database where In-Portal will be installed.</p>
<p><b><i>Database User Name</i></b> - name of the user for selected database.</p>
<p><b><i>Database User Password</i></b> - password for selected username.</p>
- <p><b><i>Database Collation</i></b> - character set used to store data in text fields (normally <i>"utf8_general_ci"</i>).</p>
+ <p><b><i>Database Collation</i></b> - character set used to store data in text fields (normally <i>"utf8_general_ci"</i> for MySQL 5.x and <i>"utf8mb3_general_ci"</i> for MySQL 8.x+).</p>
<p><b><i>Prefix for Table Names</i></b> - specified when multiple scripts will be run in the same database.
Prefix can be any text string allowed in table naming by your database engine (normally <i>"inp_"</i>).</p>
<p><b><i>Use existing In-Portal installation setup in this Database</i></b> - select <i>"Yes"</i>

Event Timeline