Page MenuHomePhabricator

diffonly.patch

Authored By
bzimport
Nov 21 2014, 8:49 PM
Size
2 KB
Referenced Files
None
Subscribers
None

diffonly.patch

Index: Article.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Article.php,v
retrieving revision 1.453
diff -u -r1.453 Article.php
--- Article.php 23 Jan 2006 22:32:44 -0000 1.453
+++ Article.php 4 Feb 2006 03:05:35 -0000
@@ -732,6 +732,7 @@
$diff = $wgRequest->getVal( 'diff' );
$rcid = $wgRequest->getVal( 'rcid' );
$rdfrom = $wgRequest->getVal( 'rdfrom' );
+ $diffOnly = $wgRequest->getCheck( 'diffonly' );
$wgOut->setArticleFlag( true );
$wgOut->setRobotpolicy( 'index,follow' );
@@ -742,7 +743,7 @@
require_once( 'DifferenceEngine.php' );
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
- $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid );
+ $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid, $diffOnly );
// DifferenceEngine directly fetched the revision:
$this->mRevIdFetched = $de->mNewid;
$de->showDiffPage();
Index: DifferenceEngine.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/DifferenceEngine.php,v
retrieving revision 1.85
diff -u -r1.85 DifferenceEngine.php
--- DifferenceEngine.php 23 Jan 2006 19:41:03 -0000 1.85
+++ DifferenceEngine.php 4 Feb 2006 03:05:35 -0000
@@ -39,9 +39,12 @@
* @param integer $old Old ID we want to show and diff with.
* @param string $new Either 'prev' or 'next'.
* @param integer $rcid ??? (default 0)
+ * @param boolean $diffOnly only show diff, not rendered article
*/
- function DifferenceEngine( $titleObj = null, $old = 0, $new = 0, $rcid = 0 ) {
+ function DifferenceEngine( $titleObj = null, $old = 0, $new = 0, $rcid = 0, $diffOnly = false ) {
$this->mTitle = $titleObj;
+ $this->diffOnly = $diffOnly;
+
wfDebug("DifferenceEngine old '$old' new '$new' rcid '$rcid'\n");
if ( 'prev' == $new ) {
@@ -198,23 +201,32 @@
'<br />' . $nextlink . $patrol;
$this->showDiff( $oldHeader, $newHeader );
- $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
- if( !$this->mNewRev->isCurrent() ) {
- $oldEditSectionSetting = $wgOut->mParserOptions->setEditSection( false );
+ if ( ! $this->diffOnly ) {
+ $this->showArticle();
}
+ wfProfileOut( $fname );
+ }
+
+ /**
+ * Show the rendered article
+ */
+ function showArticle() {
+ global $wgOut;
+
+ $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
$this->loadNewText();
if( is_object( $this->mNewRev ) ) {
$wgOut->setRevisionId( $this->mNewRev->getId() );
}
$wgOut->addSecondaryWikiText( $this->mNewtext );
-
+ if( !$this->mNewRev->isCurrent() ) {
+ $oldEditSectionSetting = $wgOut->mParserOptions->setEditSection( false );
+ }
if( !$this->mNewRev->isCurrent() ) {
$wgOut->mParserOptions->setEditSection( $oldEditSectionSetting );
}
-
- wfProfileOut( $fname );
}
/**

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1876
Default Alt Text
diffonly.patch (2 KB)

Event Timeline