Merge "Remove "@author Bryan Davis" and "Brad Jorsch" annotations"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 27 Jun 2017 06:02:23 +0000 (06:02 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 27 Jun 2017 06:02:23 +0000 (06:02 +0000)
1  2 
includes/api/ApiHelp.php
includes/api/ApiHelpParamValueMessage.php
includes/api/ApiOpenSearch.php
includes/api/ApiResetPassword.php

diff --combined includes/api/ApiHelp.php
@@@ -4,7 -4,7 +4,7 @@@
   *
   * Created on Aug 29, 2014
   *
-  * Copyright © 2014 Brad Jorsch <bjorsch@wikimedia.org>
+  * Copyright © 2014 Wikimedia Foundation and contributors
   *
   * 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
@@@ -489,22 -489,12 +489,22 @@@ class ApiHelp extends ApiBase 
  
                                                if ( is_array( $type ) ) {
                                                        $count = count( $type );
 +                                                      $deprecatedValues = isset( $settings[ApiBase::PARAM_DEPRECATED_VALUES] )
 +                                                              ? $settings[ApiBase::PARAM_DEPRECATED_VALUES]
 +                                                              : [];
                                                        $links = isset( $settings[ApiBase::PARAM_VALUE_LINKS] )
                                                                ? $settings[ApiBase::PARAM_VALUE_LINKS]
                                                                : [];
 -                                                      $values = array_map( function ( $v ) use ( $links ) {
 -                                                              // We can't know whether this contains LTR or RTL text.
 -                                                              $ret = $v === '' ? $v : Html::element( 'span', [ 'dir' => 'auto' ], $v );
 +                                                      $values = array_map( function ( $v ) use ( $links, $deprecatedValues ) {
 +                                                              $attr = [];
 +                                                              if ( $v !== '' ) {
 +                                                                      // We can't know whether this contains LTR or RTL text.
 +                                                                      $attr['dir'] = 'auto';
 +                                                              }
 +                                                              if ( isset( $deprecatedValues[$v] ) ) {
 +                                                                      $attr['class'] = 'apihelp-deprecated-value';
 +                                                              }
 +                                                              $ret = $attr ? Html::element( 'span', $attr, $v ) : $v;
                                                                if ( isset( $links[$v] ) ) {
                                                                        $ret = "[[{$links[$v]}|$ret]]";
                                                                }
                                                        switch ( $type ) {
                                                                case 'submodule':
                                                                        $groups[] = $name;
 +
                                                                        if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
                                                                                $map = $settings[ApiBase::PARAM_SUBMODULE_MAP];
 -                                                                              ksort( $map );
 -                                                                              $submodules = [];
 -                                                                              foreach ( $map as $v => $m ) {
 -                                                                                      $submodules[] = "[[Special:ApiHelp/{$m}|{$v}]]";
 -                                                                              }
 +                                                                              $defaultAttrs = [];
                                                                        } else {
 -                                                                              $submodules = $module->getModuleManager()->getNames( $name );
 -                                                                              sort( $submodules );
 -                                                                              $prefix = $module->isMain()
 -                                                                                      ? '' : ( $module->getModulePath() . '+' );
 -                                                                              $submodules = array_map( function ( $name ) use ( $prefix ) {
 -                                                                                      $text = Html::element( 'span', [ 'dir' => 'ltr', 'lang' => 'en' ], $name );
 -                                                                                      return "[[Special:ApiHelp/{$prefix}{$name}|{$text}]]";
 -                                                                              }, $submodules );
 +                                                                              $prefix = $module->isMain() ? '' : ( $module->getModulePath() . '+' );
 +                                                                              $map = [];
 +                                                                              foreach ( $module->getModuleManager()->getNames( $name ) as $submoduleName ) {
 +                                                                                      $map[$submoduleName] = $prefix . $submoduleName;
 +                                                                              }
 +                                                                              $defaultAttrs = [ 'dir' => 'ltr', 'lang' => 'en' ];
 +                                                                      }
 +                                                                      ksort( $map );
 +
 +                                                                      $submodules = [];
 +                                                                      $deprecatedSubmodules = [];
 +                                                                      foreach ( $map as $v => $m ) {
 +                                                                              $attrs = $defaultAttrs;
 +                                                                              $arr = &$submodules;
 +                                                                              try {
 +                                                                                      $submod = $module->getModuleFromPath( $m );
 +                                                                                      if ( $submod ) {
 +                                                                                              if ( $submod->isDeprecated() ) {
 +                                                                                                      $arr = &$deprecatedSubmodules;
 +                                                                                                      $attrs['class'] = 'apihelp-deprecated-value';
 +                                                                                              }
 +                                                                                      }
 +                                                                              } catch ( ApiUsageException $ex ) {
 +                                                                                      // Ignore
 +                                                                              }
 +                                                                              if ( $attrs ) {
 +                                                                                      $v = Html::element( 'span', $attrs, $v );
 +                                                                              }
 +                                                                              $arr[] = "[[Special:ApiHelp/{$m}|{$v}]]";
                                                                        }
 +                                                                      $submodules = array_merge( $submodules, $deprecatedSubmodules );
                                                                        $count = count( $submodules );
                                                                        $info[] = $context->msg( 'api-help-param-list' )
                                                                                ->params( $multi ? 2 : 1 )
@@@ -4,7 -4,7 +4,7 @@@
   *
   * Created on Dec 22, 2014
   *
-  * Copyright © 2014 Brad Jorsch <bjorsch@wikimedia.org>
+  * Copyright © 2014 Wikimedia Foundation and contributors
   *
   * 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
@@@ -36,7 -36,6 +36,7 @@@
  class ApiHelpParamValueMessage extends Message {
  
        protected $paramValue;
 +      protected $deprecated;
  
        /**
         * @see Message::__construct
         * @param string $paramValue Parameter value being documented
         * @param string $text Message to use.
         * @param array $params Parameters for the message.
 +       * @param bool $deprecated Whether the value is deprecated
         * @throws InvalidArgumentException
 +       * @since 1.30 Added the `$deprecated` parameter
         */
 -      public function __construct( $paramValue, $text, $params = [] ) {
 +      public function __construct( $paramValue, $text, $params = [], $deprecated = false ) {
                parent::__construct( $text, $params );
                $this->paramValue = $paramValue;
 +              $this->deprecated = (bool)$deprecated;
        }
  
        /**
                return $this->paramValue;
        }
  
 +      /**
 +       * Fetch the 'deprecated' flag
 +       * @since 1.30
 +       * @return bool
 +       */
 +      public function isDeprecated() {
 +              return $this->deprecated;
 +      }
 +
        /**
         * Fetch the message.
         * @return string
         */
        public function fetchMessage() {
                if ( $this->message === null ) {
 +                      $dep = '';
 +                      if ( $this->isDeprecated() ) {
 +                              $msg = new Message( 'api-help-param-deprecated' );
 +                              $msg->interface = $this->interface;
 +                              $msg->language = $this->language;
 +                              $msg->useDatabase = $this->useDatabase;
 +                              $msg->title = $this->title;
 +                              $dep = '<span class="apihelp-deprecated">' . $msg->fetchMessage() . '</span> ';
 +                      }
                        $this->message = ";<span dir=\"ltr\" lang=\"en\">{$this->paramValue}</span>:"
 -                              . parent::fetchMessage();
 +                              . $dep . parent::fetchMessage();
                }
                return $this->message;
        }
@@@ -4,7 -4,7 +4,7 @@@
   *
   * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
   * Copyright © 2008 Brion Vibber <brion@wikimedia.org>
-  * Copyright © 2014 Brad Jorsch <bjorsch@wikimedia.org>
+  * Copyright © 2014 Wikimedia Foundation and contributors
   *
   * 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
@@@ -232,7 -232,7 +232,7 @@@ class ApiOpenSearch extends ApiBase 
                                break;
  
                        case 'xml':
 -                              // http://msdn.microsoft.com/en-us/library/cc891508%28v=vs.85%29.aspx
 +                              // https://msdn.microsoft.com/en-us/library/cc891508(v=vs.85).aspx
                                $imageKeys = [
                                        'source' => true,
                                        'alt' => true,
@@@ -1,6 -1,6 +1,6 @@@
  <?php
  /**
-  * Copyright © 2016 Brad Jorsch <bjorsch@wikimedia.org>
+  * Copyright © 2016 Wikimedia Foundation and contributors
   *
   * 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
@@@ -43,11 -43,11 +43,11 @@@ class ApiResetPassword extends ApiBase 
                return $this->hasAnyRoutes;
        }
  
 -      protected function getDescriptionMessage() {
 +      protected function getExtendedDescription() {
                if ( !$this->hasAnyRoutes() ) {
 -                      return 'apihelp-resetpassword-description-noroutes';
 +                      return 'apihelp-resetpassword-extended-description-noroutes';
                }
 -              return parent::getDescriptionMessage();
 +              return parent::getExtendedDescription();
        }
  
        public function execute() {