Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mariadb compatibility issues #98

Open
2 tasks done
silverstripesk opened this issue Oct 15, 2024 · 0 comments
Open
2 tasks done

Mariadb compatibility issues #98

silverstripesk opened this issue Oct 15, 2024 · 0 comments

Comments

@silverstripesk
Copy link

Module version(s) affected

any

Description

Dumping DB with latest MariaDB versions generates /*!999999- enable the sandbox mode */ on top of sql file. Importing such file in older versions is not successful.

More info: [https://mariadb.org/mariadb-dump-file-compatibility-change/]

How to reproduce

Just dump on latest MariaDB version and try to import to older one.

Possible Solution

Changing Webroot.php

from

$stream = $sspak->readStreamForFile('database.sql.gz');
		$this->exec("gunzip -c | sed '/^CREATE DATABASE/d;/^USE/d' | mysql --default-character-set=utf8 $usernameArg $passwordArg $hostArg $portArg $databaseArg", array('inputStream' => $stream));
		fclose($stream);
		return true;

to

$stream = $sspak->readStreamForFile('database.sql.gz');
		$this->exec("gunzip -c | sed '1{/999999.*sandbox/d}' | sed '/^CREATE DATABASE/d;/^USE/d' | mysql --default-character-set=utf8 $usernameArg $passwordArg $hostArg $portArg $databaseArg", array('inputStream' => $stream));
		fclose($stream);
		return true;

should make it working again.

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants