Risultati da 1 a 1 di 1
-
06-05-2013, 20:01 #1
- Data Registrazione
- Apr 2013
- Messaggi
- 59
Script import wordpress
Ciao a tutti, visto che da impex non è possibile importare post da wordpress mi sono messo a scrivere qualche riga di codice, per cercare di importare almeno gli articoli. Non sono un esperto di mysql e php, quindi lo sto facendo a tempo perso, vedendo se "per sbaglio" riesco a concludere qualcosa. Per il momento sono arrivato a questo punto, e se è tutto giusto mancherebbe solo da curare l'import delle keywords. Il codice gira (apparentemente) bene solo su un vbulletin VUOTO. Il mio dubbio è riguardo la tabella posthash, valore dupehash che ho generato copiando quello di un altro post precedentemente creato. Riusciamo a creare unendo le nostre forze un qualcosa di veramente utile?
nota: se provate ad usarlo, poi dal DB dovete modificare il valore di noderight per il campo "home" nella tabella cms_node. La "tabella2" sarebbe wp_posts. Ovviamente se volete provarlo lo fate a vostro rischio e pericolo, e assolutamente in locale su una versione vuota altrimenti vi assicuro che non funziona (unica certezza che ho!) :P
Purtroppo si perde la formattazione. Ho messo il file nel .zip in allegato.
Codice PHP:<?php
//tabelle importanti cms_node, cms_article, cms_nodeinfo, cms_navigation, post, posthash, postlog, thread, activitystream $db = mysql_connect("localhost","root","","vbulletin") or die("Connessione non riuscita: " . mysql_error()); mysql_select_db('vbulletin', $db) or die('Errore...'); $nodeL = 2; $nodeR = 3; for ($i=1;$i<1357;$i++){ $tot = $i; $nodeId = $i+1; //inserisci in cms_article //PER CONCATENARE TESTO UPDATE `cms_article` SET `pagetext` = CONCAT (`pagetext`,'[/html]') $insert = "INSERT INTO cms_article VALUES (".$i.",(SELECT post_content FROM tabella2 WHERE ID = ".$tot."),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',0,0,'','on_nl2br',0,0,1)"; mysql_query($insert) or die( "Errore nell'inserimentoI". mysql_error()); //inserisci in csm_nodeinfo $insertNode = "INSERT INTO cms_nodeinfo VALUES (".$nodeId.",(SELECT post_content FROM tabella2 WHERE ID = ".$tot."),(SELECT post_title FROM tabella2 WHERE ID = ".$tot."),(SELECT post_name FROM tabella2 WHERE ID = ".$tot."),0,'1367802778',NULL,NULL,NULL,NULL,0,".$i.",NULL,0,0,0)"; mysql_query($insertNode) or die("Errore nell'inserimento". mysql_error()); //inserisci in csm_node $insertNode1 = "INSERT INTO cms_node VALUES (".$nodeId.",".$nodeL.",".$nodeR.",1,24,".$i.",(SELECT post_name FROM tabella2 WHERE ID = ".$tot."),NULL,NULL,1,'1367802778',1,0,0,1,'1367802778',1,0,1,0,1,2,1,0,0,1,1,1,1,0,0,0,0,0)"; mysql_query($insertNode1) or die("Errore nell'inserimentoF". mysql_error()); $nodeL = $nodeL + 2; $nodeR = $nodeR+2; //inserisci in cms_navigation $insertNode2 = "INSERT INTO cms_navigation VALUES (".$nodeId.",'')"; mysql_query($insertNode2) or die("Errore nell'inserimentoFin". mysql_error()); //inserisci in post. ricordarsi di aggiungere article: in title $insertPost = "INSERT INTO post VALUES (".$i.",".$i.",0,'daimpa',1,(SELECT post_title FROM tabella2 WHERE ID = ".$tot."),'1367802822','You can view the page at [URL]http://127.0.0.1/forum/[/URL]',0,1,'127.0.0.1',0,1,0,0,0,'on_nl2br')"; mysql_query($insertPost) or die("Errore nell'insertPost". mysql_error()); //inserisci in posthash $insertHash = "INSERT INTO posthash VALUES (1,0,0,'69f6c944b6992b5057c409d1b96d52ee','1367802822')"; mysql_query($insertHash) or die("Errore nell'inserthash". mysql_error()); //inserisci in postlog $insterPlog = "INSERT INTO postlog VALUES (".$i.",'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.3','2130706433','1367802778')"; mysql_query($insterPlog) or die("Errore nell'insterPlog". mysql_error()); //inserisci in thread. ricordarsi di aggiungere Article: in title UPDATE `thread` SET `title` = CONCAT ('Article:',`title`) $inserthThread = "INSERT INTO thread VALUES (".$i.",(SELECT post_title FROM tabella2 WHERE ID = ".$tot."),'',".$i.",".$i.",'1367802778',3,0,1,0,1,0,0,'daimpa',1,'daimpa',1,'1367802778',0,0,'',1,0,0,0,0,'',NULL,'')"; mysql_query($inserthThread) or die("Errore nell'inserthThread". mysql_error()); //inserisci in activitystream $insertActv = "INSERT INTO activitystream VALUES (".$i.",1,'1367802778','',".$i.",15,'create','0.000')"; mysql_query($insertActv) or die("Errore nell'insertActv". mysql_error()); }?>Ultima modifica di daimpa; 07-05-2013 alle 00:32
Discussioni Simili
-
Errore Import attachment
Di Fabioo nel forum Installazione ed aggiornamentoRisposte: 5Ultimo Messaggio: 17-01-2013, 12:22 -
Import External Images
Di Gian nel forum Mod e TemplateRisposte: 9Ultimo Messaggio: 21-10-2012, 17:04 -
Import External Images
Di Gn_Snake nel forum Mod e TemplateRisposte: 1Ultimo Messaggio: 19-05-2012, 13:04 -
vBulletin 3.6.x import Lingue
Di fulvio nel forum VBulletin 3Risposte: 0Ultimo Messaggio: 06-12-2007, 13:40 -
vBulletin 3.6.x problema import database ipb
Di snt nel forum VBulletin 3Risposte: 5Ultimo Messaggio: 18-08-2006, 00:13
Segnalibri