Steps to replicate the issue (include links if applicable):
Manual:Grabbers indicates the scripts are tested up to MediaWiki 1.38.
- Install MediaWiki 1.37.6 to match the remote wiki
- Follow the manual by truncating all relevant tables to allow a clean import from the remote wiki
- Run grabLogs.php --db="$dbName" --dbpass="$dbPass" --dbuser="$dbUser" --url="$URL"
- Run grabText.php --db="$dbName" --dbpass="$dbPass" --dbuser="$dbUser" --url="$URL" -namespaces="0|1|2|3|4|5|6|7|8|9|10|11|14|15"
What happens?:
Impacted Namespaces: 0 [Main], 8 [MediaWiki], and 10 [Template].
The script to retrieve edit revisions will exit due to the following error
Title: Hydra.css in namespace 8 Setting page_restrictions on page_id 32545. Inserting revision 118273 PHP Notice: Undefined index: parentid in /var/www/html/w/grabbers/includes/TextGrabber.php on line 161 [ee39c25a28cd0cbf5acbdb7c] [no req] TypeError: Argument 1 passed to MediaWiki\Revision\MutableRevisionRecord::setParentId() must be of the type int, null given, called in /var/www/html/w/grabbers/includes/TextGrabber.php on line 161 Backtrace: from /var/www/html/w/includes/Revision/MutableRevisionRecord.php(122) #0 /var/www/html/w/grabbers/includes/TextGrabber.php(161): MediaWiki\Revision\MutableRevisionRecord->setParentId() #1 /var/www/html/w/grabbers/grabText.php(285): TextGrabber->processRevision() #2 /var/www/html/w/grabbers/grabText.php(131): GrabText->processPage() #3 /var/www/html/w/grabbers/grabText.php(94): GrabText->processPagesFromNamespace() #4 /var/www/html/w/maintenance/doMaintenance.php(108): GrabText->execute() #5 /var/www/html/w/grabbers/grabText.php(349): require_once(string) #6 {main}
What should have happened instead?:
- No errors
- All revisions should be copied from the remote wiki into the local wiki
Software version (skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.37.6
grabber-tools master branch
Other information (browser name/version, screenshots, etc.):
Current workaround is to modify line 161 of Grabbers/includes/TextGrabber.php then rerun grabText.php
function processRevision( $revision, $page_id, $title ) { if ($revision['parentid']) { $rev->setParentId( $revision['parentid'] ); $this->revisionStore->insertRevisionOn( $rev, $this->dbw ); } }
This will allow skipping the error and grabText.php will correctly continue to insert revisions from the remote wiki.
- A side effect is this could cause unrelated namespaces to have pages throw an error on revision id 0 and refuse to allow deleting because the initial revision is missing. This side effect is resolved by running grabText.php again on the impacted namespaces without the above modification. This may still be prone to still have revision id 0 error in impacted namespaces.