解決升級(jí) WordPress 時(shí)提示”另一更新正在進(jìn)行”
WordPress 4.5 下載安裝量已經(jīng)超過 600 萬,而第一個(gè)維護(hù)版本 WordPress 4.5.1 已發(fā)布,修復(fù)了 WordPress 4.5 以來的12個(gè)錯(cuò)誤。
情景再現(xiàn)
早上收到郵件,提示wordpress-4.5.1自動(dòng)升級(jí)失敗,只好手動(dòng)升級(jí)了。但是手動(dòng)升級(jí)提示:
升級(jí)wordpress-4.5.1失敗

第一個(gè)反應(yīng)是,通過object-cache.php緩存數(shù)據(jù)庫了,所以無法升級(jí)。但是把數(shù)據(jù)庫緩存停止了,手動(dòng)升級(jí)依然失敗。
解決辦法
這是由于在升級(jí)Wordpress時(shí),Wordpress會(huì)在數(shù)據(jù)庫wp_options表中增加core_updater.lock記錄。如中途打斷Wordpress升級(jí),這個(gè)記錄會(huì)留在數(shù)據(jù)庫中。當(dāng)下次升級(jí)時(shí),Wordpress檢測到此記錄的存在就會(huì)返回”另一更新正在進(jìn)行”。可通過以下方法解決:
方法一、通過MySQL數(shù)據(jù)庫管理工具(比如 phpMyAdmin),在 wp_options表中找到 core_updater.lock記錄并將這一列數(shù)據(jù)刪除。
方法二、通過終端登錄數(shù)據(jù)庫,假設(shè)表前綴是_wp,數(shù)據(jù)庫是wordpress,
1
2
3
4
5 | mysql -u root -p
use wordpress; select * from wp-options where options_name='core_updater.lock'; |

1 | delete from wp_options where option_name='core_updater.lock'; |
刷新更新頁面,就能升級(jí)了!
會(huì)員登錄
賬號(hào)登錄還沒有賬號(hào)?立即注冊