http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89550
Revision: 89550
Author: gurch
Date: 2011-06-06 09:22:52 +0000 (Mon, 06 Jun 2011)
Log Message:
-----------
ApiComparePages: Throw an error if getDiffBody returns false, instead of blank
output
This lets the client distinguish a legitimately blank diff (identical
revisions) from one that does not exist or which they do not have permission to
view.
getDiffBody doesn't tell the caller why it failed, so there may be a better way
to do this.
Modified Paths:
--------------
trunk/phase3/includes/api/ApiComparePages.php
Modified: trunk/phase3/includes/api/ApiComparePages.php
===================================================================
--- trunk/phase3/includes/api/ApiComparePages.php 2011-06-06 08:45:54 UTC
(rev 89549)
+++ trunk/phase3/includes/api/ApiComparePages.php 2011-06-06 09:22:52 UTC
(rev 89550)
@@ -53,7 +53,13 @@
$vals['torevid'] = $rev2;
$difftext = $de->getDiffBody();
- ApiResult::setContent( $vals, $difftext );
+
+ if ( $difftext === false ) {
+ $this->dieUsage( 'The diff cannot be retrieved. ' .
+ 'Maybe one or both revisions do not exist or
you do not have permission to view them.', 'baddiff' );
+ } else {
+ ApiResult::setContent( $vals, $difftext );
+ }
$this->getResult()->addValue( null, $this->getModuleName(),
$vals );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs