Open Flip1 opened 9 months ago
Thanks for reporting! Since we also support older sql versions, we'll need to add a switch here. We don't have specific mysql version checking, so maybe the easier way is to let the query fail, catch the failure, and then issue the other engine command.
We should use the mysql8 syntax as default and only fall back to the "old" variant.
Thoughts? @onli ?
Thoughts? @onli ?
I thought we already had the storage_engine bug fixed in the beta. Have a look at https://github.com/s9y/Serendipity/blob/2ef0afd7bb85d2c00ebb1c5b64f32caeef68b637/include/db/mysqli.inc.php#L295-L305
The idea there was to solve the MySQL bug by not setting the storage_engine
at all in MySQL >= 5.8. But it seems my assumption was wrong how MariaDB behaves. Was discussed (and tested) in https://board.s9y.org/viewtopic.php?t=26120.
I'd probably would have added a second version check:
if (serendipity_utf8mb4_ready()) {
# InnoDB enables us to use utf8mb4 with the higher max index size
if (version_compare($mysql_version, '5.7', '>')) {
# We know we use MariaDB here, and versions after 5.7 prefer default_storage_engine.
serendipity_db_query("SET default_storage_engine=INNODB");
} else {
serendipity_db_query("SET storage_engine=INNODB");
}
} else {
# Before 5.6.4/10.0.5 InnoDB did not support fulltext indexes, which we use,
# thus we stay with MyISAM here
if (version_compare($mysql_version, '5.7', '>')) {
# We know we use MariaDB here, and versions after 5.7 prefer default_storage_engine.
serendipity_db_query("SET default_storage_engine=MYISAM");
} else {
serendipity_db_query("SET storage_engine=MYISAM");
}
}
But that's a version check after a version check and a lot of ifs. Probably not a good idea. To use the default_storage_engine
by default and catch the error for old versions is probably smarter, then we can put the old code into the rescue/catch as-is.
I just checked upon this code, since we just released 2.5.0, but I think this bug here was missed. Someone available to run the code as shown in https://github.com/s9y/Serendipity/issues/818#issuecomment-1826760259 on mariadb?
I wanted to try it out, but a new installation failed somewhere else: [#822]
The automatic update from 2.5beta to 2.5 doesn't work, but with FTP-Upload everything works fine.
The installation of unchanged 2.5 is now running smoothly. So, I have not tested the above code and I think this issue can be closed. Or should I test something special?
It worked without you having to change anything, while you were trying to use MariaDB?
When I created this error I wasn't entirely sure, now I know that Limacity is running MySQL 8.0.34-26. This error occurred here with 2.4.0 and 2.5beta1. But now I was able to install 2.5 without changes and without any problems. Seems like this bug has been fixed. I haven't tested it with MariaDB, but I could test it locally. But maybe next week.
Awesome :) If you want to test it we can keep this open, if not we can close here (or we can close and then re-open, as you prefer)
Okay, I have now set up a test environment on Debian Bookworm (stable):
Serendipity seems to run fine with MariaDB, the installation went smoothly. However, there seems to be a problem with PHP 8.2, which is why the blog cannot load. Apparently the built-in library for 8.1 does not work with PHP 8.2.
PHP Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /var/www/s9y/bundled-libs/php81_bc/strftime/src/php-8.1-strftime.php:60\nStack trace:
thrown in /var/www/s9y/bundled-libs/php81_bc/strftime/src/php-8.1-strftime.php on line 60, referer: http://localhost//serendipity_admin.php?
It seems you are missing the Debian package "php8-intl"?
Yeah that's it! php8.2-intl was not installed. Now I can confirm that Serendipity 2.5 runs smoothly with MariaDB and PHP 8.2. At least in my test environment!
The only thing that could possibly be improved is a test during installation to see whether php8.2-intl is available.
The following error makes a install of s9y impossible:
Unknown system variable 'storage_engine'
The use of "storage-engine" is maybe deprecated and leads to this error. This should be changed to "default_storage_engine". See here
The following changes will fix this issue: File: include/db/mysqli.inc.php Line: 296 and 300
Replace:
serendipity_db_query("SET storage_engine=
with:serendipity_db_query("SET default_storage_engine=
This happens with s9y version 2.4.0 and 2.5beta1. Version of MySQL or MariaDB is: 8.0.34-26