從 changeset 5510 開始,新的 tagging function 斷斷續續再次 commit 到 trunk 中,也許這次有較多時間計劃,在 database schema 方面亦和之前 commit 的有所不同,之前是沿用 wp_categories table,增加 tag_count field 來儲存使用這 tag 的文章數目,在 table wp_post2cat 中新增 rel_type 這 field 來分辨 category 還是 tag。
現在他們的做法不同了,wp_categories 和 wp_post2cat 不加新 field 了,取而代之是新增 3 個 tables。
- wp_terms
- wp_term_relationships
- wp_term_taxonomy
wp_terms 是用來儲存 category 和 tag 的,wp_term_taxonomy 用來分辨 wp_terms 內的是 tag、category 還是 link_category(即現時的 blogroll category)和使用這個 taxonomy 的文章、blogroll 的數目,wp_term_relationships 用來儲存 taxonomy 和文章、blogroll 的關係。而 wp_categories、wp_post2cat 和 wp_link2cat 這 3 個 tables 將會刪除不用。
現在 trunk 中有關 taxonomy 的 functions 已算齊全,想試用的朋友可以用 SVN checkout。
剛試了一下5555, 超多bug.
@LEMONed:沒辦法,始終是 SVN - 開發中版本。 :P
It seems to me the new implementation still a bit complicated... of course they probably have their reason which I do not know. But I have implemented a tagging function for my blog (NucleusCMS) via a plugin. All I need is a new table for tags. it co-exist with category. Of course, a drawback of this approach is all other functions that want tagging function need to re-do the same work, just like what did.... I actually implement tagging for our blogroll plugin as well. :wink:
I am a believer of KISS
@admun:看來他們是想 generic 用同一 set tables 來處理 tags、category,題外話,什麼是 "KISS"?"Keep In Simple Sxxx"?
(keep in simple,stupid!)
KISS == Keep It Simple Stupid 8