Thought I'd add the migration script I've been using to test my JComments migration from my Joomla CMS site version 1.5.20 to Joomla CMS site version 2.5.6.
DISCLAIMER
- I do not work for either Joomla or JoomlaTune (Jcomments)
- This script is provided as is without warranty
- If you do not understand what this script is doing, let someone who does run it instead
INSTALL INSTRUCTIONS
- Install JComments on your upgraded website (at time of print: Jcomments v2.3.0 on Joomla v2.5.4)
- Copy the below script to a text file
- Change the database names to match your setup
- Change the table name prefixes to match your setup
- Run the modified SQL script against your database.
-- -------------------------------------------------------------------------------- -- MIGRATION SCRIPT FOR JCOMMENTS IN JOOMLA v1.5.x TO JOOMLA v2.5.x -- -------------------------------------------------------------------------------- -- NOTE: Replace string "mydb_livecopy_j15" to your Joomla 1.5.x database name -- -- -- (example: "anolddatabase") -- 9 occurrences -- NOTE: Replace string "mydb_livecopy_j15.myprefix_" to your Joomla 1.5.x database name & table prefix -- -- -- (example: "anolddatabase.jos_") -- 8 occurrences -- NOTE: Replace string "mydb_upgrade_j25" to your Joomla 2.5.x database name -- -- -- (example: "anewdatabase") -- 9 occurrences -- NOTE: Replace string "mydb_upgrade_j25.myprefix_" to your Joomla 2.5.x database name & table prefix -- -- -- (example: "anewdatabase.rndpfx1_") -- 8 occurrences -- -------------------------------------------------------------------------------- -- _jcomments -- -------------------------------------------------------------------------------- INSERT INTO mydb_upgrade_j25.myprefix_jcomments ( id, parent, thread_id, path, level, object_id, object_group, object_params, lang, userid, name, username, email, homepage, title, comment, ip, date, isgood, ispoor, published, subscribe, source, source_id, checked_out, checked_out_time, editor ) SELECT id, parent, CASE WHEN SUBSTRING(path, LOCATE(',', path)+1, LOCATE(',', path, 2))='' THEN 0 ELSE SUBSTRING(path, LOCATE(',', path)+1, LOCATE(',', path, 2)) END AS thread_id, path, level, object_id, object_group, object_params, lang, userid, name, username, email, homepage, title, comment, ip, date, isgood, ispoor, published, subscribe, source, source_id, checked_out, checked_out_time, editor FROM mydb_livecopy_j15.myprefix_jcomments; -- -------------------------------------------------------------------------------- -- _jcomments_custom_bbcodes -- -------------------------------------------------------------------------------- -- NOTE: This is disabled as the new version includes the old bbcodes setup (no change) -- INSERT INTO -- mydb_upgrade_j25.myprefix_jcomments_custom_bbcodes -- ( -- id, `name`, simple_pattern, simple_replacement_html, simple_replacement_text, pattern, -- replacement_html, replacement_text, button_acl, button_open_tag, button_close_tag, -- button_title, button_prompt, button_image, button_css, button_enabled, ordering, -- published -- ) -- SELECT -- id, `name`, simple_pattern, simple_replacement_html, simple_replacement_text, pattern, -- replacement_html, replacement_text, button_acl, button_open_tag, button_close_tag, -- button_title, button_prompt, button_image, button_css, button_enabled, ordering, -- published -- FROM -- mydb_livecopy_j15.myprefix_jcomments_custom_bbcodes; -- -------------------------------------------------------------------------------- -- _jcomments_reports -- -------------------------------------------------------------------------------- INSERT INTO mydb_upgrade_j25.myprefix_jcomments_reports ( id, commentid, userid, name, ip, date, reason, status ) SELECT id, commentid, userid, name, ip, date, reason, status FROM mydb_livecopy_j15.myprefix_jcomments_reports; -- -------------------------------------------------------------------------------- -- _jcomments_settings -- ignored as this will load factory settings -- -------------------------------------------------------------------------------- /* INSERT INTO mydb_upgrade_j25.myprefix_jcomments_settings ( component, lang, name, value ) SELECT component, lang, name, value FROM mydb_livecopy_j15.myprefix_jcomments_settings; */ -- -------------------------------------------------------------------------------- -- _jcomments_subscriptions -- -------------------------------------------------------------------------------- INSERT INTO mydb_upgrade_j25.myprefix_jcomments_subscriptions ( id, object_id, object_group, lang, userid, name, email, hash, published ) SELECT id, object_id, object_group, lang, userid, name, email, hash, published FROM mydb_livecopy_j15.myprefix_jcomments_subscriptions; -- source=??? -- -------------------------------------------------------------------------------- -- _jcomments_version -- -------------------------------------------------------------------------------- INSERT INTO mydb_upgrade_j25.myprefix_jcomments_version ( version, previous, installed, updated ) SELECT version, previous, installed, updated FROM mydb_livecopy_j15.myprefix_jcomments_version; -- -------------------------------------------------------------------------------- -- _jcomments_votes -- -------------------------------------------------------------------------------- INSERT INTO mydb_upgrade_j25.myprefix_jcomments_votes ( id, commentid, userid, ip, date, value ) SELECT id, commentid, userid, ip, date, value FROM mydb_livecopy_j15.myprefix_jcomments_votes; -- -------------------------------------------------------------------------------- -- _jcomments_objects *** NEW FOR JOOMLA 2.5.X -- --------------------------------------------------------------------------------
Post-Installation
Go to JComments Settings and specify the same "Choose categories for JComments to work in" as you have for your 1.5 website. The above script ignores your previous settings and leaves the factory settings that come with the JComments extension. Check all JComments settings are what you want using the Joomla Admin interface.
If the article IDs match then the comments will also match. If however your article IDs don't match in both versions of your site, consider using the following update script, this will change the IDs of the JComments comments to be associated to articles from your Joomla 2.5 site (no changes to article IDs but backup your original database (J1.5) anyway before running the following):
UPDATE my_joomla_1_5_db.my_1_5_db_prefix_content j1a, -- Joomla 1.5.x Content my_joomla_1_5_db.my_1_5_db_prefix_jcomments j1b, -- Joomla 1.5.x JComments my_joomla_2_5_db.my_2_5_db_prefix_content j2a, -- Joomla 2.5.x Content my_joomla_2_5_db.my_2_5_db_prefix_jcomments j2b -- Joomla 2.5.x JComments SET j2b.`object_id`=j2a.`id` WHERE j1a.`alias`=j2a.`alias` AND j1a.`id`=j1b.`object_id` AND j2b.`comment`=j1b.`comment`