From 69079ca839399668cf2fa25fe86c99088e944248 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 4 Apr 2011 19:06:01 +0000 Subject: [PATCH] * (bug 28417) Fix PHP notice when importing revision without a listed id --- RELEASE-NOTES | 1 + includes/Import.php | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a1036fb324..237f9545e6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -216,6 +216,7 @@ PHP if you have not done so prior to upgrading MediaWiki. submitted the form. * (bug 27893) Edit-on-doubleclick now applies only on view and purge actions; no longer triggers unexpectedly on delete, history etc. +* (bug 28417) Fix PHP notice when importing revision without a listed id === API changes in 1.18 === * (bug 26339) Throw warning when truncating an overlarge API result diff --git a/includes/Import.php b/includes/Import.php index 6d9c95cf49..f027f1a79a 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -546,18 +546,27 @@ class WikiImporter { private function processRevision( $pageInfo, $revisionInfo ) { $revision = new WikiRevision; - $revision->setID( $revisionInfo['id'] ); - $revision->setText( $revisionInfo['text'] ); + if( isset( $revisionInfo['id'] ) ) { + $revision->setID( $revisionInfo['id'] ); + } + if ( isset( $revisionInfo['text'] ) ) { + $revision->setText( $revisionInfo['text'] ); + } $revision->setTitle( $pageInfo['_title'] ); - $revision->setTimestamp( $revisionInfo['timestamp'] ); + + if ( isset( $revisionInfo['timestamp'] ) ) { + $revision->setTimestamp( $revisionInfo['timestamp'] ); + } else { + $revision->setTimestamp( wfTimestampNow() ); + } if ( isset( $revisionInfo['comment'] ) ) { $revision->setComment( $revisionInfo['comment'] ); } - if ( isset( $revisionInfo['minor'] ) ) + if ( isset( $revisionInfo['minor'] ) ) { $revision->setMinor( true ); - + } if ( isset( $revisionInfo['contributor']['ip'] ) ) { $revision->setUserIP( $revisionInfo['contributor']['ip'] ); } -- 2.20.1