Skip to content

Commit

Permalink
Support using InnoDB without the innodb_large_prefix option.
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Feb 22, 2018
1 parent a20b3ed commit c829c20
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 85 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Contao installation bundle change log

### DEV

* Support using InnoDB without the `innodb_large_prefix` option.

### 4.5.2 (2018-01-12)

* Do not parse @@version to determine the database vendor (see #84).

### 4.5.1 (2018-01-04)

* Check all innodb_large_prefix requirements in the install tool (see #80).
* Check all `innodb_large_prefix` requirements in the install tool (see #80).
* Use the table options instead of the default table options to compare engine and collation.

### 4.5.0-RC1 (2017-12-12)
Expand Down
48 changes: 0 additions & 48 deletions src/InstallTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,54 +263,6 @@ public function hasConfigurationError(array &$context): bool
return true;
}

if ('InnoDB' === $options['engine'] && 0 === strncmp($options['collate'], 'utf8mb4', 7)) {
$row = $this->connection
->query("SHOW VARIABLES LIKE 'innodb_large_prefix'")
->fetch(\PDO::FETCH_OBJ)
;

// The innodb_large_prefix option is not set
if (!\in_array(strtolower((string) $row->Value), ['1', 'on'], true)) {
$context['errorCode'] = 4;

return true;
}

// As there is no reliable way to get the vendor (see #84), we are
// guessing based on the version number. MySQL is currently at 8 so
// checking for 10 should be save for the next couple of years.
$vok = version_compare($version, '10', '>=') ? '10.2' : '5.7.7';

// No additional requirements as of MySQL 5.7.7 and MariaDB 10.2
if (version_compare($version, $vok, '>=')) {
return false;
}

$row = $this->connection
->query("SHOW VARIABLES LIKE 'innodb_file_format'")
->fetch(\PDO::FETCH_OBJ)
;

// The InnoDB file format is not Barracuda
if ('barracuda' !== strtolower((string) $row->Value)) {
$context['errorCode'] = 5;

return true;
}

$row = $this->connection
->query("SHOW VARIABLES LIKE 'innodb_file_per_table'")
->fetch(\PDO::FETCH_OBJ)
;

// The innodb_file_per_table option is not set
if (!\in_array(strtolower((string) $row->Value), ['1', 'on'], true)) {
$context['errorCode'] = 5;

return true;
}
}

return false;
}

Expand Down
16 changes: 0 additions & 16 deletions src/Resources/translations/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -326,22 +326,6 @@
<source>unsupported_engine_explain</source>
<target>The configured database engine &lt;code&gt;%s&lt;/code&gt; is not available on your server. Please install it (recommended) or configure a different database engine in the &lt;code&gt;app/config/config.yml&lt;/code&gt; file.</target>
</trans-unit>
<trans-unit id="82">
<source>innodb_large_prefix</source>
<target>The innodb_large_prefix option is not enabled!</target>
</trans-unit>
<trans-unit id="83">
<source>innodb_large_prefix_explain</source>
<target>The &lt;code&gt;innodb_large_prefix&lt;/code&gt; option is not enabled on your server. Please enable it (recommended) or configure a different character set and collation in the &lt;code&gt;app/config/config.yml&lt;/code&gt; file.</target>
</trans-unit>
<trans-unit id="84">
<source>innodb_additional</source>
<target>InnoDB is not configured properly!</target>
</trans-unit>
<trans-unit id="85">
<source>innodb_additional_explain</source>
<target>Using large prefixes in MySQL versions prior to 5.7.7 and MariaDB versions prior to 10.2 requires the Barracuda file format and the &lt;code&gt;innodb_file_per_table&lt;/code&gt; option.</target>
</trans-unit>
</body>
</file>
</xliff>
20 changes: 0 additions & 20 deletions src/Resources/views/configuration_error.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@
default_table_options:
engine: MyISAM</pre>
</div>
{% elseif errorCode == 4 %}
<p class="tl_error">{{ 'innodb_large_prefix'|trans }}</p>
<p>{{ 'innodb_large_prefix_explain'|trans|raw }}</p>
<div id="sql_wrapper">
<pre>doctrine:
dbal:
connections:
default:
default_table_options:
charset: utf8
collate: utf8_unicode_ci</pre>
</div>
{% elseif errorCode == 5 %}
<p class="tl_error">{{ 'innodb_additional'|trans }}</p>
<p>{{ 'innodb_additional_explain'|trans|raw }}</p>
<div id="sql_wrapper">
<pre>innodb_large_prefix = 1
innodb_file_format = Barracuda
innodb_file_per_table = 1</pre>
</div>
{% endif %}
</fieldset>
{% endblock %}

0 comments on commit c829c20

Please sign in to comment.