tools:db:wpexport
Differences
This shows you the differences between two versions of the page.
tools:db:wpexport [2019/01/12 17:53] – external edit 127.0.0.1 | tools:db:wpexport [2020/01/01 00:02] (current) – removed arvid | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== WordPress exporter ====== | ||
- | Put this file in your blog root, say to /wpdump.php , then browse to %%http:// | ||
- | |||
- | save the output as '' | ||
- | |||
- | Import to the '' | ||
- | |||
- | **IMPORTANT!** once you're done, delete it from the server! | ||
- | |||
- | Many thanks to the people who wrote [[http:// | ||
- | |||
- | <file php wpexport.php> | ||
- | <?php | ||
- | | ||
- | require_once(' | ||
- | require_once(INCLUDES_DIR.' | ||
- | | ||
- | if (function_exists(' | ||
- | system_init(); | ||
- | } else { | ||
- | plugin_loadall(); | ||
- | } | ||
- | | ||
- | header(' | ||
- | |||
- | | ||
- | function toutf($str) { | ||
- | // comment this one and uncomment the following line if you're using SPB! | ||
- | return $str; | ||
- | |||
- | //return mb_convert_encoding($str, | ||
- | } | ||
- | |||
- | error_reporting(E_ALL); | ||
- | |||
- | $WP_PREFIX = ' | ||
- | | ||
- | $POSTID = 10; | ||
- | $COMMENTID = 10; | ||
- | | ||
- | $SQL_STRING = ''; | ||
- | $q = new FPDB_Query(array(' | ||
- | while($q-> | ||
- | | ||
- | list($id, $e) = $q-> | ||
- | | ||
- | $obj =& new comment_indexer($id); | ||
- | $clist = $obj-> | ||
- | $ccount = count($clist); | ||
- | $date = date(" | ||
- | |||
- | | ||
- | $SQL_STRING = " | ||
- | $SQL_STRING .= " | ||
- | addslashes(toutf($e[' | ||
- | $SQL_STRING .= sanitize_title($e[' | ||
- | | ||
- | echo $SQL_STRING; | ||
- | | ||
- | foreach ($clist as $cid) { | ||
- | $c = comment_parse($id, | ||
- | $cdate = date(" | ||
- | $SQL_STRING = " | ||
- | $SQL_STRING .= " | ||
- | $SQL_STRING .= addslashes(toutf($c[' | ||
- | | ||
- | echo $SQL_STRING; | ||
- | | ||
- | $COMMENTID++; | ||
- | |||
- | } | ||
- | | ||
- | | ||
- | $POSTID++; | ||
- | | ||
- | } | ||
- | |||
- | ?> | ||
- | </ | ||
- | |||
- | Added by marcoverga86 | ||
- | This **new version** | ||
- | |||
- | <file php wpexport_marcoverga86.php> | ||
- | <?php | ||
- | |||
- | require_once(' | ||
- | require_once(INCLUDES_DIR.' | ||
- | require_once(SMARTY_DIR.' | ||
- | |||
- | if (function_exists(' | ||
- | system_init(); | ||
- | } else { | ||
- | plugin_loadall(); | ||
- | } | ||
- | |||
- | header(' | ||
- | | ||
- | function toutf($str) { | ||
- | // comment this one and uncomment the following line if you're using SPB! | ||
- | return $str; | ||
- | |||
- | //return mb_convert_encoding($str, | ||
- | } | ||
- | |||
- | error_reporting(E_ALL); | ||
- | |||
- | $WP_PREFIX = ' | ||
- | |||
- | $POSTID = 10; | ||
- | $COMMENTID = 10; | ||
- | $CATID = 1; | ||
- | |||
- | $SQL_STRING = ''; | ||
- | |||
- | $cats=entry_categories_get(); | ||
- | |||
- | |||
- | |||
- | foreach ($cats[' | ||
- | $SQL_STRING = ""; | ||
- | $SQL_STRING = " | ||
- | $CATID++; | ||
- | echo $SQL_STRING; | ||
- | } | ||
- | |||
- | $q = new FPDB_Query(array(' | ||
- | while($q-> | ||
- | |||
- | list($id, $e) = $q-> | ||
- | |||
- | $obj =& new comment_indexer($id); | ||
- | $clist = $obj-> | ||
- | $ccount = count($clist); | ||
- | $date = date(" | ||
- | |||
- | |||
- | $SQL_STRING = " | ||
- | $SQL_STRING .= " | ||
- | addslashes(toutf($e[' | ||
- | $SQL_STRING .= sanitize_title($e[' | ||
- | |||
- | echo $SQL_STRING; | ||
- | |||
- | foreach ($clist as $cid) { | ||
- | $c = comment_parse($id, | ||
- | $cdate = date(" | ||
- | $SQL_STRING = " | ||
- | $SQL_STRING .= " | ||
- | $SQL_STRING .= addslashes(toutf($c[' | ||
- | |||
- | echo $SQL_STRING; | ||
- | |||
- | $COMMENTID++; | ||
- | |||
- | } | ||
- | |||
- | |||
- | $POSTID++; | ||
- | |||
- | } | ||
- | ?> | ||
- | </ |