Skip to content

Instantly share code, notes, and snippets.

@Faisalawanisee
Last active February 12, 2019 15:24
Show Gist options
  • Select an option

  • Save Faisalawanisee/a4eea41ef155448c3df84b74e6eb5373 to your computer and use it in GitHub Desktop.

Select an option

Save Faisalawanisee/a4eea41ef155448c3df84b74e6eb5373 to your computer and use it in GitHub Desktop.
WordPress testing command
@ECHO OFF
SET BIN_TARGET=%~dp0/./create-db.php
php "%BIN_TARGET%" %*
<?php
if (!empty($argv[1])) {
$db_name = $argv[1];
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database
$sql = "CREATE DATABASE $db_name";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}
$conn->close();
die();
}
echo "Please add database name";
@ECHO OFF
SET /a _rand=(%RANDOM%*500/32768)+1
C:
cd \xampp\htdocs\wordpress\ && mkdir wp_test_%_rand% && cd wp_test_%_rand% && wp core download && create-db wp_test_%_rand% && wp core config --dbhost=localhost --dbname=wp_test_%_rand% --dbuser=root --dbpass= && chmod 644 wp-config.php && wp core install --url=wordpress.local/wp_test_%_rand% --title="WordPress Test %_rand%" --admin_name=admin --admin_password=admin --admin_email=dev@wordpress.local && ECHO Open URL http://wordpress.local/wp_test_%_rand%
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/wordpress"
ServerName wordpress.local
<Directory "C:/xampp/htdocs/wordpress">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment