Last active
February 12, 2019 15:24
-
-
Save Faisalawanisee/a4eea41ef155448c3df84b74e6eb5373 to your computer and use it in GitHub Desktop.
WordPress testing command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ECHO OFF | |
| SET BIN_TARGET=%~dp0/./create-db.php | |
| php "%BIN_TARGET%" %* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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