Issues (19)

test-bootstrap.php (3 issues)

Labels
Severity
1
<?php
2
3
require('vendor/autoload.php');
4
5
$dbname = DB_NAME;
0 ignored issues
show
The constant DB_NAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
6
$dbuser = DB_USER;
0 ignored issues
show
The constant DB_USER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
7
$dbpass = DB_PASS;
0 ignored issues
show
The constant DB_PASS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
8
9
// Cleanup SQL
10
$user_delete = "DROP USER IF EXISTS $dbuser@'localhost'; ";
11
$database_delete = "DROP DATABASE IF EXISTS $dbname; ";
12
$sql_cleanup = $user_delete . $database_delete;
13
14
// Setup SQL
15
$db_create = "CREATE DATABASE $dbname; ";
16
$user_create = "CREATE USER '$dbuser'@'localhost' IDENTIFIED BY '$dbpass'; ";
17
$user_alter = "ALTER USER '$dbuser'@'localhost' IDENTIFIED with mysql_native_password BY '$dbpass'; ";
18
$user_grant = "GRANT ALL PRIVILEGES ON *.* TO '$dbuser'@'localhost';";
19
20
$sql_setup = $sql_cleanup . $db_create . $user_create . $user_alter . $user_grant;
21
print $sql_setup;
22
echo "Please enter mysql root password to set up a database environment for testing\n";
23
exec("echo \"$sql_setup\" | mysql -u root -p");
24