Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/phpunit-mysql-sharding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ jobs:
fail-fast: false
matrix:
include:
- mysql-versions: '8.0'
php-versions: '8.3'
- mysql-versions: '8.4'
php-versions: '8.3'
- mysql-versions: '9.7'
php-versions: '8.5'

name: Sharding - MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }}) - database tests
Expand All @@ -72,7 +72,7 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3

mysql:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest # zizmor: ignore[unpinned-images]
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
ports:
- 4444:3306/tcp
env:
Expand All @@ -82,7 +82,7 @@ jobs:
MYSQL_DATABASE: oc_autotest
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
shard1:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest # zizmor: ignore[unpinned-images]
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
ports:
- 5001:3306/tcp
env:
Expand All @@ -92,7 +92,7 @@ jobs:
MYSQL_DATABASE: nextcloud
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
shard2:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest # zizmor: ignore[unpinned-images]
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
ports:
- 5002:3306/tcp
env:
Expand All @@ -102,7 +102,7 @@ jobs:
MYSQL_DATABASE: nextcloud
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
shard3:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest # zizmor: ignore[unpinned-images]
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
ports:
- 5003:3306/tcp
env:
Expand All @@ -112,7 +112,7 @@ jobs:
MYSQL_DATABASE: nextcloud
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 10
shard4:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest # zizmor: ignore[unpinned-images]
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]
ports:
- 5004:3306/tcp
env:
Expand Down Expand Up @@ -151,6 +151,13 @@ jobs:
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword

- name: Enable MD5 MySQL support

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: Is this only needed in sharding? Or should it also be in phpunit-mysql?
And I guess we should change https://github.com/nextcloud/.github/blob/master/workflow-templates/phpunit-mysql.yml as well so apps start testing against it

if: matrix.mysql-versions == '9.7'
run: |
for MYSQL_PORT in 4444 5001 5002 5003 5004; do
echo "INSTALL COMPONENT 'file://component_classic_hashing';" | mysql -h 127.0.0.1 -P $MYSQL_PORT -u root -prootpassword
done

- name: Set up Nextcloud
env:
DB_PORT: 4444
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/phpunit-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ jobs:
fail-fast: false
matrix:
include:
- mysql-versions: '8.0'
php-versions: '8.3'
- mysql-versions: '8.4'
php-versions: '8.3'
- mysql-versions: '9.7'
php-versions: '8.5'

name: MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }}) - database tests
Expand All @@ -75,7 +75,7 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3

mysql:
image: ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }}:latest # zizmor: ignore[unpinned-images]
image: mysql:${{ matrix.mysql-versions }} # zizmor: ignore[unpinned-images]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickvergessen as we now have a docker cache in place we do not run into problems with docker hub anymore. Do we still need to use our own images?
If yes I will prepare the new image.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it more likely that we get hacked or mysql? :P
I guess both is fine

ports:
- 4444:3306/tcp
env:
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/lib/SetupChecks/SupportedDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class SupportedDatabase implements ISetupCheck {

private const MIN_MARIADB = '10.6';
private const MAX_MARIADB = '11.8';
private const MIN_MYSQL = '8.0';
private const MAX_MYSQL = '8.4';
private const MIN_MYSQL = '8.4';
private const MAX_MYSQL = '9.7';
private const MIN_POSTGRES = '14';
private const MAX_POSTGRES = '18';
private const MIN_ORACLE = '12.2';
Expand Down
10 changes: 10 additions & 0 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,11 @@
<code><![CDATA[getUsersForUserValue]]></code>
</DeprecatedMethod>
</file>
<file src="apps/files/lib/Command/RepairTree.php">
<DeprecatedMethod>
<code><![CDATA[md5]]></code>
</DeprecatedMethod>
</file>
<file src="apps/files/lib/Command/Scan.php">
<DeprecatedMethod>
<code><![CDATA[listen]]></code>
Expand Down Expand Up @@ -3232,6 +3237,11 @@
<code><![CDATA[$this->request->server]]></code>
</NoInterfaceProperties>
</file>
<file src="core/Migrations/Version24000Date20211230140012.php">
<DeprecatedMethod>
<code><![CDATA[md5]]></code>
</DeprecatedMethod>
</file>
<file src="core/Migrations/Version25000Date20220515204012.php">
<DeprecatedConstant>
<code><![CDATA[Types::JSON]]></code>
Expand Down
29 changes: 22 additions & 7 deletions lib/private/Setup/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace OC\Setup;

use Doctrine\DBAL\Platforms\MySQL80Platform;
use Doctrine\DBAL\Platforms\MySQL84Platform;
use OC\DatabaseSetupException;
use OC\DB\ConnectionAdapter;
Expand Down Expand Up @@ -39,6 +38,28 @@ public function setupDatabase(): void {
'dbpassword' => $this->dbPassword,
]);

// for MD5 support
// In MySQL 9+ MD5 has been deprecated and is only available as a component.
// Until we dropped the support for it on the function builder, we need to load the component.
if ($connection->getDatabasePlatform() instanceof MySQL84Platform) {
$statement = $connection->prepare("SHOW VARIABLES LIKE 'version';");
$result = $statement->executeQuery();
$row = $result->fetchAssociative();
$version = $row['Value'];
[$major, ] = explode('.', strtolower($version));
if ((int)$major >= 9) {
// check if the component is already loaded, if not load it
$statement = $connection->prepare("SELECT COUNT(*) FROM mysql.component WHERE component_urn = 'file://component_classic_hashing';");
$result = $statement->executeQuery();
$count = $result->fetchOne();
if ($count !== false && (int)$count === 0) {
// not yet loaded
$statement = $connection->prepare("INSTALL COMPONENT 'file://component_classic_hashing';");
$statement->executeStatement();
}
}
}

//create the database
$this->createDatabase($connection);

Expand Down Expand Up @@ -103,12 +124,6 @@ private function createDBUser(IDBConnection $connection): void {
$connection->executeStatement($query, [$name,$password]);
$query = "CREATE USER ?@'%' IDENTIFIED WITH caching_sha2_password BY ?";
$connection->executeStatement($query, [$name,$password]);
} elseif ($connection->getDatabasePlatform() instanceof Mysql80Platform) {
// TODO: Remove this elseif section as soon as MySQL 8.0 is out-of-support (after April 2026)
$query = "CREATE USER ?@'localhost' IDENTIFIED WITH mysql_native_password BY ?";
$connection->executeStatement($query, [$name,$password]);
$query = "CREATE USER ?@'%' IDENTIFIED WITH mysql_native_password BY ?";
$connection->executeStatement($query, [$name,$password]);
} else {
$query = "CREATE USER ?@'localhost' IDENTIFIED BY ?";
$connection->executeStatement($query, [$name,$password]);
Expand Down
1 change: 1 addition & 0 deletions lib/public/DB/QueryBuilder/IFunctionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface IFunctionBuilder {
*
* @return IQueryFunction
* @since 12.0.0
* @deprecated 35.0.0 - MD5 is not considered secure anymore, thus most databases have or will drop support for this function
*/
public function md5($input): IQueryFunction;

Expand Down
Loading