User Tools

Site Tools


wordpress

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wordpress [2009/08/04 15:03] suapapawordpress [2013/08/03 05:04] (current) – external edit 127.0.0.1
Line 8: Line 8:
 DELETE FROM wp_posts WHERE post_type = "revision"; DELETE FROM wp_posts WHERE post_type = "revision";
 </code> </code>
 +  *[[http://luv4.us/archives/1626|WP 자동저장/리비전 기능 조절하기]]
 <code python> <code python>
-db = MySQLdb.connect(db='suapapa_blog', user='blog_admin', passwd='password', host='localhost')+mport MySQLdb 
 + 
 +db = MySQLdb.connect(db='suapapa_blog', user='blog_admin', passwd='******', host='localhost')
 c = db.cursor() c = db.cursor()
-c.execute('select id from wp_posts')+c.execute('DELETE FROM wp_posts WHERE post_type = "revision"'
 +c.execute('SELECT id FROM wp_posts')
 l = c.fetchall() l = c.fetchall()
 postIDs = map(lambda x: x[0], l) postIDs = map(lambda x: x[0], l)
  
 +c.execute('select meta_id, post_id from wp_postmeta')
 +l_meta = c.fetchall()
 +delete_candidates = []
 +for mid, pid in l_meta:
 +    if not pid in postIDs:
 +        delete_candidates.append(mid)
 +
 +print len(delete_candidates), '/', len(l_meta), delete_candidates
 +
 +for mid in delete_candidates:
 +    c.execute('DELETE FROM wp_postmeta WHERE meta_id=%d'%mid)
 +    print '.',
 +
 +db.commit()
 +</code>
 +
 +====== 다국어 지원 ======
 +  *[[http://wordpress.org/extend/plugins/tags/multilingual|다국어지원 플러그인들]]
 +===== wp_multilingual =====
 +저장된 번역은 다음과 같이 쌍으로 존재함.
 +<code mysql>
 +select meta_id,post_id,meta_key from wp_postmeta;
 +|    1338 |     421 | translations        |
 +|    1339 |     421 | searchsyn           |
 +</code>
 +/home/suapapa/wp-content/plugins/wp-multilingual/multilingual.php
 +<code php>
 +$str = serialize(array(base64_encode(serialize(unserialize(serialize($translation))))));
 +...
 +$GLOBALS['wpdb']->query(
 +"INSERT INTO ".$GLOBALS['table_prefix'].
 +"postmeta (post_id,meta_value,meta_key) VALUES ('".$item['ID']."', '".$str ."', 'translations')"); #알수없게 인코딩된 데이타
 +$GLOBALS['wpdb']->query(
 +"INSERT INTO ".$GLOBALS['table_prefix'].
 +"postmeta (post_id,meta_value,meta_key) VALUES ('".$item['ID']."', \
 +'".WP_Multilingual::SafeVar(serialize(unserialize(serialize($translation))))."', 'searchsyn')"); #한글토막들 (regex 패턴?)
 +
 +</code>
 +translation 데이타는 아래와 같이 찾아서 복원함.
 +<code php>
 +$translations = unserialize($item['meta_value']);
 +$translations = unserialize(base64_decode($translations[0]));
 </code> </code>
 +====== themes ======
 +  *[[http://getk2.com/|K2]]
 +====== references ======
 +  *[[http://codex.wordpress.org/Database_Description|WP Database Description]]
wordpress.1249398203.txt.gz · Last modified: 2013/08/03 05:04 (external edit)