From: Brad Jorsch Date: Thu, 14 Aug 2014 18:15:23 +0000 (-0400) Subject: API: Log usage of various deprecated features X-Git-Tag: 1.31.0-rc.0~14423 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=b5cd9e2f6bfe812df646c23bdc0121b86000e14f;p=lhc%2Fweb%2Fwiklou.git API: Log usage of various deprecated features This will let us know how aggressively we can finally remove these. Change-Id: I03fab36e921807e74fbabfa878756af254d89a1b --- diff --git a/includes/api/ApiDelete.php b/includes/api/ApiDelete.php index f26d58bd4a..aab0303275 100644 --- a/includes/api/ApiDelete.php +++ b/includes/api/ApiDelete.php @@ -72,8 +72,10 @@ class ApiDelete extends ApiBase { // Deprecated parameters if ( $params['watch'] ) { + $this->logFeatureUsage( 'action=delete&watch' ); $watch = 'watch'; } elseif ( $params['unwatch'] ) { + $this->logFeatureUsage( 'action=delete&unwatch' ); $watch = 'unwatch'; } else { $watch = $params['watchlist']; diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index fff061f928..9126ad3c6b 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -309,8 +309,10 @@ class ApiEditPage extends ApiBase { // Deprecated parameters if ( $params['watch'] ) { + $this->logFeatureUsage( 'action=edit&watch' ); $watch = true; } elseif ( $params['unwatch'] ) { + $this->logFeatureUsage( 'action=edit&unwatch' ); $watch = false; } diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index c2cec6d8f7..8a3b534d4b 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -42,6 +42,7 @@ class ApiExpandTemplates extends ApiBase { $this->requireMaxOneParameter( $params, 'prop', 'generatexml' ); if ( $params['prop'] === null ) { + $this->logFeatureUsage( 'action=expandtemplates&!prop' ); $this->setWarning( 'Because no values have been specified for the prop parameter, a ' . 'legacy format has been used for the output. This format is deprecated, and in ' . 'the future, a default value will be set for the prop parameter, causing the new' . @@ -70,6 +71,10 @@ class ApiExpandTemplates extends ApiBase { $retval = array(); if ( isset( $prop['parsetree'] ) || $params['generatexml'] ) { + if ( !isset( $prop['parsetree'] ) ) { + $this->logFeatureUsage( 'action=expandtemplates&generatexml' ); + } + $wgParser->startExternalParse( $title_obj, $options, OT_PREPROCESS ); $dom = $wgParser->preprocessToDom( $params['text'] ); if ( is_callable( array( $dom, 'saveXML' ) ) ) { diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index b0b832862a..bcd6c12e7c 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -51,6 +51,7 @@ class ApiHelp extends ApiBase { } if ( is_array( $params['querymodules'] ) ) { + $this->logFeatureUsage( 'action=help&querymodules' ); $queryModules = $params['querymodules']; foreach ( $queryModules as $m ) { $modules[] = 'query+' . $m; diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php index cc585732b7..602a905311 100644 --- a/includes/api/ApiMove.php +++ b/includes/api/ApiMove.php @@ -134,8 +134,10 @@ class ApiMove extends ApiBase { $watch = $params['watchlist']; } elseif ( $params['watch'] ) { $watch = 'watch'; + $this->logFeatureUsage( 'action=move&watch' ); } elseif ( $params['unwatch'] ) { $watch = 'unwatch'; + $this->logFeatureUsage( 'action=move&unwatch' ); } // Watch pages diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 828fc22ab2..844d1ccee7 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -102,6 +102,9 @@ class ApiProtect extends ApiBase { $cascade = $params['cascade']; + if ( $params['watch'] ) { + $this->logFeatureUsage( 'action=protect&watch' ); + } $watch = $params['watch'] ? 'watch' : $params['watchlist']; $this->setWatch( $watch, $titleObj, 'watchdefault' ); diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index d04e5b4f64..da05f2732b 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -50,6 +50,7 @@ class ApiQueryLangLinks extends ApiQueryBase { // Handle deprecated param $this->requireMaxOneParameter( $params, 'url', 'prop' ); if ( $params['url'] ) { + $this->logFeatureUsage( 'prop=langlinks&llurl' ); $prop = array( 'url' => 1 ); } diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index d7904d4ad9..db9285602a 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -47,6 +47,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { // Alias sessionkey to filekey, but give an existing filekey precedence. if ( !$params['filekey'] && $params['sessionkey'] ) { + $this->logFeatureUsage( 'prop=stashimageinfo&siisessionkey' ); $params['filekey'] = $params['sessionkey']; } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index b8b4e3156e..4b167b8b7a 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -224,6 +224,7 @@ class ApiQueryContributions extends ApiQueryBase { $show = $this->params['show']; if ( $this->params['toponly'] ) { // deprecated/old param + $this->logFeatureUsage( 'list=usercontribs&uctoponly' ); $show[] = 'top'; } if ( !is_null( $show ) ) { diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 31816d6f59..368e7ce6a4 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -52,6 +52,7 @@ class ApiUpload extends ApiBase { // Copy the session key to the file key, for backward compatibility. if ( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) { + $this->logFeatureUsage( 'action=upload&sessionkey' ); $this->mParams['filekey'] = $this->mParams['sessionkey']; } @@ -604,6 +605,7 @@ class ApiUpload extends ApiBase { // Deprecated parameters if ( $this->mParams['watch'] ) { + $this->logFeatureUsage( 'action=upload&watch' ); $watch = true; } diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php index 43ff4eccf6..80602606c8 100644 --- a/includes/api/ApiWatch.php +++ b/includes/api/ApiWatch.php @@ -84,6 +84,7 @@ class ApiWatch extends ApiBase { ); } + $this->logFeatureUsage( 'action=watch&title' ); $title = Title::newFromText( $params['title'] ); if ( !$title || !$title->isWatchable() ) { $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );