Joined June 2013
·
Posted to
Make postgres default to UTF8
over 1 year
ago
Posted to
SQL to Change WordPress Domain URL
over 1 year
ago
I do the same thing, only I also do extra run for escaped urls, and include any plugin tables too.
LOCAL_DOMAIN="example.local";
SITE_DOMAIN="www.example.com";
WP_DIR="wp";
LOCAL_URL="http://$LOCAL_DOMAIN";
LOCAL_URL_="http:\/\/$LOCAL_DOMAIN";
SITE_URL="http://$SITE_DOMAIN";
SITE_URL="http:\/\/$SITE_DOMAIN";
LOCAL_WP_URL="$LOCAL_URL/$WP_DIR";
LOCAL_WP_URL_="$LOCAL_URL\/$WP_DIR";
SITE_WP_URL="$SITE_URL/$WP_DIR"
SITE_WP_URL_="$SITE_URL\/$WP_DIR"
mysql -u"$DB_USER" -p"$DB_PASSWORD" -h"$DB_HOST" "$DB_NAME" << EOFMYSQL
UPDATE $DB_NAME.wp_options SET option_value = replace(option_value, '$LOCAL_WP_URL', '$SITE_WP_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE $DB_NAME.wp_options SET option_value = replace(option_value, '$LOCAL_URL', '$SITE_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE $DB_NAME.wp_posts SET guid = replace(guid, '$LOCAL_WP_URL','$SITE_WP_URL');
UPDATE $DB_NAME.wp_posts SET guid = replace(guid, '$LOCAL_URL','$SITE_URL');
UPDATE $DB_NAME.wp_posts SET post_content = replace(post_content, '$LOCAL_WP_URL', '$SITE_WP_URL');
UPDATE $DB_NAME.wp_posts SET post_content = replace(post_content, '$LOCAL_URL', '$SITE_URL');
UPDATE $DB_NAME.wp_postmeta SET meta_value = replace(meta_value,'$LOCAL_WP_URL','$SITE_WP_URL');
UPDATE $DB_NAME.wp_postmeta SET meta_value = replace(meta_value,'$LOCAL_URL','$SITE_URL');
UPDATE $DB_NAME.wp_links SET link_target = replace(link_target,'$LOCAL_WP_URL_','$SITE_WP_URL_');
UPDATE $DB_NAME.wp_links SET link_target = replace(link_target,'$LOCAL_URL_','$SITE_URL_');
UPDATE $DB_NAME.wp_usermeta SET meta_value = replace(meta_value,'$LOCAL_WP_URL_','$SITE_WP_URL_');
UPDATE $DB_NAME.wp_usermeta SET meta_value = replace(meta_value,'$LOCAL_URL_','$SITE_URL_');
EOFMYSQL
Posted to
See your top 10 most used terminal commands
over 1 year
ago
218 git
49 ls
38 cd
22 sudo
21 composer
19 bower
14 nano
13 ssh
12 al
9 grep
Posted to
How I harmlessly pwn'ed a competitor with Javascript
over 1 year
ago
Classic!
Posted to
phpinfo() the right way!
over 1 year
ago
Very good points and nice elaboration, thanks
Achievements
165 Karma
12,176 Total ProTip Views
Nephila Komaci
Have at least one original repos where PHP is the dominant language
Nephila Komaci 3
Have at least three original repos where PHP is the dominant language
Walrus
The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos
Charity
Fork and commit to someone's open source project in need
Python 3
Have at least three original repos where Python is the dominant language
Python
Would you expect anything less? Have at least one original repo where Python is the dominant language