Skip to content

Solution to error: Could not fetch MediaWiki: Unknown column 'r.rev_text_id' in 'on clause' #76 #42

@ahbrims

Description

@ahbrims

I was using a new version of mediawiki (1.37.6) that no longer used the revision.rev_text_id (see: Mediawiki Manual.

I rewrote the SQL in the MediaWiki2DokuWiki/Mediawiki/Converter.php file. Using the advice under 'Sample MySQL code' on the Mediawiki Manual page Manual:page table

Original SQL:

$sql = "SELECT p.page_title, p.page_namespace, t.old_text
FROM {$this->dbPrefix}page p
INNER JOIN {$this->dbPrefix}revision r ON
p.page_latest = r.rev_id
INNER JOIN {$this->dbPrefix}{$textTable} t ON
r.rev_text_id = t.old_id
ORDER BY p.page_title";

With new SQL:
$sql = "SELECT p.page_title, p.page_namespace, t.old_text
FROM {$this->dbPrefix}page p
INNER JOIN {$this->dbPrefix}slots s ON
p.page_latest = s.slot_revision_id
INNER JOIN {$this->dbPrefix}slot_roles r ON
s.slot_role_id = r.role_id and r.role_name = 'main'
INNER JOIN {$this->dbPrefix}content c ON
s.slot_content_id = c.content_id
INNER JOIN {$this->dbPrefix}text t ON
substring( c.content_address, 4 ) = t.old_id
ORDER BY p.page_title";

It has copied the pages across, but haven't had time to check everything yet.

Sorry if this is the wrong place for this information.
Hope this helps someone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions