Merge "Use 'email' instead of 'e-mail' in API texts."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 3 Mar 2013 00:42:48 +0000 (00:42 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 3 Mar 2013 00:42:48 +0000 (00:42 +0000)
1  2 
includes/api/ApiBase.php

diff --combined includes/api/ApiBase.php
@@@ -468,9 -468,6 +468,9 @@@ abstract class ApiBase extends ContextS
                                                                        $desc .= $paramPrefix . $intRangeStr;
                                                                }
                                                                break;
 +                                                      case 'upload':
 +                                                              $desc .= $paramPrefix . "Must be posted as a file upload using multipart/form-data";
 +                                                              break;
                                                }
                                        }
  
                        }
  
                        $value = $this->getMain()->getCheck( $encParamName );
 +              } elseif ( $type == 'upload' ) {
 +                      if ( isset( $default ) ) {
 +                              // Having a default value is not allowed
 +                              ApiBase::dieDebug( __METHOD__, "File upload param $encParamName's default is set to '$default'. File upload parameters may not have a default." );
 +                      }
 +                      if ( $multi ) {
 +                              ApiBase::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
 +                      }
 +                      $value = $this->getMain()->getUpload( $encParamName );
 +                      if ( !$value->exists() ) {
 +                              // This will get the value without trying to normalize it
 +                              // (because trying to normalize a large binary file
 +                              // accidentally uploaded as a field fails spectacularly)
 +                              $value = $this->getMain()->getRequest()->unsetVal( $encParamName );
 +                              if ( $value !== null ) {
 +                                      $this->dieUsage(
 +                                              "File upload param $encParamName is not a file upload; " .
 +                                              "be sure to use multipart/form-data for your POST and include " .
 +                                              "a filename in the Content-Disposition header.",
 +                                              "badupload_{$encParamName}"
 +                                      );
 +                              }
 +                      }
                } else {
                        $value = $this->getMain()->getVal( $encParamName, $default );
  
                                                        $value = $value[0];
                                                }
                                                break;
 +                                      case 'upload': // nothing to do
 +                                              break;
                                        default:
                                                ApiBase::dieDebug( __METHOD__, "Param $encParamName's type is unknown - $type" );
                                }
                'nocreatetext' => array( 'code' => 'cantcreate-anon', 'info' => "Anonymous users can't create new pages" ),
                'movenologintext' => array( 'code' => 'cantmove-anon', 'info' => "Anonymous users can't move pages" ),
                'movenotallowed' => array( 'code' => 'cantmove', 'info' => "You don't have permission to move pages" ),
-               'confirmedittext' => array( 'code' => 'confirmemail', 'info' => "You must confirm your e-mail address before you can edit" ),
+               'confirmedittext' => array( 'code' => 'confirmemail', 'info' => "You must confirm your email address before you can edit" ),
                'blockedtext' => array( 'code' => 'blocked', 'info' => "You have been blocked from editing" ),
                'autoblockedtext' => array( 'code' => 'autoblocked', 'info' => "Your IP address has been blocked automatically, because it was used by a blocked user" ),
  
                'ipb_already_blocked' => array( 'code' => 'alreadyblocked', 'info' => "The user you tried to block was already blocked" ),
                'ipb_blocked_as_range' => array( 'code' => 'blockedasrange', 'info' => "IP address \"\$1\" was blocked as part of range \"\$2\". You can't unblock the IP invidually, but you can unblock the range as a whole." ),
                'ipb_cant_unblock' => array( 'code' => 'cantunblock', 'info' => "The block you specified was not found. It may have been unblocked already" ),
-               'mailnologin' => array( 'code' => 'cantsend', 'info' => "You are not logged in, you do not have a confirmed e-mail address, or you are not allowed to send e-mail to other users, so you cannot send e-mail" ),
+               'mailnologin' => array( 'code' => 'cantsend', 'info' => "You are not logged in, you do not have a confirmed email address, or you are not allowed to send email to other users, so you cannot send email" ),
                'ipbblocked' => array( 'code' => 'ipbblocked', 'info' => 'You cannot block or unblock users while you are yourself blocked' ),
                'ipbnounblockself' => array( 'code' => 'ipbnounblockself', 'info' => 'You are not allowed to unblock yourself' ),
                'usermaildisabled' => array( 'code' => 'usermaildisabled', 'info' => "User email has been disabled" ),
-               'blockedemailuser' => array( 'code' => 'blockedfrommail', 'info' => "You have been blocked from sending e-mail" ),
+               'blockedemailuser' => array( 'code' => 'blockedfrommail', 'info' => "You have been blocked from sending email" ),
                'notarget' => array( 'code' => 'notarget', 'info' => "You have not specified a valid target for this action" ),
-               'noemail' => array( 'code' => 'noemail', 'info' => "The user has not specified a valid e-mail address, or has chosen not to receive e-mail from other users" ),
+               'noemail' => array( 'code' => 'noemail', 'info' => "The user has not specified a valid email address, or has chosen not to receive email from other users" ),
                'rcpatroldisabled' => array( 'code' => 'patroldisabled', 'info' => "Patrolling is disabled on this wiki" ),
                'markedaspatrollederror-noautopatrol' => array( 'code' => 'noautopatrol', 'info' => "You don't have permission to patrol your own changes" ),
                'delete-toobig' => array( 'code' => 'bigdelete', 'info' => "You can't delete this page because it has more than \$1 revisions" ),
                'missingtitle-createonly' => array( 'code' => 'missingtitle-createonly', 'info' => "Missing titles can only be protected with 'create'" ),
                'cantblock' => array( 'code' => 'cantblock', 'info' => "You don't have permission to block users" ),
                'canthide' => array( 'code' => 'canthide', 'info' => "You don't have permission to hide user names from the block log" ),
-               'cantblock-email' => array( 'code' => 'cantblock-email', 'info' => "You don't have permission to block users from sending e-mail through the wiki" ),
+               'cantblock-email' => array( 'code' => 'cantblock-email', 'info' => "You don't have permission to block users from sending email through the wiki" ),
                'unblock-notarget' => array( 'code' => 'notarget', 'info' => "Either the id or the user parameter must be set" ),
                'unblock-idanduser' => array( 'code' => 'idanduser', 'info' => "The id and user parameters can't be used together" ),
                'cantunblock' => array( 'code' => 'permissiondenied', 'info' => "You don't have permission to unblock users" ),