if [ -d ~/bin/migbin ]; then
~/bin/migbin/updatemigbin
else
mkdir ~/bin 2>/dev/null
cd ~/bin
git clone https://github.com/coolcourd/migbin.git
cd -
fi
source ~/bin/migbin/bashrc
Makes a backup of the wordpress site called psbu.tar
If run in BH brand accounts, prints off current directory list and their assigned document roots.
Alternative for dumping wp databases, doesn't use wpcli, works on older wp versions.
exports all databases placing them in ~/migration_dbs/dbs
Runs a find for wordpress sites in public_html and imports the matching sql file from ~/migration/dbs.
(only runs if there is only one sql file that contains the full database name as read from each wp-config.php file.)
Runs both fixfiles and fixdirs
Runs a find in public_html and uses fixwps on all wordpress installs
Runs from current directory and recursivly sets all directories to 755.
Runs from current directory and recursivly sets all files to 644.
Runs a set of common wordpress fixes in your current directory.
Accepts a php version, WordPress version and list of urls to WordPress backup files and installs the site in the current directory.
example usage:
$ free_wordpress --wp-version="5.3.3" --php-version="7.3" https://url.1 https://url.2 https://url.3 ...
urls are automatically detected in the command-line arguments.
- -h --help : displays this message
- -t --test : runs automated testing on the functions in this file.
- -w --wordpress-version : sets the wordpress version of the install
- -p --php-version : sets the php version of the install
Builds an outline of all wordpress sites on the account and saves to ~/migration/migstuff/mysites.txt
Sets WordPress site in current working directory to us http:// protocol for the home and siteurl options.
Sets WordPress site in current working directory to us https:// protocol for the home and siteurl options.
Imports a psbu db and all.
Search for all Wordpress websites and lists the URL and filepath for each. You can pass in a domain to search for specifically.
Example:
- listwp domain.com
Prompts for lftp creds to autogenerate lftp line.
- -go --opens lftp connection instead of printing line
Prompts you for a list of imap lines and creates email accounts for you. Does not play nicely with some passwords.
Imap lines look like this: source-imap-mailserver source-email-address source-password destination-imap-mailserver destination-email-address destination-password
syncs etc and mail. used to sync an individual domain. does not overwrite existing pw files. outputs mailcount differences. example:
- mailsync example.com # syncs mail for example.com
sets the tempurl back to the main url based on the .mainurl file located in the cwd
gives you a list of ea-php versions installed on the server and lets you pick one
imports the matching sql file from ~/migration/dbs.
Creates two directories, ~/migration/files and ~/migration/dbs. This is used to store migration backups on a server.
installs migbin on the source in the home directory.
Takes the path to a wordpress site on the source and the path to install it to one the destination.
runs a command on the server setup with the setupssh command
example:
- migrun ls migrationdbs
Logs in to the source server
purges the cache and runs a search-replace for wordpress sites.
- -on --secures site, replaces http links with https
- -off --disables https for the site, deactivates a few plugins which force ssl on wp sites.
rsyncs from the source server with first argument to the logged in server as the second argument. examples:
- migsync public_html/ ~/migration/files
- migsync etc/example.com ~/etc You can brace expand to grab multiple directoried from a source if you wrap the first argument in singlequotes. example:
- migsync '{etc,mail,public_html,migrationdbs}' ~/migration
Takes in a list of directories to make and cds you to the last one. This uses mkdir -p.
Moves wordpress files and directories out of the current directory and into ~/premig$(date)
looks for .mainurl files and sets the WordPress home and siteurl options to it's contents
This is a core function to how many others run. This function prompts you to give it a login string for a source server and will prompt you for the password. It will setup an ssh key and copy it to the source server so you can easily communicate with the source server with commands like mailsync, migrun and migsync.
checks the cgi php version running in the current directory.
migsyncs migraiondbs to ~/migration/dbs
Displays the bluehost temporaryurl for the current directory.
Sets the wordpress home and siteurl settings to the bluehost temporaryurl for the current directory.
Uses git pull to update all scripts to the current version on github
displays dns settings for the domain you provide as the argument.
This is wpcli use with --help to see help for every command
Imports an sql file, as the argument, and sets up a wp-config.php file for it if there is already a wp-config file in the current directory.
corrects rewrite rules in the .htaccess
Displays info about te wordpress site in the current dir.
Installs a fresh wordpress site or repairs existing.
- -db --runs wpdbimport after install
Installs and activates the plugin enable-jquery-migrate-helper for wp sites w/ js errors
configures a wordpress site from the backup directory to it's live directory example:
- wplive ~/migration/files/ ~/public_html
Lists all active plugins and toggles off then on. Situational use only, deactivating plugins can cause issues w/ sites db's.
Updates wp-config.php variables in the current dir.
Lets you read and/or set the home and/or siteurl option for the wordpress site in the current directory.
Run without flags to only read the values.
- -n Sets both to provided argument.
- -h Sets home to provided argument.
- -s Sets siteurl to provided argument.