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

Fix db name with hypen issue #346

Merged
merged 7 commits into from Aug 7, 2020

Conversation

kirtangajjar
Copy link
Contributor

@kirtangajjar kirtangajjar commented Jul 31, 2020

This PR fixes issue where if you specify a dbname with hyphen, you won't be able to create db. See - https://community.easyengine.io/t/cant-create-a-website-with-dbname-option/13926

What this PR does is, it replaces " with ' and wraps db name in backticks `.
i.e.

Before:

mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e"CREATE USER 'example.local-N4Ujuo'@'%' IDENTIFIED BY 'ZrNCJlx2KfsI'; CREATE DATABASE humo-gen; GRANT ALL PRIVILEGES ON humo-gen.* TO 'example.local-N4Ujto'@'%'; FLUSH PRIVILEGES;"

After:

mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e'CREATE USER "example.local-N4Ujuo"@"%" IDENTIFIED BY "ZrNCJlx2KfsI"; CREATE DATABASE `humo-gen`; GRANT ALL PRIVILEGES ON `humo-gen`.* TO "example.local-N4Ujto"@"%"; FLUSH PRIVILEGES;"

Also, I noticed in some cases when site creation fails and if /tmp/db_exec is not removed, site creation fails, so I've removed that file on site deletion.

Closes: EasyEngine/easyengine#1459

@kirtangajjar kirtangajjar added this to In progress in v4 Maintenance Releases via automation Jul 31, 2020
src/helper/class-ee-site.php Outdated Show resolved Hide resolved
v4 Maintenance Releases automation moved this from In progress to Needs review Jul 31, 2020
@kirtangajjar kirtangajjar added this to Review in progress in v4.1.2 Aug 7, 2020
Signed-off-by: Riddhesh Sanghvi <riddhesh237@gmail.com>
Copy link
Member

@mrrobot47 mrrobot47 left a comment

Choose a reason for hiding this comment

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

LGTM

v4 Maintenance Releases automation moved this from Needs review to Reviewer approved Aug 7, 2020
v4.1.2 automation moved this from Review in progress to Reviewer approved Aug 7, 2020
@mrrobot47 mrrobot47 merged commit 85e542f into EasyEngine:develop Aug 7, 2020
v4 Maintenance Releases automation moved this from Reviewer approved to Done Aug 7, 2020
v4.1.2 automation moved this from Reviewer approved to Done Aug 7, 2020
@mrrobot47 mrrobot47 deleted the fix/db-name-hyphen branch August 7, 2020 05:03
v4.1.2 automation moved this from Done to Review in progress Aug 11, 2020
v4.1.2 automation moved this from Review in progress to Reviewer approved Aug 11, 2020
v4.1.2 automation moved this from Reviewer approved to Done Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
v4.1.2
  
Done
Development

Successfully merging this pull request may close these issues.

Cleanup /tmp/db_exec on site cleanup
2 participants