From 8ce53a86c633d8afb8c274b6745b88807f9a5197 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Mon, 8 Jan 2018 09:21:23 -0500 Subject: [PATCH] API: Don't apply size limit to action=compare Some diffs can be really huge. Since ApiComparePages is intended to return only the diff and some small metadata, bypass $wgAPIMaxResultSize to allow the diff to be returned even if it's insanely huge. Really insanely huge diffs might still make PHP run out of memory, even before it gets the chance to return the diff to the API. That is outside the scope of this change. Bug: T184412 Change-Id: I755417f573c3caf85031d03b262aa55bd8cf36d7 --- includes/api/ApiComparePages.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index 54865948a8..375fc18936 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -167,7 +167,10 @@ class ApiComparePages extends ApiBase { ApiResult::setContentValue( $vals, 'body', $difftext ); } - $this->getResult()->addValue( null, $this->getModuleName(), $vals ); + // Diffs can be really big and there's little point in having + // ApiResult truncate it to an empty response since the diff is the + // whole reason this module exists. So pass NO_SIZE_CHECK here. + $this->getResult()->addValue( null, $this->getModuleName(), $vals, ApiResult::NO_SIZE_CHECK ); } /** -- 2.20.1