media_cdn

This commit is contained in:
merdan 2021-05-01 13:54:26 +05:00
parent a890bea60c
commit 1578658f07
2 changed files with 24 additions and 18 deletions

View File

@ -1,10 +1,16 @@
DELETE from orient_wordpress.arient_ru_posts where post_type not in ('post','attachment'); DELETE from orient_wordpress.arient_ru_posts where post_type not in ('post','attachment');
DELETE from orient_wordpress.arient_ru_posts where post_status in ('draft','auto-draft'); DELETE from orient_wordpress.arient_ru_posts where post_status in ('draft','auto-draft');
ALTER TABLE `rainlab_blog_posts` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, CHANGE `slug` `slug` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; ALTER TABLE `rainlab_blog_posts` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
CHANGE `slug` `slug` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content_html,published_at,published,created_at,updated_at,locale,id_en) INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content,content_html,published_at,published,
SELECT post_author,post_title,post_name,post_excerpt,post_content,post_date,1,post_date,post_modified,'en',id from orient_wordpress.arient_2_posts; created_at,updated_at,locale,id_en,powerseo_title,powerseo_description,
powerseo_robot_index,powerseo_robot_follow)
SELECT post_author,post_title,post_name,post_excerpt,post_content,post_content,post_date,1,post_date,post_modified,'en',
id, post_title, post_excerpt, 'index', 'nofollow'
from orient_wordpress.arient_2_posts
where post_type='post' and post_status='publish';
INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content,content_html,published_at,published,created_at,updated_at,locale,id_en) INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content,content_html,published_at,published,created_at,updated_at,locale,id_en)
SELECT post_author,post_title,post_name,post_excerpt,post_content,post_content,post_date,1,post_date,post_modified,'ru',id SELECT post_author,post_title,post_name,post_excerpt,post_content,post_content,post_date,1,post_date,post_modified,'ru',id
@ -17,16 +23,16 @@ Delete FROM arient_2_posts_temp WHERE post_date <'2019-01-01'
////////////////////////////////insert featured images ////////////////////////////////insert featured images
UPDATE rainlab_blog_posts rb UPDATE rainlab_blog_posts rb
inner join iatm_2_postmeta ip on rb.id_en = ip.post_id and ip.meta_key='_thumbnail_id' inner join iatm_orient_2_postmeta ip on rb.id_en = ip.post_id and ip.meta_key='_thumbnail_id'
inner join arient_2_posts_temp wp on wp.ID = ip.meta_value inner join iatm_orient_2_posts wp on wp.ID = ip.meta_value
set rb.featerd_image = wp.guid set rb.featured_image = REPLACE(wp.guid,'https://orient.tm/en/wp-content/uploads/sites/2/','/en/')
ALTER TABLE `rainlab_blog_posts` CHANGE `featured_image` `featured_image` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL; ALTER TABLE `rainlab_blog_posts` CHANGE `featured_image` `featured_image` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;
UPDATE rainlab_blog_posts rb UPDATE rainlab_blog_posts rb
inner join orient_wordpress.iatm_orient_postmeta ip on rb.id_ru = ip.post_id and ip.meta_key='_thumbnail_id' inner join orient_wordpress.iatm_orient_postmeta ip on rb.id_ru = ip.post_id and ip.meta_key='_thumbnail_id'
inner join orient_wordpress.arient_ru_posts wp on wp.ID = ip.meta_value inner join orient_wordpress.arient_ru_posts wp on wp.ID = ip.meta_value
set rb.featured_image = REPLACE(wp.guid,'https://orient.tm/en/wp-content/','') set rb.featured_image = REPLACE(wp.guid,'https://orient.tm/en/wp-content/','/ru/')
////////////// replace image address ////////////// replace image address
UPDATE rainlab_blog_posts set featured_image = REPLACE(featured_image,'https://orient.tm/en/wp-content/','') where featured_image !='' UPDATE rainlab_blog_posts set featured_image = REPLACE(featured_image,'https://orient.tm/en/wp-content/','') where featured_image !=''