This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Importing CSV Data from a non-Commentics Comment System
#1

Hi,

I'm totally in Heart with Commentics and want to convert an existing site to use it.
http://www.classiccarevents.uk

I wrote my own very, very simple comment system a year or so back and have accumulated about 2800 comments.
The current database holds the following table entries, and here is one example:

ID: 2832 (Key)
submission_time2019-03-10 19:43:10
submission_date2019-03-10
submission_ip86.190.46.208
submission_uniquef7eirl8
nameJeff Kaby

email: abc@abc.com
commentAre there any restrictions on age of vehicle for Kent's Classic Car Show, or can all car club members attend? Alfa Romeo Owners Club, Kent & East Sussex
page_url_code: 000600
status: 2 (2=approved)
event_name: Kent's Classic Car Show, Kent

I read another post that it is possible to EXPORT/IMPORT CSV from a previous version of Commentics and realised / learned that the 'comment' table and 'page' table are closely linked and this will probably be a bit of a headache  Confused  at first.

So .... I'm wondering (as couldn't find anything similar on the forum) if :

1) this has been done before? 
2) there is any useful documentation I can read up on before taking the plunge?
3) you have any pointers or realise some limitation in importing to commentics with such a simple set of table elements?

In any case ... I'll try to keep a good set of notes and publish on this thread in case anyone faces the same situation in the future.

Many thanks,
Tim
Reply
#2

Hi Tim,

I'm not aware of anyone importing comments from another system; most people seem to start afresh but that's not to say it can't be done.

Luckily Commentics 2.x stored its comments very similarly to yours, with the name and email columns in the comments table. So the code which upgrades the database from 2.5 to 3.0 will be helpful here. The main thing you need to do is split off some of your data from the comments table to the pages and users tables. Then other smaller things to do are to rename submission_time to date_added, submission_ip to ip_address and the equivalent of your status column being 2 is the is_approved column being 1. But back to the main issue. If you open the file /install/model/main/upgrade_2.php, you'll see that on line 115 onwards, it gets all of the unique names from the comments table, loops through them and creates the users (line 159). (That line calls some code in the /system/library/user.php file).

Have you completed the interview?
Reply
#3

Hi Steven,

That's good news re V2.X, I'll definitely take a look at that code and go from there.

I'm in no rush to do this so I'll have time and patience on my side for a change lol

Will post my steps when completed -- could be useful for someone else.

Cheers.
Reply
#4

So .... one question ....

I am building the users table and all is good except I am not sure what to do about the token field?

Should I make 'random' token or leave it blank?

thanks,
Tim
Reply
#5

Just make a random token of alphanumeric characters and 20 characters long.

This is the function Commentics uses to generate it:

PHP Code:
<?php 
function random($length = 20) {
   $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
   $key = '';
   for ($i = 0; $i < $length; $i++) {
       $key .= $characters[mt_rand(0, strlen($characters) - 1)];
   }
   return $key;
}

Have you completed the interview?
Reply
#6

Hi

I'm in the same process, I want to migrate from Disqus to Commentics so any help/documentation/tips would be much appreciated!
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
13-Aug-2020, 12:36 PM
Last Post by rid
18-Jan-2019, 06:51 PM
Last Post by gongong
18-Feb-2017, 04:16 AM
Last Post by Steven
01-Jan-2016, 12:26 AM
Last Post by Steven
07-Jul-2015, 05:57 PM
Last Post by Steven
29-May-2015, 08:51 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)