Improvements are welcome!
Created
May 9, 2018 18:51
-
-
Save danteoh/f366a9a6a6a66a771e45b260326a2ee7 to your computer and use it in GitHub Desktop.
Scripts to migrate Wordpress uploads to S3 for WP Offload S3 Lite
This file contains 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
-- replace YOURREGION and YOURBUCKET accordingly | |
-- this will dump a number of php lines for you to run. paste all these rows into a file and run it. Use the output in the next file | |
select CONCAT( | |
"<?php print(\"(", | |
ID, | |
", 'amazonS3_info', '\".str_replace('O:8:\"stdClass\"', 'a', serialize(json_decode(\"",'{ \\"region\\": \\"YOURREGION\\", \\"bucket\\": \\"YOURBUCKET\\", \\"key\\": \\"', SUBSTRING(guid, 31), '\\"}"\))) ."\'),") ?>') from db224570_1clk_wordpress_qq175dggRSHpFIs1.wp_posts where post_type = 'attachment'; |
This file contains 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
-- paste the output from dump.sql (after running it through PHP) onto line 3: | |
insert into wp_postmeta (post_id, meta_key, meta_value) values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment