Risultati da 1 a 1 di 1

Discussione: Script import wordpress

  1. #1

    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());        }?>
    File Allegati File Allegati
    Ultima modifica di daimpa; 07-05-2013 alle 00:32

Discussioni Simili

  1. Errore Import attachment
    Di Fabioo nel forum Installazione ed aggiornamento
    Risposte: 5
    Ultimo Messaggio: 17-01-2013, 11:22
  2. Import External Images
    Di Gian nel forum Mod e Template
    Risposte: 9
    Ultimo Messaggio: 21-10-2012, 17:04
  3. Import External Images
    Di Gn_Snake nel forum Mod e Template
    Risposte: 1
    Ultimo Messaggio: 19-05-2012, 13:04
  4. vBulletin 3.6.x import Lingue
    Di fulvio nel forum VBulletin 3
    Risposte: 0
    Ultimo Messaggio: 06-12-2007, 12:40
  5. vBulletin 3.6.x problema import database ipb
    Di snt nel forum VBulletin 3
    Risposte: 5
    Ultimo Messaggio: 18-08-2006, 00:13

Segnalibri

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •