Made upload jobs avoid using the user session
[lhc/web/wiklou.git] / includes / api / ApiExpandTemplates.php
index 82d303f..8a3b534 100644 (file)
@@ -42,8 +42,11 @@ class ApiExpandTemplates extends ApiBase {
                $this->requireMaxOneParameter( $params, 'prop', 'generatexml' );
 
                if ( $params['prop'] === null ) {
-                       $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 format to always be used.' );
+                       $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' .
+                               'format to always be used.' );
                        $prop = array();
                } else {
                        $prop = array_flip( $params['prop'] );
@@ -68,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' ) ) ) {
@@ -159,9 +166,12 @@ class ApiExpandTemplates extends ApiBase {
                        'prop' => array(
                                'Which pieces of information to get',
                                ' wikitext   - The expanded wikitext',
-                               ' categories - Any categories present in the input that are not represented in the wikitext output',
-                               ' volatile   - Whether the output is volatile and should not be reused elsewhere within the page',
-                               ' ttl        - The maximum time after which caches of the result should be invalidated',
+                               ' categories - Any categories present in the input that are not represented in ' .
+                                       'the wikitext output',
+                               ' volatile   - Whether the output is volatile and should not be reused ' .
+                                       'elsewhere within the page',
+                               ' ttl        - The maximum time after which caches of the result should be ' .
+                                       'invalidated',
                                ' parsetree  - The XML parse tree of the input',
                                'Note that if no values are selected, the result will contain the wikitext,',
                                'but the output will be in a deprecated format.',
@@ -171,45 +181,10 @@ class ApiExpandTemplates extends ApiBase {
                );
        }
 
-       public function getResultProperties() {
-               return array(
-                       'wikitext' => array(
-                               'wikitext' => 'string',
-                       ),
-                       'categories' => array(
-                               'categories' => array(
-                                       ApiBase::PROP_TYPE => 'array',
-                                       ApiBase::PROP_NULLABLE => true,
-                               ),
-                       ),
-                       'volatile' => array(
-                               'volatile' => array(
-                                       ApiBase::PROP_TYPE => 'boolean',
-                                       ApiBase::PROP_NULLABLE => true,
-                               ),
-                       ),
-                       'ttl' => array(
-                               'ttl' => array(
-                                       ApiBase::PROP_TYPE => 'integer',
-                                       ApiBase::PROP_NULLABLE => true,
-                               ),
-                       ),
-                       'parsetree' => array(
-                               'parsetree' => 'string',
-                       ),
-               );
-       }
-
        public function getDescription() {
                return 'Expands all templates in wikitext.';
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array( 'invalidtitle', 'title' ),
-               ) );
-       }
-
        public function getExamples() {
                return array(
                        'api.php?action=expandtemplates&text={{Project:Sandbox}}'