Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit03abe36d5c25d3007927443d7e0d366bc5037097 (patch)
Author
 metodiew <stanko@metodiew.com>
2020-07-08 20:37:56 +0300
Committer
 metodiew <stanko@metodiew.com>
2020-07-08 20:37:56 +0300
Files216ec9bf91adabf572b6bc2cda760517e1f786b6
tues-interns-2020-03abe36d5c25d3007927443d7e0d366bc5037097.tar
tues-interns-2020-03abe36d5c25d3007927443d7e0d366bc5037097.tar.gz
tues-interns-2020-03abe36d5c25d3007927443d7e0d366bc5037097.zip
Parent6b86b5d7ffc658444764bab7edfca40c8f97ec92 (diff)
Add a deploy.php file and update some setup details
2 files changed, 35 insertions, 0 deletions
-rw-r--r--README.md18
-rw-r--r--deploy.php17
diff --git a/README.md b/README.md
index 59a954d..ff4d4c1 100644
--- a/README.md
+++ b/README.md
@@ -32,3 +32,21 @@ ServerName local.carmag.com
13. Edit `wp-config.php.` Make sure to have `WP_DEBUG` constant set to true!
14. You should be all set now!
+
+## Deployment steps
+In the root directory, there is a `deploy.php` file with some basic commands. You can execute a deployment, pulling the latest master by visiting `url/deploy.php`.
+
+If you want to deploy to our staging, you can open [https://carmag.dxdemos.online/deploy.php](https://carmag.dxdemos.online/deploy.php).
+
+## Pulling the latest staging database
+We have created a small PHP script `db-dump.php`. When you open `url/db-dump.php` and enter the following username and password `dxinterns/dxinterns1`, we'll run a quick PHP script, generating the latest database and you'll be able to download a SQL file.
+
+Keep in mind this is going to dump the database from the staging, which has different URL, in our case [https://carmag.dxdemos.online/](https://carmag.dxdemos.online/).
+When you import the database, you'll need to update two rows:
+`wp_options.home` and `wp_options.siteurl`.
+
+The eaiest approach would be to add this on your `wp-config.php` file:
+```
+define( 'WP_HOME', 'http://local.carmag.com/' );
+define( 'WP_SITEURL', 'http://local.carmag.com/' );
+```
diff --git a/deploy.php b/deploy.php
new file mode 100644
index 0000000..9035b63
--- /dev/null
+++ b/deploy.php
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * Get the latest version of the master branch
+ */
+echo shell_exec( 'git fetch origin master; ');
+echo shell_exec( 'git checkout master; ');
+echo shell_exec( 'git pull origin master; ');
+echo shell_exec( 'wp cache flush ');
+
+// Load WordPress
+require_once( 'wp-load.php' );
+
+// Display a link to the homepage
+echo '<div>';
+echo 'You are ready to check the <a href="' . home_url( '/' ) . '">Homepage</a>';
+echo '</div>'; \ No newline at end of file