From b69da9ad53743b9e66123d8363e26902e719ec80 Mon Sep 17 00:00:00 2001 From: Nikola Smolenski Date: Mon, 16 Apr 2012 17:45:51 +0200 Subject: [PATCH] New API format 'none', used to minimize the response size when the output is not needed. Change-Id: I0308d16ea04735bc27ac4a3526baec44ccd426f1 --- includes/AutoLoader.php | 1 + includes/api/ApiFormatNone.php | 51 ++++++++++++++++++++++++++++++++++ includes/api/ApiMain.php | 1 + 3 files changed, 53 insertions(+) create mode 100644 includes/api/ApiFormatNone.php diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 02ad3db760..0f55af2c6f 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -314,6 +314,7 @@ $wgAutoloadLocalClasses = array( 'ApiFormatDump' => 'includes/api/ApiFormatDump.php', 'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php', 'ApiFormatJson' => 'includes/api/ApiFormatJson.php', + 'ApiFormatNone' => 'includes/api/ApiFormatNone.php', 'ApiFormatPhp' => 'includes/api/ApiFormatPhp.php', 'ApiFormatRaw' => 'includes/api/ApiFormatRaw.php', 'ApiFormatTxt' => 'includes/api/ApiFormatTxt.php', diff --git a/includes/api/ApiFormatNone.php b/includes/api/ApiFormatNone.php new file mode 100644 index 0000000000..31c90e101a --- /dev/null +++ b/includes/api/ApiFormatNone.php @@ -0,0 +1,51 @@ +@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ + +/** + * API Serialized PHP output formatter + * @ingroup API + */ +class ApiFormatNone extends ApiFormatBase { + + public function __construct( $main, $format ) { + parent::__construct( $main, $format ); + } + + public function getMimeType() { + return 'text/plain'; + } + + public function execute() { + } + + public function getDescription() { + return 'Output nothing' . parent::getDescription(); + } + + public function getVersion() { + return __CLASS__ . ': $Id$'; + } +} diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 2105b811b9..60b61cd829 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -103,6 +103,7 @@ class ApiMain extends ApiBase { 'dbgfm' => 'ApiFormatDbg', 'dump' => 'ApiFormatDump', 'dumpfm' => 'ApiFormatDump', + 'none' => 'ApiFormatNone', ); /** -- 2.20.1