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:25] 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)
Line 22: Line 26:
         delete_candidates.append(mid)         delete_candidates.append(mid)
  
-print len(delete_candidates), delete_candidates+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> </code>
  
 +====== 다국어 지원 ======
 +  *[[http://wordpress.org/extend/plugins/tags/multilingual|다국어지원 플러그인들]]
 +===== wp_multilingual =====
 +저장된 번역은 다음과 같이 쌍으로 존재함.
 <code mysql> <code mysql>
-mysql> desc wp_postmeta; +select meta_id,post_id,meta_key from wp_postmeta; 
-+------------+--------------+------+-----+---------+----------------+ +   1338     421 translations        | 
-Field      Type         Null Key Default Extra          +   1339     421 | searchsyn           
-+------------+--------------+------+-----+---------+----------------+ +</code> 
-| meta_id    | bigint(20  | NO   | PRI | NULL    | auto_increment | +/home/suapapa/wp-content/plugins/wp-multilingual/multilingual.php 
-post_id    | bigint(20  | NO   | MUL | 0                      | +<code php> 
-meta_key   | varchar(255| YES  | MUL | NULL    |                | +$str = serialize(array(base64_encode(serialize(unserialize(serialize($translation)))))); 
-| meta_value | longtext     | YES  |     | NULL    |                | +... 
-+------------+--------------+------+-----+---------+----------------+ +$GLOBALS['wpdb']->query( 
-4 rows in set (0.00 sec)+"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.1249399528.txt.gz · Last modified: 2013/08/03 05:04 (external edit)