API: Remove dbg, txt, and yaml formats
[lhc/web/wiklou.git] / includes / api / ApiFormatBase.php
index 47c8128..be68310 100644 (file)
@@ -155,7 +155,7 @@ abstract class ApiFormatBase extends ApiBase {
 
                $this->getMain()->getRequest()->response()->header( "Content-Type: $mime; charset=utf-8" );
 
-               //Set X-Frame-Options API results (bug 39180)
+               // Set X-Frame-Options API results (bug 39180)
                $apiFrameOptions = $this->getConfig()->get( 'ApiFrameOptions' );
                if ( $apiFrameOptions ) {
                        $this->getMain()->getRequest()->response()->header( "X-Frame-Options: $apiFrameOptions" );
@@ -182,7 +182,7 @@ abstract class ApiFormatBase extends ApiBase {
                        $out = new OutputPage( $context );
                        $context->setOutput( $out );
 
-                       $out->addModules( 'mediawiki.apipretty' );
+                       $out->addModuleStyles( 'mediawiki.apipretty' );
                        $out->setPageTitle( $context->msg( 'api-format-title' ) );
 
                        // When the format without suffix 'fm' is defined, there is a non-html version
@@ -207,7 +207,7 @@ abstract class ApiFormatBase extends ApiBase {
 
                        // API handles its own clickjacking protection.
                        // Note, that $wgBreakFrames will still override $wgApiFrameOptions for format mode.
-                       $out->allowClickJacking();
+                       $out->allowClickjacking();
                        $out->output();
                } else {
                        // For non-HTML output, clear all errors that might have been
@@ -245,18 +245,6 @@ abstract class ApiFormatBase extends ApiBase {
                return 'https://www.mediawiki.org/wiki/API:Data_formats';
        }
 
-       /**
-        * To avoid code duplication with the deprecation of dbg, dump, txt, wddx,
-        * and yaml, this method is added to do the necessary work. It should be
-        * removed when those deprecated formats are removed.
-        */
-       protected function markDeprecated() {
-               $fm = $this->getIsHtml() ? 'fm' : '';
-               $name = $this->getModuleName();
-               $this->logFeatureUsage( "format=$name" );
-               $this->setWarning( "format=$name has been deprecated. Please use format=json$fm instead." );
-       }
-
        /************************************************************************//**
         * @name   Deprecated
         * @{
@@ -312,7 +300,7 @@ abstract class ApiFormatBase extends ApiBase {
                // Escape everything first for full coverage
                $text = htmlspecialchars( $text );
 
-               if ( $this->mFormat === 'XML' || $this->mFormat === 'WDDX' ) {
+               if ( $this->mFormat === 'XML' ) {
                        // encode all comments or tags as safe blue strings
                        $text = str_replace( '&lt;', '<span style="color:blue;">&lt;', $text );
                        $text = str_replace( '&gt;', '&gt;</span>', $text );
@@ -387,10 +375,11 @@ abstract class ApiFormatBase extends ApiBase {
         * are required to ignore it or filter it out.
         *
         * @deprecated since 1.25
-        * @return bool
+        * @return bool Always true
         */
        public function getNeedsRawData() {
-               return false;
+               wfDeprecated( __METHOD__, '1.25' );
+               return true;
        }
 
        /**@}*/