[需求]想將GCP上的圖移回WordPress本機上,但介面找不到方法複原
[步驟]
- 利用 Qnap Hybird Backup Sync把GCP檔案同步回來本機
- 停用[WP-Stateless]
- 可安裝[Velvet Blues Update URL],取代原gcp的網址為本機網址
例如 https://storage.googleapis.com/myunix.idv.tw/ 取代為 https://myunix.idv.tw/ - 執行以下指令1,變更wp_postmeta資料
- 可安裝[Regenerate Thumbnails],重新產生縮圖
- 結束
指令1
UPDATE
`wp_postmeta` AS D,
(
SELECT post_id,NewValue
FROM
(
SELECT A.`post_id`
, CONCAT(B.`str_date`,A.`meta_value`) NewValue
FROM
(SELECT post_id,meta_value FROM `wp_postmeta` WHERE `meta_key` = '_wp_attached_file' AND `post_id` IN
(
SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key` = '_wp_attached_file' AND `meta_value` NOT LIKE 'nsl_avatars%' AND `meta_value` NOT LIKE '20%/%'
)) A
inner join
( SELECT post_id, SUBSTRING(meta_value,24,8) AS str_date FROM `wp_postmeta` WHERE `meta_key` = 'sm_cloud' AND `post_id` IN ( SELECT `post_id` FROM `wp_postmeta` WHERE `meta_key` = '_wp_attached_file' AND `meta_value` NOT LIKE 'nsl_avatars%' AND `meta_value` NOT LIKE '20%/%' ) ) B
ON A.post_id = B.post_id
) C
) AS E
SET D.`meta_value`=E.`NewValue`
WHERE D.`post_id`=E.`post_id`
AND D.`meta_key` = '_wp_attached_file'
留言
張貼留言