折騰了一天,終于弄清楚了本地附件轉(zhuǎn)換到遠(yuǎn)程附件的問題了,目前,相冊,論壇附件,圖片,空間,一切都正常了。
下面來給大家分享經(jīng)驗:
本地附件轉(zhuǎn)到遠(yuǎn)程附件:
論壇上有一些帖子,代碼教程是:
remote=remote+1;
如果你只在數(shù)據(jù)庫了操作了一次,問題還不大,如果你重復(fù)操作了,那么你的問題就大了,你會發(fā)現(xiàn)相冊里的圖片你都找不到,而且甚至FTP目錄里都找不到這個文件名的文件,所以下面我就來談我的方法:
我使用的工具:帝國備份王
這個可以先把數(shù)據(jù)庫備份了,然后再來進(jìn)行sql升級操作,都在這個備份王里面完成。
1、先備份數(shù)據(jù)庫
2、附件的移動
3、開始sql語句升級
本地附件轉(zhuǎn)移到遠(yuǎn)程附件,在帝國備份王里執(zhí)行如下sql,記得要設(shè)置數(shù)據(jù)庫名稱和編碼哦,關(guān)鍵在加粗的第四句,如果盲目的+1,就會出現(xiàn)一些圖片無法找到,而且在ftp上也找不到的情況。
update pre_portal_article_title set remote=1 where remote=0;
update pre_portal_attachment set remote=1 where remote=0;
update pre_portal_topic_pic set remote=1 where remote=0;
update pre_home_pic set remote=remote+1;
update pre_forum_attachment_0 set remote=1 where remote=0;
update pre_forum_attachment_1 set remote=1 where remote=0;
update pre_forum_attachment_2 set remote=1 where remote=0;
update pre_forum_attachment_3 set remote=1 where remote=0;
update pre_forum_attachment_4 set remote=1 where remote=0;
update pre_forum_attachment_5 set remote=1 where remote=0;
update pre_forum_attachment_6 set remote=1 where remote=0;
update pre_forum_attachment_7 set remote=1 where remote=0;
update pre_forum_attachment_8 set remote=1 where remote=0;
update pre_forum_attachment_9 set remote=1 where remote=0;
遠(yuǎn)程附件轉(zhuǎn)移到本地:
把以上的 0和1進(jìn)行互換,0表示本地,1表示遠(yuǎn)程,
update pre_portal_article_title set remote=0 where remote=1;
update pre_portal_attachment set remote=0 where remote=1;
update pre_portal_topic_pic set remote=0 where remote=1;
update pre_home_pic set remote=remote-1;
update pre_forum_attachment_0 set remote=0 where remote=1;
update pre_forum_attachment_1 set remote=0 where remote=1;
update pre_forum_attachment_2 set remote=0 where remote=1;
update pre_forum_attachment_3 set remote=0 where remote=1;
update pre_forum_attachment_4 set remote=0 where remote=1;
update pre_forum_attachment_5 set remote=0 where remote=1;
update pre_forum_attachment_6 set remote=0 where remote=1;
update pre_forum_attachment_7 set remote=0 where remote=1;
update pre_forum_attachment_8 set remote=0 where remote=1;
update pre_forum_attachment_9 set remote=0 where remote=1;
更多信息請查看IT技術(shù)專欄