PDA

View Full Version : Integration with vBulletin - Post Edit History Importer


Gray Matter
24 Dec 2007, 11:05
What is this?

The Post Edit History Importer (PEHI) is just that; an importer script. For those of us who were using Surviver's Post Edit History (PEH) hack (http://www.vbulletin.org/forum/showthread.php?t=132708), we are now pleased to see this functionality included in the default vBulletin package with the introduction of 3.7.0.

However, the hack's and vBulletin's way of logging post edit histories are somewhat different. So, thus, the need for this importer script arose. In a nutshell, it will import your past edit histories into vBulletin's new system.

What, exactly, does it do?

This script is a seamless import of the edit histories from the PEH hack into vB's system.

There are several key differences between vB's system and the hack's, among which are:
vB stores iconid edits, the hack didn't
The hack stored edits by comparing them in each record, while vB instead stores the original post once and subsequently all edits in a separate recordThis importer will correct any mishaps between the two systems; it will assign postedithistoryids in the exact same order as they would have been if vB had inserted them, it will store original posts in the same way that vB does, it will assign iconids to make up for the missing ones that the hack never logged, and many other things.

If you're truly interested in checking out everything this importer does to make it "vB standard," you can read the code. I've commented enough that it should be discernible. ;)

Anticipated FAQ
Q: Can I use this importer if I already have edit histories in vB's new system?
A: Yes! This importer was designed to import everything seamlessly. After it is done organizing the old histories correctly, it will process new histories before clearing them altogether in order to rearrange them correctly. So, yes, you can.

Q: Which version(s) of the PEH hack is this importer intended for?
A: The importer has only be tested with PEH version 1.2.5. Since I haven't used the new beta version, I do not know the database structure and therefore this importer might not work on that version.

Q: How long does the importer take to do everything?
A: Not very long at all, I promise. But really, it depends on how many histories you have. Personally, I had 21,075 histories from the hack. After inserting the originals (14,033 of them), I ended up with 35,108 records total. How long did it take the importer to do all of that? 2 minutes.

(More to come later if need be...)

Using the importer
To use the importer, just download the .zip file attached, unzip it, and open the 'readme' file. Instructions are included there.

Afterward
After you've used the importer, feel free to post your stats here! I'd love to hear how it worked out for you. :)

Enjoy! :D

Surviver
24 Dec 2007, 13:41
Nice, Thank you very much. But I don't like the new post history, becaus the edit is only saved if you entere a edit reason.

Gray Matter
24 Dec 2007, 20:47
Nice, Thank you very much. But I don't like the new post history, becaus the edit is only saved if you entere a edit reason.
As far as I can tell, you don't have to enter a reason. But it will only save the edit if the "Last edited by" message is shown. :p

(which yes, I dislike as well ;))

hocphp
24 Dec 2007, 23:58
i installed . working hard. thank for upgrade

Gray Matter
25 Dec 2007, 06:06
Does not work what results in getting DB Errors!
I can't really help if you don't post the database error. ;)

FlyBoy73
23 Mar 2008, 01:19
How do you feel this hack will load the system if you have several million posts? Is it very intensive to search this out?

Thanks,
David

Gray Matter
24 Mar 2008, 21:05
How do you feel this hack will load the system if you have several million posts? Is it very intensive to search this out?

Thanks,
David
My forum had about 35,000 stored edits when I ran the importer and everything went smoothly.

However, I would suggest you run the importer on a copy of your database, not your live website, first, just to be sure. :)

tuwebfacil
01 May 2008, 04:12
I runned the script perfectly, I choose to remove the tables, but once I tried to uninstall the old product from the product page on admincp, I got this error:

Database error in vBulletin 3.7.0:

Invalid SQL:
DROP TABLE edithistory;

MySQL Error : Unknown table 'edithistory'
Error Number : 1051
Request Date : Wednesday, April 30th 2008 @ 11:09:12 PM
Error Date : Wednesday, April 30th 2008 @ 11:09:13 PM
Script : http://www.xxxxx.com/admincp/plugin.php?do=productkill
Referrer : http://www.xxxxx.com/admincp/plugin.php?do=productdelete&productid=edithistory&s=
IP Address : 190.78.11.225
Username : xxxxxx
Classname : vB_Database
MySQL Version : 5.0.45-community

Gray Matter
02 May 2008, 22:38
Ack. I didn't realize that the tables are removed by the uninstall script. Did it uninstall the product okay for you? This isn't going to cause a major problem, I just want to make sure you can uninstall it correctly.

However, I will remove the tables option from the script and just add a message to uninstall the product. :)

