aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--RELEASE-NOTES-1.241
-rw-r--r--includes/api/ApiFormatBase.php12
-rw-r--r--includes/api/ApiFormatDbg.php3
-rw-r--r--includes/api/ApiFormatDump.php3
-rw-r--r--includes/api/ApiFormatTxt.php3
-rw-r--r--includes/api/ApiFormatWddx.php4
-rw-r--r--includes/api/ApiFormatYaml.php7
7 files changed, 28 insertions, 5 deletions
diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24
index 5e440e397169..4344bea249ba 100644
--- a/RELEASE-NOTES-1.24
+++ b/RELEASE-NOTES-1.24
@@ -228,6 +228,7 @@ production.
limited use and are generally inaccurate, unmaintained, and impossible to
properly maintain. Also removed the corresponding methods from ApiBase and
the 'APIGetPossibleErrors' and 'APIGetResultProperties' hooks.
+* Formats dbg, dump, txt, wddx, and yaml are now deprecated.
=== Languages updated in 1.24 ===
diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php
index 3a0ed46642d4..2e3fc1101477 100644
--- a/includes/api/ApiFormatBase.php
+++ b/includes/api/ApiFormatBase.php
@@ -338,6 +338,18 @@ See the <a href='https://www.mediawiki.org/wiki/API'>complete documentation</a>,
public function getDescription() {
return $this->getIsHtml() ? ' (pretty-print in HTML)' : '';
}
+
+ /**
+ * 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." );
+ }
}
/**
diff --git a/includes/api/ApiFormatDbg.php b/includes/api/ApiFormatDbg.php
index 1b2e02c9add0..61ed18f464f1 100644
--- a/includes/api/ApiFormatDbg.php
+++ b/includes/api/ApiFormatDbg.php
@@ -38,10 +38,11 @@ class ApiFormatDbg extends ApiFormatBase {
}
public function execute() {
+ $this->markDeprecated();
$this->printText( var_export( $this->getResultData(), true ) );
}
public function getDescription() {
- return 'Output data in PHP\'s var_export() format' . parent::getDescription();
+ return 'DEPRECATED! Output data in PHP\'s var_export() format' . parent::getDescription();
}
}
diff --git a/includes/api/ApiFormatDump.php b/includes/api/ApiFormatDump.php
index 62253e1466f7..7d3224604a9d 100644
--- a/includes/api/ApiFormatDump.php
+++ b/includes/api/ApiFormatDump.php
@@ -38,6 +38,7 @@ class ApiFormatDump extends ApiFormatBase {
}
public function execute() {
+ $this->markDeprecated();
ob_start();
var_dump( $this->getResultData() );
$result = ob_get_contents();
@@ -46,6 +47,6 @@ class ApiFormatDump extends ApiFormatBase {
}
public function getDescription() {
- return 'Output data in PHP\'s var_dump() format' . parent::getDescription();
+ return 'DEPRECATED! Output data in PHP\'s var_dump() format' . parent::getDescription();
}
}
diff --git a/includes/api/ApiFormatTxt.php b/includes/api/ApiFormatTxt.php
index 4130e70cf2d2..3de2943d46a2 100644
--- a/includes/api/ApiFormatTxt.php
+++ b/includes/api/ApiFormatTxt.php
@@ -38,10 +38,11 @@ class ApiFormatTxt extends ApiFormatBase {
}
public function execute() {
+ $this->markDeprecated();
$this->printText( print_r( $this->getResultData(), true ) );
}
public function getDescription() {
- return 'Output data in PHP\'s print_r() format' . parent::getDescription();
+ return 'DEPRECATED! Output data in PHP\'s print_r() format' . parent::getDescription();
}
}
diff --git a/includes/api/ApiFormatWddx.php b/includes/api/ApiFormatWddx.php
index 2e58c720fa2b..a08c3abc12df 100644
--- a/includes/api/ApiFormatWddx.php
+++ b/includes/api/ApiFormatWddx.php
@@ -35,6 +35,8 @@ class ApiFormatWddx extends ApiFormatBase {
}
public function execute() {
+ $this->markDeprecated();
+
// Some versions of PHP have a broken wddx_serialize_value, see
// PHP bug 45314. Test encoding an affected character (U+00A0)
// to avoid this.
@@ -107,6 +109,6 @@ class ApiFormatWddx extends ApiFormatBase {
}
public function getDescription() {
- return 'Output data in WDDX format' . parent::getDescription();
+ return 'DEPRECATED! Output data in WDDX format' . parent::getDescription();
}
}
diff --git a/includes/api/ApiFormatYaml.php b/includes/api/ApiFormatYaml.php
index 700d4a5e9dc1..9f9b0577dd56 100644
--- a/includes/api/ApiFormatYaml.php
+++ b/includes/api/ApiFormatYaml.php
@@ -34,7 +34,12 @@ class ApiFormatYaml extends ApiFormatJson {
return 'application/yaml';
}
+ public function execute() {
+ $this->markDeprecated();
+ parent::execute();
+ }
+
public function getDescription() {
- return 'Output data in YAML format' . ApiFormatBase::getDescription();
+ return 'DEPRECATED! Output data in YAML format' . ApiFormatBase::getDescription();
}
}