https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114520
Revision: 114520
Author: daniel
Date: 2012-03-27 14:08:04 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
use factory method to get difference engine everywhere
Modified Paths:
--------------
branches/Wikidata/phase3/includes/Article.php
branches/Wikidata/phase3/includes/FeedUtils.php
branches/Wikidata/phase3/includes/actions/RollbackAction.php
branches/Wikidata/phase3/includes/api/ApiComparePages.php
branches/Wikidata/phase3/includes/api/ApiQueryRevisions.php
branches/Wikidata/phase3/includes/specials/SpecialComparePages.php
branches/Wikidata/phase3/includes/specials/SpecialUndelete.php
Modified: branches/Wikidata/phase3/includes/Article.php
===================================================================
--- branches/Wikidata/phase3/includes/Article.php 2012-03-27 14:07:42 UTC
(rev 114519)
+++ branches/Wikidata/phase3/includes/Article.php 2012-03-27 14:08:04 UTC
(rev 114520)
@@ -725,7 +725,9 @@
$unhide = $wgRequest->getInt( 'unhide' ) == 1;
$oldid = $this->getOldID();
- $de = new DifferenceEngine( $this->getContext(), $oldid, $diff,
$rcid, $purge, $unhide );
+ $contentHandler = ContentHandler::getForTitle( $this->getTitle() );
+ $de = $contentHandler->getDifferenceEngine(
$this->getContext(), $oldid, $diff, $rcid, $purge, $unhide );
+
// DifferenceEngine directly fetched the revision:
$this->mRevIdFetched = $de->mNewid;
$de->showDiffPage( $diffOnly );
Modified: branches/Wikidata/phase3/includes/FeedUtils.php
===================================================================
--- branches/Wikidata/phase3/includes/FeedUtils.php 2012-03-27 14:07:42 UTC
(rev 114519)
+++ branches/Wikidata/phase3/includes/FeedUtils.php 2012-03-27 14:08:04 UTC
(rev 114520)
@@ -117,7 +117,8 @@
// Don't bother generating the diff if we won't be able
to show it
if ( $wgFeedDiffCutoff > 0 ) {
- $de = new DifferenceEngine( $title, $oldid,
$newid );
+ $contentHandler = ContentHandler::getForTitle( $title );
+ $de = $contentHandler->getDifferenceEngine( $title, $oldid,
$newid );
$diffText = $de->getDiff(
wfMsg( 'previousrevision' ), // hack
wfMsg( 'revisionasof',
Modified: branches/Wikidata/phase3/includes/actions/RollbackAction.php
===================================================================
--- branches/Wikidata/phase3/includes/actions/RollbackAction.php
2012-03-27 14:07:42 UTC (rev 114519)
+++ branches/Wikidata/phase3/includes/actions/RollbackAction.php
2012-03-27 14:08:04 UTC (rev 114520)
@@ -109,7 +109,8 @@
$this->getOutput()->returnToMain( false, $this->getTitle() );
if ( !$request->getBool( 'hidediff', false ) &&
!$this->getUser()->getBoolOption( 'norollbackdiff', false ) ) {
- $de = new DifferenceEngine( $this->getContext(),
$current->getId(), $newId, false, true );
+ $contentHandler = ContentHandler::getForTitle( $this->getTitle() );
+ $de = $contentHandler->getDifferenceEngine( $this->getContext(),
$current->getId(), $newId, false, true );
$de->showDiff( '', '' );
}
}
Modified: branches/Wikidata/phase3/includes/api/ApiComparePages.php
===================================================================
--- branches/Wikidata/phase3/includes/api/ApiComparePages.php 2012-03-27
14:07:42 UTC (rev 114519)
+++ branches/Wikidata/phase3/includes/api/ApiComparePages.php 2012-03-27
14:08:04 UTC (rev 114520)
@@ -35,7 +35,8 @@
$rev1 = $this->revisionOrTitle( $params['fromrev'],
$params['fromtitle'] );
$rev2 = $this->revisionOrTitle( $params['torev'],
$params['totitle'] );
- $de = new DifferenceEngine( $this->getContext(),
+ $contentHandler = ContentHandler::getForModelName(
$rev1->getContentModelName() );
+ $de = $contentHandler->getDifferenceEngine( $this->getContext(),
$rev1,
$rev2,
null, // rcid
Modified: branches/Wikidata/phase3/includes/api/ApiQueryRevisions.php
===================================================================
--- branches/Wikidata/phase3/includes/api/ApiQueryRevisions.php 2012-03-27
14:07:42 UTC (rev 114519)
+++ branches/Wikidata/phase3/includes/api/ApiQueryRevisions.php 2012-03-27
14:08:04 UTC (rev 114520)
@@ -114,7 +114,7 @@
}
if ( !is_null( $params['difftotext'] ) ) {
- $this->difftotext = $params['difftotext'];
+ $this->difftotext = $params['difftotext']; #FIXME:
handle non-text content!
} elseif ( !is_null( $params['diffto'] ) ) {
if ( $params['diffto'] == 'cur' ) {
$params['diffto'] = 0;
@@ -507,7 +507,7 @@
if ( !is_null( $this->difftotext ) ) {
$engine =
$handler->getDifferenceEngine( $context );
- $engine->setText( $text,
$this->difftotext ); #FIXME: use content object!
+ $engine->setText( $text,
$this->difftotext ); #FIXME: use content objects!...
} else {
$engine =
$handler->getDifferenceEngine( $context, $revision->getID(), $this->diffto );
$vals['diff']['from'] =
$engine->getOldid();
Modified: branches/Wikidata/phase3/includes/specials/SpecialComparePages.php
===================================================================
--- branches/Wikidata/phase3/includes/specials/SpecialComparePages.php
2012-03-27 14:07:42 UTC (rev 114519)
+++ branches/Wikidata/phase3/includes/specials/SpecialComparePages.php
2012-03-27 14:08:04 UTC (rev 114520)
@@ -111,7 +111,8 @@
$rev2 = self::revOrTitle( $data['Revision2'], $data['Page2'] );
if( $rev1 && $rev2 ) {
- $de = new DifferenceEngine( $form->getContext(),
+ $contentHandler = ContentHandler::getForModelName(
$rev1->getContentModelName() );
+ $de = $contentHandler->getDifferenceEngine(
$form->getContext(),
$rev1,
$rev2,
null, // rcid
Modified: branches/Wikidata/phase3/includes/specials/SpecialUndelete.php
===================================================================
--- branches/Wikidata/phase3/includes/specials/SpecialUndelete.php
2012-03-27 14:07:42 UTC (rev 114519)
+++ branches/Wikidata/phase3/includes/specials/SpecialUndelete.php
2012-03-27 14:08:04 UTC (rev 114520)
@@ -892,7 +892,8 @@
* @return String: HTML
*/
function showDiff( $previousRev, $currentRev ) {
- $diffEngine = new DifferenceEngine( $this->getContext() );
+ $contentHandler = ContentHandler::getForTitle( $this->getTitle() );
+ $diffEngine = $contentHandler->getDifferenceEngine(
$this->getContext() );
$diffEngine->showDiffStyle();
$this->getOutput()->addHTML(
"<div>" .
@@ -909,8 +910,8 @@
$this->diffHeader( $currentRev, 'n' ) .
"</td>\n" .
"</tr>" .
- $diffEngine->generateDiffBody(
- $previousRev->getText(), $currentRev->getText()
) .
+ $diffEngine->generateContentDiffBody(
+ $previousRev->getContent(),
$currentRev->getContent() ) .
"</table>" .
"</div>\n"
);
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs