wp-change-domain
WP Change Domain
The wp-change-domain application is used to build a set of SQL commands and with that, update all urls of a wordpress installation (with all methods covered by php unit tests).
Installation
- The source files is PSR-2 compatible.
- Autoloading is PSR-4 compatible.
To install this web application you must run this commands on your terminal.
$ git clone https://github.com/jpcercal/wp-change-domain $ cd wp-change-domain/ $ composer install $ bower install $ npm install $ grunt production $ cp .env.example .env $ mkdir -p storage/cache $ mkdir -p storage/logs $ chmod -Rf 777 storage/
Running a Web Server
After the steps that you followed to install this application, you must run a web server. So, type the following command on your terminal to create a web server.
$ php -S 0.0.0.0:8080 -t public public/index.php
Note that this command must be executed on root directory of this web application.
Documentation
This web application was developed using AngularJS and with it you can change easily the domain of your wordpress installation.
Well, you can see below the HTTP routes where this application will handle your requests.
GET / will load the web application form.
POST /api/change-domain will receive a content type as application/json
with the following content:
{ "tablePrefix": "wp_", "numberOfBlogs": 1, "domainTo": "http://www.your.old.domain", "domainFrom": "http://your.new.domain" }
This request will create a response where the content type will be application/json
with the following content:
{ "sql":[ "UPDATE wp_options SET option_value = REPLACE(option_value, u0027http://www.your.old.domainu0027, u0027http://your.new.domainu0027) WHERE option_name = u0027homeu0027 OR option_name = u0027siteurlu0027 OR option_name = u0027ck_wp_panel_customu0027;", "UPDATE wp_posts SET guid = REPLACE(guid, u0027http://www.your.old.domainu0027, u0027http://your.new.domainu0027);", "UPDATE wp_posts SET post_content = REPLACE(post_content, u0027http://www.your.old.domainu0027, u0027http://your.new.domainu0027);", "UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, u0027http://www.your.old.domainu0027, u0027http://your.new.domainu0027);", "UPDATE wp_site SET domain = REPLACE(domain, u0027http://www.your.old.domainu0027, u0027http://your.new.domainu0027);", "UPDATE wp_blogs SET domain = REPLACE(domain, u0027http://www.your.old.domainu0027, u0027http://your.new.domainu0027);" ] }
Contributing
- Give me a star =)
- Fork it
-
Create your feature branch (
git checkout -b my-new-feature
) - Make your changes
-
Commit your changes (
git commit -am 'Added some feature'
) -
Push to the branch (
git push origin my-new-feature
) - Create new Pull Request