跳到主要內容

[WordPress][WP-Stateless]將GCP上的圖移回本機上

 [需求]想將GCP上的圖移回WordPress本機上,但介面找不到方法複原


[步驟]

  1. 利用 Qnap Hybird Backup Sync把GCP檔案同步回來本機
  2. 停用[WP-Stateless]
  3. 可安裝[Velvet Blues Update URL],取代原gcp的網址為本機網址
    例如 https://storage.googleapis.com/myunix.idv.tw/ 取代為 https://myunix.idv.tw/
  4. 執行以下指令1,變更wp_postmeta資料
  5. 可安裝[Regenerate Thumbnails],重新產生縮圖
  6. 結束

指令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' 

留言

這個網誌中的熱門文章

How do I compile ffmpeg on a QNAP NAS

Tested on QNAP TS-419p+ with ARM CPU, but should work the same way for others. Install “Optware (IPKG)” qpkg from  http://www.qnap.com/qpkg.asp In case the “ipkg update” fails, try to adjust the following two config files: [/opt/etc/ipkg] # more tsx19-kmod.conf src/gz cs08q1armel http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable [/opt/etc/ipkg] # more tsx19.conf src/gz cs08q1armel http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable ipkg update ipkg install optware-devel ipkg install git ipkg install yasm ipkg install lame mkdir /opt/compile cd /opt/compile git clone git://git.videolan.org/ffmpeg.git cd ffmpeg ./configure --enable-ssse3 --prefix=/opt --extra-cflags='-I/opt/include' --extra-ldflags='-L/opt/lib' --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-libmp3lame make make install replace built-in ffmpeg with link to new version rm /usr/bin/ffmpeg ln -s /opt/bin/ffmpeg /usr/bin http://bubbl

Setting up a CUPS server with Docker on a Synology NAS for my Brother printer

I made the unfortunate mistake of purchasing a cheap brother printer, the Brother HL-L2300D, which is USB only. And not only is it a USB printer, it is a Winprinter which makes it very limited in anything other than Windows. from Pocket http://ift.tt/2gbYuYH via IFTTT

台灣第一家「真.無人商店」登場,711 推出台灣第一家臉部辨識無人超商!

【我們為什麼挑選這篇文章】上週我們才看了亞馬遜盛大開幕,這週 711 就公布了無人商店實驗店,在這如雨後春筍般的無人商店潮中,我們的生活正在疾速變動。但我覺得全家的概念也蠻有意思的:「與其推出一間跨時代概 from Pocket http://ift.tt/2BCDxQp via IFTTT