User Tools

Site Tools


it:tools:db:wpexport

Differences

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

Link to this comparison view

it:tools:db:wpexport [2019/01/12 17:53] – external edit 127.0.0.1it:tools:db:wpexport [2020/01/01 00:03] (current) – removed arvid
Line 1: Line 1:
-====== WordPress exporter ====== 
  
-> Traduzione italiana (a tratti libera) della pagina [[tools:db:wpexport|WordPress exporter]]. 
- 
-> //[[drudo3@gmail.com|Luciano P.]] 2007/10/13 10:17// 
- 
- 
-Porre questo file nella "radice" del vostro blog, ovvero /wpdump.php, puntare su http://yoursite/flatpress/wpdump.php e salvare l' output come ''export.sql''. 
- 
-Importare la tabella ''wordpress'' dal proprio database usando phpMyAdmin o un tool analogo (se la propria installazione di WP non è nuova, creare prima un backup!). 
- 
-**IMPORTANTE!** non appena si ha terminato, cancellare questo file dal server! 
- 
-Un ringraziamento particolare a tutti quelli che hanno scritto [[http://www.byteclub.net/wiki/Sphpblog_to_wordpress|lo script in ruby]] e a [[http://spbitalia.altervista.org/forum/viewtopic.php?pid=6174#p6174|SPBItalia]] per aver condiviso la nascita di questo script. 
- 
- 
- 
-<code php> 
-<?php 
- 
-   
-    require_once('defaults.php'); 
-    require_once(INCLUDES_DIR.'includes.php'); 
-     
-    if (function_exists('system_init')) { 
-    system_init(); 
-    } else { 
-    plugin_loadall(); 
-    } 
-     
-      header('Content-Type: text/plain; charset=utf-8'); 
- 
-     
-    function toutf($str) { 
-        // comment this one and uncomment the following line if you're using SPB! 
-    return $str; 
- 
-        //return mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); 
-    } 
- 
-    error_reporting(E_ALL); 
- 
-    $WP_PREFIX = 'wp_'; 
-     
-    $POSTID = 10; 
-    $COMMENTID = 10; 
-     
-    $SQL_STRING = ''; 
-     
-    $o = new entry_indexer(); 
- 
-    $list = $o->getList(); 
-     
-    foreach($list as $id => $c) { 
-     
-        $e = entry_parse($id); 
-         
-        $obj =& new comment_indexer($id); 
-        $clist = $obj->getList(); 
-        $ccount = count($clist); 
-        $date = date("Y-m-d H:i:s", $e['date']); 
- 
-         
-        $SQL_STRING = "INSERT INTO {$WP_PREFIX}posts (id, post_author, post_date, post_date_gmt, post_content, post_title, post_name, comment_count) "; 
-        $SQL_STRING .= "VALUES ({$POSTID}, 1, '{$date}', '{$date}', '" . addslashes(toutf(apply_filters('the_content', $e['content']))) . "', '" 
-                            addslashes(toutf($e['subject'])) ."', '"; 
-        $SQL_STRING .= sanitize_title($e['subject']) ."', {$ccount}); \n"; 
-         
-        echo $SQL_STRING; 
-     
-        foreach ($clist as $cid)  { 
-            $c = comment_parse($id, $cid); 
-            $cdate = date("Y-m-d H:i:s", $c['date']); 
-            $SQL_STRING = "INSERT INTO {$WP_PREFIX}comments (comment_id, comment_post_id, comment_content, comment_author, comment_date, comment_date_gmt) "; 
-            $SQL_STRING .= "VALUES ($COMMENTID, $POSTID, '" . /* in questo particolare caso */ addslashes(toutf(apply_filters('the_content', $c['content']))). "', '"; 
-            $SQL_STRING .= addslashes(toutf($c['name'])) . "', '{$cdate}', '{$cdate}' ); \n"; 
-         
-            echo $SQL_STRING; 
-             
-            $COMMENTID++; 
- 
-        } 
-         
-         
-        $POSTID++; 
-     
-    } 
- 
-?>     
-</code> 
it/tools/db/wpexport.1547312016.txt.gz · Last modified: 2019/01/12 17:53 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki