Page MenuHomePhabricator

diffonlypatch.txt

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

diffonlypatch.txt

diff -u -r wiki1.7.1/includes/Article.php wiki/includes/Article.php
--- wiki1.7.1/includes/Article.php 2006-07-09 07:45:26.000000000 +0200
+++ wiki/includes/Article.php 2006-07-19 22:59:46.000000000 +0200
@@ -638,6 +638,7 @@
$diff = $wgRequest->getVal( 'diff' );
$rcid = $wgRequest->getVal( 'rcid' );
$rdfrom = $wgRequest->getVal( 'rdfrom' );
+ $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
$wgOut->setArticleFlag( true );
if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
@@ -654,7 +655,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();
Only in wiki/includes: Article.php.orig
diff -u -r wiki1.7.1/includes/DifferenceEngine.php wiki/includes/DifferenceEngine.php
--- wiki1.7.1/includes/DifferenceEngine.php 2006-07-09 07:45:26.000000000 +0200
+++ wiki/includes/DifferenceEngine.php 2006-07-20 01:32:50.921875000 +0200
@@ -35,9 +35,12 @@
* @param $old Integer: old ID we want to show and diff with.
* @param $new String: either 'prev' or 'next'.
* @param $rcid Integer: ??? FIXME (default 0)
+ * @param $diffOnly Boolean: 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 ) {
@@ -185,6 +188,27 @@
$nextlink . $patrol;
$this->showDiff( $oldHeader, $newHeader );
+ if ( ! $this->diffOnly ) {
+ $this->showArticle();
+ } else {
+ $wgOut->addHTML(
+ "<div class='patrollink'>" .
+ wfMsg ( 'markaspatrolledlink',
+ $sk->makeKnownLinkObj( $this->mTitle, "Show diff with article", "diff=".$this->mNewid."&oldid=".$this->mOldid."&diffonly=0" )
+ ) .
+ '</div>'
+ );
+ }
+
+ wfProfileOut( $fname );
+ }
+
+ /**
+ * Show the rendered article
+ */
+ function showArticle() {
+ global $wgOut;
+
$wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
if( !$this->mNewRev->isCurrent() ) {
@@ -200,8 +224,6 @@
if( !$this->mNewRev->isCurrent() ) {
$wgOut->mParserOptions->setEditSection( $oldEditSectionSetting );
}
-
- wfProfileOut( $fname );
}
/**
diff -u -r wiki1.7.1/languages/Language.php wiki/languages/Language.php
--- wiki1.7.1/languages/Language.php 2006-07-09 07:45:46.000000000 +0200
+++ wiki/languages/Language.php 2006-07-19 23:14:45.125000000 +0200
@@ -84,6 +84,7 @@
'externaldiff' => 0,
'showjumplinks' => 1,
'numberheadings' => 0,
+ 'diffonly' => 0,
'uselivepreview' => 0,
'watchlistdays' => 3.0,
);
@@ -161,6 +162,7 @@
'externaleditor',
'externaldiff',
'showjumplinks',
+ 'diffonly',
'uselivepreview',
'autopatrol',
'forceeditsummary',
diff -u -r wiki1.7.1/languages/Messages.php wiki/languages/Messages.php
--- wiki1.7.1/languages/Messages.php 2006-07-09 07:45:46.000000000 +0200
+++ wiki/languages/Messages.php 2006-07-19 23:15:39.234375000 +0200
@@ -62,6 +62,7 @@
'tog-externaleditor' => 'Use external editor by default',
'tog-externaldiff' => 'Use external diff by default',
'tog-showjumplinks' => 'Enable "jump to" accessibility links',
+'tog-diffonly' => 'Show diffs without article body',
'tog-uselivepreview' => 'Use live preview (JavaScript) (Experimental)',
'tog-autopatrol' => 'Mark edits I make as patrolled',
'tog-forceeditsummary' => 'Prompt me when entering a blank edit summary',

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1878
Default Alt Text
diffonlypatch.txt (3 KB)

Event Timeline