62 lines
4.4 KiB
SQL
62 lines
4.4 KiB
SQL
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');
|
|
|
|
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,content_html,published_at,published,
|
|
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)
|
|
SELECT post_author,post_title,post_name,post_excerpt,post_content,post_content,post_date,1,post_date,post_modified,'ru',id
|
|
from orient_wordpress.arient_ru_posts where post_type='post' and post_status='publish';
|
|
|
|
UPDATE rainlab_blog_posts SET powerseo_title = title, powerseo_description = excerpt, powerseo_robot_index = 'index', powerseo_robot_follow = 'nofollow';
|
|
|
|
//////// angliski postlarda 2019dan ashakdaky materiallar pozulan
|
|
Delete FROM arient_2_posts_temp WHERE post_date <'2019-01-01'
|
|
|
|
////////////////////////////////insert featured images
|
|
UPDATE rainlab_blog_posts rb
|
|
inner join iatm_orient_2_postmeta ip on rb.id_en = ip.post_id and ip.meta_key='_thumbnail_id'
|
|
inner join iatm_orient_2_posts wp on wp.ID = ip.meta_value
|
|
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;
|
|
|
|
UPDATE rainlab_blog_posts rb
|
|
inner join iatm_orient_postmeta ip on rb.id_ru = ip.post_id and ip.meta_key='_thumbnail_id'
|
|
inner join iatm_orient_posts wp on wp.ID = ip.meta_value
|
|
set rb.featured_image = REPLACE(REPLACE(wp.guid,'https://orient.tm/wp-content/uploads/','/ru/'),'http://orient.tm/wp-content/uploads/','/ru/')
|
|
where rb.locale = 'ru'
|
|
|
|
////////////// replace image address
|
|
UPDATE rainlab_blog_posts set featured_image = REPLACE(featured_image,'https://orient.tm/en/wp-content/','') where featured_image !=''
|
|
|
|
///////////////////////post views//////
|
|
|
|
INSERT INTO vdomah_blogviews_views (views,post_id)
|
|
select pp.meta_value,rb.id FROM iatm_orient_2_postmeta pp
|
|
INNER join rainlab_blog_posts rb on rb.id_en = pp.post_id AND rb.locale = 'en' and pp.meta_key = 'views';
|
|
INSERT IGNORE INTO vdomah_blogviews_views (views,post_id)
|
|
select pp.meta_value,rb.id FROM iatm_orient_postmeta pp
|
|
INNER join rainlab_blog_posts rb on rb.id_ru = pp.post_id AND rb.locale = 'ru' and pp.meta_key = 'views';
|
|
////post inside image
|
|
UPDATE rainlab_blog_posts set content = replace(content,'http://orient.tm/wp-content/uploads/','storage/app/media/ru/')
|
|
|
|
UPDATE rainlab_blog_posts set content = replace(content,'https://orient.tm/wp-content/uploads/','/storage/app/media/ru/'), content_html = REPLACE(content_html,'https://orient.tm/wp-content/uploads/','/storage/app/media/ru/')
|
|
|
|
UPDATE rainlab_blog_posts set content = replace(content,'https://orient.tm/en/wp-content/uploads/sites/2/','/storage/app/media/en/'), content_html = REPLACE(content_html,'https://orient.tm/en/wp-content/uploads/sites/2/','/storage/app/media/en/')
|
|
where content_html LIKE '%https://orient.tm/en/wp-content/uploads/sites/2/%'
|
|
|
|
UPDATE rainlab_blog_posts set content = replace(content,'storage/app','https://cdn.orient.tm/storage/app'), content_html = REPLACE(content_html,'storage/app','https://cdn.orient.tm/storage/app')
|
|
where content_html LIKE '%storage/app%'
|
|
|
|
UPDATE rainlab_blog_posts set content = replace(content,'http://orient.tm/wp-content/uploads','https://cdn.orient.tm/storage/app/media/ru'), content_html = REPLACE(content_html,'http://orient.tm/wp-content/uploads','https://cdn.orient.tm/storage/app/media/ru')
|
|
where content_html LIKE '%http://orient.tm/wp-content/uploads%'
|