Manual:migrateComments.php
MediaWiki versions: | 1.30 – 1.39 |
MediaWiki file: migrateComments.php | |
---|---|
Location: | maintenance/ |
Source code: | master • 1.42.3 • 1.41.4 • 1.39.10 |
Classes: | MigrateComments |
Details
editmigrateComments.php is a maintenance script that migrates comments from pre-1.30 columns to the 'comment' table.
$wgCommentTableSchemaMigrationStage
needs to be set to MIGRATION_WRITE_NEW
or MIGRATION_NEW
for the script to do the migration.
While migrating comments in a table, the script assumes any rows with the ID field non-zero (e.g. ar_comment_id
non-zero) have already been migrated.
Also it assumes the new field name is the same as the old with '_id' appended. It blanks the old fields while migrating.
The script migrates the following columns:
Table | Old column | New column |
---|---|---|
revision | rev_comment | revcomment_comment_id |
archive | ar_comment | ar_comment_id |
ipblocks | ipb_reason | ipb_reason_id |
image | img_description | imgcomment_description_id |
oldimage | oi_description | oi_description_id |
filearchive | fa_deleted_reason | fa_deleted_reason_id |
filearchive | fa_description | fa_description_id |
recentchanges | rc_comment | rc_comment_id |
logging | log_comment | log_comment_id |
protected_titles | pt_reason | pt_reason_id |
The comments are finally stored in the column comment_text in the comment table.
To improve performance during the run-time of this script, for the tables revision and image, a temporary table named revision_comment_temp
and image_comment_temp
is being used during the migration.
These two tables will be merged with the tables revision and images again in the future.
Usage
editphp migrateComments.php