tuwebfacil
03 May 2008, 02:54
Ack. I didn't realize that the tables are removed by the uninstall script. Did it uninstall the product okay for you? This isn't going to cause a major problem, I just want to make sure you can uninstall it correctly.

However, I will remove the tables option from the script and just add a message to uninstall the product. :)

No bro, I couldn't uninstall the product right.
Any way you can help me out?

Gray Matter
03 May 2008, 16:09
I think the easiest way to get rid of it for you is to just create a table named "edithistory" and that way the uninstall script won't fail when you try to install it.

To do this, enter your ACP, click on "Execute SQL Query" under 'Maintenance' and enter this in the "Manual Query" field, and then click 'Continue' on the next page:

CREATE TABLE edithistory (
blah INT UNSIGNED,
blah1 SMALLINT,
blah2 DATETIME
)

Then, go and try to uninstall the product again. :)

Gray Matter
03 May 2008, 16:19
The importer has now been updated to only clear the old table and remove its records, rather than remove it entirely. This way, the uninstall script will not fail when someone tries to remove the product.

This importer is also now supported. :)

tuwebfacil
04 May 2008, 00:32
I think the easiest way to get rid of it for you is to just create a table named "edithistory" and that way the uninstall script won't fail when you try to install it.

To do this, enter your ACP, click on "Execute SQL Query" under 'Maintenance' and enter this in the "Manual Query" field, and then click 'Continue' on the next page:

CREATE TABLE edithistory (
blah INT UNSIGNED,
blah1 SMALLINT,
blah2 DATETIME
)

Then, go and try to uninstall the product again. :)

thanks for the support!!

The product has been removed! :)

thanks again!

dutchbb
05 May 2008, 17:56
Omg if I only knew this, just deleted the entire database of PEH because vbulletin introduced it's own :(

Gray Matter
06 May 2008, 03:43
Omg if I only knew this, just deleted the entire database of PEH because vbulletin introduced it's own :(
I'm sorry to hear that. :( You don't have a backup or anything you could use? It's a shame to lose all those histories.

Darat
15 Jun 2008, 13:17
Just used the importer and it seemed to have worked fine however on the last step when it asked if it should clean-up the mess the old hack would leave behind I said yes but then got this error:

Unable to add cookies, header already sent.
File: /v***/***/forum/post_edit_history_importer.php
Line: 5

Gray Matter
17 Jun 2008, 03:20
I'm not sure what would be causing your problem, Darat. Could you check to see that the importer ran smoothly, and that everything is looking fine?

Also please check to see that you can uninstall the product successfully.

Darat
17 Jun 2008, 07:37
The import appears to have worked fine and I've removed the old PEH mod and armageddon hasn't happened so everything seems OK.

Gray Matter
17 Jun 2008, 17:00
Great! I will look into the error though, so that no one sees it in the future. ;)

WildSoftCat
19 Jul 2008, 02:17
Edits Processed: 4,650
Unique Posts Processed: 2,108
Total Records Processed: 6,758
Total Time to Run Import Script: 3.40 minutes
Step 1 - 0.02 minutes
Step 2 - 0.08 minutes
Step 3 - 0.03 minutes
Step 4 - 0.72 minutes
Step 5 - 0.03 minutes
Step 6 - 0.00 minutes


:)

Gray Matter
19 Jul 2008, 04:50
Thanks for posting. Glad to see it worked out for you. :D

Gray Matter
18 Aug 2008, 18:33
In case anyone is wondering, I have just used this on my live board after an upgrade from 3.6.10 to 3.7.2 and it worked great! :)


Edits Processed: 22,749
Unique Posts Processed: 15,154
Total Records Processed: 37,903
Total Time to Run Import Script: 2.22 minutes
Step 1 - 0.07 minutes
Step 2 - 1.25 minutes
Step 3 - 0.20 minutes
Step 4 - 0.25 minutes
Step 5 - 0.07 minutes

FD929
27 Jan 2009, 17:13
Just wanted to say thanks and show credit. Marked as uninstalled, cleaning up my install page.

brent_strong
26 Mar 2010, 03:37
Any idea if this will work when converting PEH 1.2.5 to a database running vbulletin 4.0.2?

Jackal von ÖRF
09 Jul 2010, 13:02
I noticed that you must set "$config['Database']['dbtype'] = 'mysql';" in your config.php. If you use mysqli then $db->query_read returns a mysqli resource and the script incorrectly tries to use it as a mysql resource, which results in "mysql_fetch_array(): supplied argument is not a valid MySQL result resource" on line 116.

I received errors that the script was unable to set cookies because the headers were already sent. The problem might be because the script prints html before it includes global.php. A workaround was to open the forum front page once, so that the forum could set the cookies, and then get back to PEHI.

Otherwise the script worked nicely. :)