MediaWiki
REL1_20
|
00001 <?php 00030 class ApiUpload extends ApiBase { 00031 00035 protected $mUpload = null; 00036 00037 protected $mParams; 00038 00039 public function __construct( $main, $action ) { 00040 parent::__construct( $main, $action ); 00041 } 00042 00043 public function execute() { 00044 // Check whether upload is enabled 00045 if ( !UploadBase::isEnabled() ) { 00046 $this->dieUsageMsg( 'uploaddisabled' ); 00047 } 00048 00049 $user = $this->getUser(); 00050 00051 // Parameter handling 00052 $this->mParams = $this->extractRequestParams(); 00053 $request = $this->getMain()->getRequest(); 00054 // Add the uploaded file to the params array 00055 $this->mParams['file'] = $request->getFileName( 'file' ); 00056 $this->mParams['chunk'] = $request->getFileName( 'chunk' ); 00057 00058 // Copy the session key to the file key, for backward compatibility. 00059 if( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) { 00060 $this->mParams['filekey'] = $this->mParams['sessionkey']; 00061 } 00062 00063 // Select an upload module 00064 if ( !$this->selectUploadModule() ) { 00065 // This is not a true upload, but a status request or similar 00066 return; 00067 } 00068 if ( !isset( $this->mUpload ) ) { 00069 $this->dieUsage( 'No upload module set', 'nomodule' ); 00070 } 00071 00072 // First check permission to upload 00073 $this->checkPermissions( $user ); 00074 00075 // Fetch the file 00076 $status = $this->mUpload->fetchFile(); 00077 if ( !$status->isGood() ) { 00078 $errors = $status->getErrorsArray(); 00079 $error = array_shift( $errors[0] ); 00080 $this->dieUsage( 'Error fetching file from remote source', $error, 0, $errors[0] ); 00081 } 00082 00083 // Check if the uploaded file is sane 00084 if ( $this->mParams['chunk'] ) { 00085 $maxSize = $this->mUpload->getMaxUploadSize( ); 00086 if( $this->mParams['filesize'] > $maxSize ) { 00087 $this->dieUsage( 'The file you submitted was too large', 'file-too-large' ); 00088 } 00089 } else { 00090 $this->verifyUpload(); 00091 } 00092 00093 // Check if the user has the rights to modify or overwrite the requested title 00094 // (This check is irrelevant if stashing is already requested, since the errors 00095 // can always be fixed by changing the title) 00096 if ( ! $this->mParams['stash'] ) { 00097 $permErrors = $this->mUpload->verifyTitlePermissions( $user ); 00098 if ( $permErrors !== true ) { 00099 $this->dieRecoverableError( $permErrors[0], 'filename' ); 00100 } 00101 } 00102 // Get the result based on the current upload context: 00103 $result = $this->getContextResult(); 00104 00105 if ( $result['result'] === 'Success' ) { 00106 $result['imageinfo'] = $this->mUpload->getImageInfo( $this->getResult() ); 00107 } 00108 00109 $this->getResult()->addValue( null, $this->getModuleName(), $result ); 00110 00111 // Cleanup any temporary mess 00112 $this->mUpload->cleanupTempFile(); 00113 } 00118 private function getContextResult(){ 00119 $warnings = $this->getApiWarnings(); 00120 if ( $warnings && !$this->mParams['ignorewarnings'] ) { 00121 // Get warnings formated in result array format 00122 return $this->getWarningsResult( $warnings ); 00123 } elseif ( $this->mParams['chunk'] ) { 00124 // Add chunk, and get result 00125 return $this->getChunkResult( $warnings ); 00126 } elseif ( $this->mParams['stash'] ) { 00127 // Stash the file and get stash result 00128 return $this->getStashResult( $warnings ); 00129 } 00130 // This is the most common case -- a normal upload with no warnings 00131 // performUpload will return a formatted properly for the API with status 00132 return $this->performUpload( $warnings ); 00133 } 00139 private function getStashResult( $warnings ){ 00140 $result = array (); 00141 // Some uploads can request they be stashed, so as not to publish them immediately. 00142 // In this case, a failure to stash ought to be fatal 00143 try { 00144 $result['result'] = 'Success'; 00145 $result['filekey'] = $this->performStash(); 00146 $result['sessionkey'] = $result['filekey']; // backwards compatibility 00147 if ( $warnings && count( $warnings ) > 0 ) { 00148 $result['warnings'] = $warnings; 00149 } 00150 } catch ( MWException $e ) { 00151 $this->dieUsage( $e->getMessage(), 'stashfailed' ); 00152 } 00153 return $result; 00154 } 00160 private function getWarningsResult( $warnings ){ 00161 $result = array(); 00162 $result['result'] = 'Warning'; 00163 $result['warnings'] = $warnings; 00164 // in case the warnings can be fixed with some further user action, let's stash this upload 00165 // and return a key they can use to restart it 00166 try { 00167 $result['filekey'] = $this->performStash(); 00168 $result['sessionkey'] = $result['filekey']; // backwards compatibility 00169 } catch ( MWException $e ) { 00170 $result['warnings']['stashfailed'] = $e->getMessage(); 00171 } 00172 return $result; 00173 } 00179 private function getChunkResult( $warnings ){ 00180 $result = array(); 00181 00182 $result['result'] = 'Continue'; 00183 if ( $warnings && count( $warnings ) > 0 ) { 00184 $result['warnings'] = $warnings; 00185 } 00186 $request = $this->getMain()->getRequest(); 00187 $chunkPath = $request->getFileTempname( 'chunk' ); 00188 $chunkSize = $request->getUpload( 'chunk' )->getSize(); 00189 if ($this->mParams['offset'] == 0) { 00190 try { 00191 $result['filekey'] = $this->performStash(); 00192 } catch ( MWException $e ) { 00193 // FIXME: Error handling here is wrong/different from rest of this 00194 $this->dieUsage( $e->getMessage(), 'stashfailed' ); 00195 } 00196 } else { 00197 $status = $this->mUpload->addChunk($chunkPath, $chunkSize, 00198 $this->mParams['offset']); 00199 if ( !$status->isGood() ) { 00200 $this->dieUsage( $status->getWikiText(), 'stashfailed' ); 00201 return array(); 00202 } 00203 00204 // Check we added the last chunk: 00205 if( $this->mParams['offset'] + $chunkSize == $this->mParams['filesize'] ) { 00206 $status = $this->mUpload->concatenateChunks(); 00207 00208 if ( !$status->isGood() ) { 00209 $this->dieUsage( $status->getWikiText(), 'stashfailed' ); 00210 return array(); 00211 } 00212 00213 // We have a new filekey for the fully concatenated file. 00214 $result['filekey'] = $this->mUpload->getLocalFile()->getFileKey(); 00215 00216 // Remove chunk from stash. (Checks against user ownership of chunks.) 00217 $this->mUpload->stash->removeFile( $this->mParams['filekey'] ); 00218 00219 $result['result'] = 'Success'; 00220 00221 } else { 00222 00223 // Continue passing through the filekey for adding further chunks. 00224 $result['filekey'] = $this->mParams['filekey']; 00225 } 00226 } 00227 $result['offset'] = $this->mParams['offset'] + $chunkSize; 00228 return $result; 00229 } 00230 00237 function performStash() { 00238 try { 00239 $stashFile = $this->mUpload->stashFile(); 00240 00241 if ( !$stashFile ) { 00242 throw new MWException( 'Invalid stashed file' ); 00243 } 00244 $fileKey = $stashFile->getFileKey(); 00245 } catch ( MWException $e ) { 00246 $message = 'Stashing temporary file failed: ' . get_class( $e ) . ' ' . $e->getMessage(); 00247 wfDebug( __METHOD__ . ' ' . $message . "\n"); 00248 throw new MWException( $message ); 00249 } 00250 return $fileKey; 00251 } 00252 00262 function dieRecoverableError( $error, $parameter, $data = array() ) { 00263 try { 00264 $data['filekey'] = $this->performStash(); 00265 $data['sessionkey'] = $data['filekey']; 00266 } catch ( MWException $e ) { 00267 $data['stashfailed'] = $e->getMessage(); 00268 } 00269 $data['invalidparameter'] = $parameter; 00270 00271 $parsed = $this->parseMsg( $error ); 00272 $this->dieUsage( $parsed['info'], $parsed['code'], 0, $data ); 00273 } 00274 00282 protected function selectUploadModule() { 00283 $request = $this->getMain()->getRequest(); 00284 00285 // chunk or one and only one of the following parameters is needed 00286 if( !$this->mParams['chunk'] ) { 00287 $this->requireOnlyOneParameter( $this->mParams, 00288 'filekey', 'file', 'url', 'statuskey' ); 00289 } 00290 00291 if ( $this->mParams['statuskey'] ) { 00292 $this->checkAsyncDownloadEnabled(); 00293 00294 // Status request for an async upload 00295 $sessionData = UploadFromUrlJob::getSessionData( $this->mParams['statuskey'] ); 00296 if ( !isset( $sessionData['result'] ) ) { 00297 $this->dieUsage( 'No result in session data', 'missingresult' ); 00298 } 00299 if ( $sessionData['result'] == 'Warning' ) { 00300 $sessionData['warnings'] = $this->transformWarnings( $sessionData['warnings'] ); 00301 $sessionData['sessionkey'] = $this->mParams['statuskey']; 00302 } 00303 $this->getResult()->addValue( null, $this->getModuleName(), $sessionData ); 00304 return false; 00305 00306 } 00307 00308 // The following modules all require the filename parameter to be set 00309 if ( is_null( $this->mParams['filename'] ) ) { 00310 $this->dieUsageMsg( array( 'missingparam', 'filename' ) ); 00311 } 00312 00313 if ( $this->mParams['chunk'] ) { 00314 // Chunk upload 00315 $this->mUpload = new UploadFromChunks(); 00316 if( isset( $this->mParams['filekey'] ) ){ 00317 // handle new chunk 00318 $this->mUpload->continueChunks( 00319 $this->mParams['filename'], 00320 $this->mParams['filekey'], 00321 $request->getUpload( 'chunk' ) 00322 ); 00323 } else { 00324 // handle first chunk 00325 $this->mUpload->initialize( 00326 $this->mParams['filename'], 00327 $request->getUpload( 'chunk' ) 00328 ); 00329 } 00330 } elseif ( isset( $this->mParams['filekey'] ) ) { 00331 // Upload stashed in a previous request 00332 if ( !UploadFromStash::isValidKey( $this->mParams['filekey'] ) ) { 00333 $this->dieUsageMsg( 'invalid-file-key' ); 00334 } 00335 00336 $this->mUpload = new UploadFromStash( $this->getUser() ); 00337 00338 $this->mUpload->initialize( $this->mParams['filekey'], $this->mParams['filename'] ); 00339 } elseif ( isset( $this->mParams['file'] ) ) { 00340 $this->mUpload = new UploadFromFile(); 00341 $this->mUpload->initialize( 00342 $this->mParams['filename'], 00343 $request->getUpload( 'file' ) 00344 ); 00345 } elseif ( isset( $this->mParams['url'] ) ) { 00346 // Make sure upload by URL is enabled: 00347 if ( !UploadFromUrl::isEnabled() ) { 00348 $this->dieUsageMsg( 'copyuploaddisabled' ); 00349 } 00350 00351 if ( !UploadFromUrl::isAllowedHost( $this->mParams['url'] ) ) { 00352 $this->dieUsageMsg( 'copyuploadbaddomain' ); 00353 } 00354 00355 $async = false; 00356 if ( $this->mParams['asyncdownload'] ) { 00357 $this->checkAsyncDownloadEnabled(); 00358 00359 if ( $this->mParams['leavemessage'] && !$this->mParams['ignorewarnings'] ) { 00360 $this->dieUsage( 'Using leavemessage without ignorewarnings is not supported', 00361 'missing-ignorewarnings' ); 00362 } 00363 00364 if ( $this->mParams['leavemessage'] ) { 00365 $async = 'async-leavemessage'; 00366 } else { 00367 $async = 'async'; 00368 } 00369 } 00370 $this->mUpload = new UploadFromUrl; 00371 $this->mUpload->initialize( $this->mParams['filename'], 00372 $this->mParams['url'], $async ); 00373 } 00374 00375 return true; 00376 } 00377 00383 protected function checkPermissions( $user ) { 00384 // Check whether the user has the appropriate permissions to upload anyway 00385 $permission = $this->mUpload->isAllowed( $user ); 00386 00387 if ( $permission !== true ) { 00388 if ( !$user->isLoggedIn() ) { 00389 $this->dieUsageMsg( array( 'mustbeloggedin', 'upload' ) ); 00390 } else { 00391 $this->dieUsageMsg( 'badaccess-groups' ); 00392 } 00393 } 00394 } 00395 00399 protected function verifyUpload( ) { 00400 global $wgFileExtensions; 00401 00402 $verification = $this->mUpload->verifyUpload( ); 00403 if ( $verification['status'] === UploadBase::OK ) { 00404 return; 00405 } 00406 00407 // TODO: Move them to ApiBase's message map 00408 switch( $verification['status'] ) { 00409 // Recoverable errors 00410 case UploadBase::MIN_LENGTH_PARTNAME: 00411 $this->dieRecoverableError( 'filename-tooshort', 'filename' ); 00412 break; 00413 case UploadBase::ILLEGAL_FILENAME: 00414 $this->dieRecoverableError( 'illegal-filename', 'filename', 00415 array( 'filename' => $verification['filtered'] ) ); 00416 break; 00417 case UploadBase::FILENAME_TOO_LONG: 00418 $this->dieRecoverableError( 'filename-toolong', 'filename' ); 00419 break; 00420 case UploadBase::FILETYPE_MISSING: 00421 $this->dieRecoverableError( 'filetype-missing', 'filename' ); 00422 break; 00423 case UploadBase::WINDOWS_NONASCII_FILENAME: 00424 $this->dieRecoverableError( 'windows-nonascii-filename', 'filename' ); 00425 break; 00426 00427 // Unrecoverable errors 00428 case UploadBase::EMPTY_FILE: 00429 $this->dieUsage( 'The file you submitted was empty', 'empty-file' ); 00430 break; 00431 case UploadBase::FILE_TOO_LARGE: 00432 $this->dieUsage( 'The file you submitted was too large', 'file-too-large' ); 00433 break; 00434 00435 case UploadBase::FILETYPE_BADTYPE: 00436 $extradata = array( 00437 'filetype' => $verification['finalExt'], 00438 'allowed' => $wgFileExtensions 00439 ); 00440 $this->getResult()->setIndexedTagName( $extradata['allowed'], 'ext' ); 00441 00442 $msg = "Filetype not permitted: "; 00443 if ( isset( $verification['blacklistedExt'] ) ) { 00444 $msg .= join( ', ', $verification['blacklistedExt'] ); 00445 $extradata['blacklisted'] = array_values( $verification['blacklistedExt'] ); 00446 $this->getResult()->setIndexedTagName( $extradata['blacklisted'], 'ext' ); 00447 } else { 00448 $msg .= $verification['finalExt']; 00449 } 00450 $this->dieUsage( $msg, 'filetype-banned', 0, $extradata ); 00451 break; 00452 case UploadBase::VERIFICATION_ERROR: 00453 $this->getResult()->setIndexedTagName( $verification['details'], 'detail' ); 00454 $this->dieUsage( 'This file did not pass file verification', 'verification-error', 00455 0, array( 'details' => $verification['details'] ) ); 00456 break; 00457 case UploadBase::HOOK_ABORTED: 00458 $this->dieUsage( "The modification you tried to make was aborted by an extension hook", 00459 'hookaborted', 0, array( 'error' => $verification['error'] ) ); 00460 break; 00461 default: 00462 $this->dieUsage( 'An unknown error occurred', 'unknown-error', 00463 0, array( 'code' => $verification['status'] ) ); 00464 break; 00465 } 00466 } 00467 00468 00476 protected function getApiWarnings() { 00477 $warnings = $this->mUpload->checkWarnings(); 00478 00479 return $this->transformWarnings( $warnings ); 00480 } 00481 00482 protected function transformWarnings( $warnings ) { 00483 if ( $warnings ) { 00484 // Add indices 00485 $result = $this->getResult(); 00486 $result->setIndexedTagName( $warnings, 'warning' ); 00487 00488 if ( isset( $warnings['duplicate'] ) ) { 00489 $dupes = array(); 00490 foreach ( $warnings['duplicate'] as $dupe ) { 00491 $dupes[] = $dupe->getName(); 00492 } 00493 $result->setIndexedTagName( $dupes, 'duplicate' ); 00494 $warnings['duplicate'] = $dupes; 00495 } 00496 00497 if ( isset( $warnings['exists'] ) ) { 00498 $warning = $warnings['exists']; 00499 unset( $warnings['exists'] ); 00500 $warnings[$warning['warning']] = $warning['file']->getName(); 00501 } 00502 } 00503 return $warnings; 00504 } 00505 00506 00514 protected function performUpload( $warnings ) { 00515 // Use comment as initial page text by default 00516 if ( is_null( $this->mParams['text'] ) ) { 00517 $this->mParams['text'] = $this->mParams['comment']; 00518 } 00519 00520 $file = $this->mUpload->getLocalFile(); 00521 $watch = $this->getWatchlistValue( $this->mParams['watchlist'], $file->getTitle() ); 00522 00523 // Deprecated parameters 00524 if ( $this->mParams['watch'] ) { 00525 $watch = true; 00526 } 00527 00528 // No errors, no warnings: do the upload 00529 $status = $this->mUpload->performUpload( $this->mParams['comment'], 00530 $this->mParams['text'], $watch, $this->getUser() ); 00531 00532 if ( !$status->isGood() ) { 00533 $error = $status->getErrorsArray(); 00534 00535 if ( count( $error ) == 1 && $error[0][0] == 'async' ) { 00536 // The upload can not be performed right now, because the user 00537 // requested so 00538 return array( 00539 'result' => 'Queued', 00540 'statuskey' => $error[0][1], 00541 ); 00542 } else { 00543 $this->getResult()->setIndexedTagName( $error, 'error' ); 00544 00545 $this->dieUsage( 'An internal error occurred', 'internal-error', 0, $error ); 00546 } 00547 } 00548 00549 $file = $this->mUpload->getLocalFile(); 00550 00551 $result['result'] = 'Success'; 00552 $result['filename'] = $file->getName(); 00553 if ( $warnings && count( $warnings ) > 0 ) { 00554 $result['warnings'] = $warnings; 00555 } 00556 00557 return $result; 00558 } 00559 00563 protected function checkAsyncDownloadEnabled() { 00564 global $wgAllowAsyncCopyUploads; 00565 if ( !$wgAllowAsyncCopyUploads ) { 00566 $this->dieUsage( 'Asynchronous copy uploads disabled', 'asynccopyuploaddisabled'); 00567 } 00568 } 00569 00570 public function mustBePosted() { 00571 return true; 00572 } 00573 00574 public function isWriteMode() { 00575 return true; 00576 } 00577 00578 public function getAllowedParams() { 00579 $params = array( 00580 'filename' => array( 00581 ApiBase::PARAM_TYPE => 'string', 00582 ), 00583 'comment' => array( 00584 ApiBase::PARAM_DFLT => '' 00585 ), 00586 'text' => null, 00587 'token' => array( 00588 ApiBase::PARAM_TYPE => 'string', 00589 ApiBase::PARAM_REQUIRED => true 00590 ), 00591 'watch' => array( 00592 ApiBase::PARAM_DFLT => false, 00593 ApiBase::PARAM_DEPRECATED => true, 00594 ), 00595 'watchlist' => array( 00596 ApiBase::PARAM_DFLT => 'preferences', 00597 ApiBase::PARAM_TYPE => array( 00598 'watch', 00599 'preferences', 00600 'nochange' 00601 ), 00602 ), 00603 'ignorewarnings' => false, 00604 'file' => null, 00605 'url' => null, 00606 'filekey' => null, 00607 'sessionkey' => array( 00608 ApiBase::PARAM_DFLT => null, 00609 ApiBase::PARAM_DEPRECATED => true, 00610 ), 00611 'stash' => false, 00612 00613 'filesize' => null, 00614 'offset' => null, 00615 'chunk' => null, 00616 00617 'asyncdownload' => false, 00618 'leavemessage' => false, 00619 'statuskey' => null, 00620 ); 00621 00622 return $params; 00623 } 00624 00625 public function getParamDescription() { 00626 $params = array( 00627 'filename' => 'Target filename', 00628 'token' => 'Edit token. You can get one of these through prop=info', 00629 'comment' => 'Upload comment. Also used as the initial page text for new files if "text" is not specified', 00630 'text' => 'Initial page text for new files', 00631 'watch' => 'Watch the page', 00632 'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch', 00633 'ignorewarnings' => 'Ignore any warnings', 00634 'file' => 'File contents', 00635 'url' => 'URL to fetch the file from', 00636 'filekey' => 'Key that identifies a previous upload that was stashed temporarily.', 00637 'sessionkey' => 'Same as filekey, maintained for backward compatibility.', 00638 'stash' => 'If set, the server will not add the file to the repository and stash it temporarily.', 00639 00640 'chunk' => 'Chunk contents', 00641 'offset' => 'Offset of chunk in bytes', 00642 'filesize' => 'Filesize of entire upload', 00643 00644 'asyncdownload' => 'Make fetching a URL asynchronous', 00645 'leavemessage' => 'If asyncdownload is used, leave a message on the user talk page if finished', 00646 'statuskey' => 'Fetch the upload status for this file key', 00647 ); 00648 00649 return $params; 00650 00651 } 00652 00653 public function getResultProperties() { 00654 return array( 00655 '' => array( 00656 'result' => array( 00657 ApiBase::PROP_TYPE => array( 00658 'Success', 00659 'Warning', 00660 'Continue', 00661 'Queued' 00662 ), 00663 ), 00664 'filekey' => array( 00665 ApiBase::PROP_TYPE => 'string', 00666 ApiBase::PROP_NULLABLE => true 00667 ), 00668 'sessionkey' => array( 00669 ApiBase::PROP_TYPE => 'string', 00670 ApiBase::PROP_NULLABLE => true 00671 ), 00672 'offset' => array( 00673 ApiBase::PROP_TYPE => 'integer', 00674 ApiBase::PROP_NULLABLE => true 00675 ), 00676 'statuskey' => array( 00677 ApiBase::PROP_TYPE => 'string', 00678 ApiBase::PROP_NULLABLE => true 00679 ), 00680 'filename' => array( 00681 ApiBase::PROP_TYPE => 'string', 00682 ApiBase::PROP_NULLABLE => true 00683 ) 00684 ) 00685 ); 00686 } 00687 00688 public function getDescription() { 00689 return array( 00690 'Upload a file, or get the status of pending uploads. Several methods are available:', 00691 ' * Upload file contents directly, using the "file" parameter', 00692 ' * Have the MediaWiki server fetch a file from a URL, using the "url" parameter', 00693 ' * Complete an earlier upload that failed due to warnings, using the "filekey" parameter', 00694 'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when', 00695 'sending the "file". Also you must get and send an edit token before doing any upload stuff' 00696 ); 00697 } 00698 00699 public function getPossibleErrors() { 00700 return array_merge( parent::getPossibleErrors(), 00701 $this->getRequireOnlyOneParameterErrorMessages( array( 'filekey', 'file', 'url', 'statuskey' ) ), 00702 array( 00703 array( 'uploaddisabled' ), 00704 array( 'invalid-file-key' ), 00705 array( 'uploaddisabled' ), 00706 array( 'mustbeloggedin', 'upload' ), 00707 array( 'badaccess-groups' ), 00708 array( 'code' => 'fetchfileerror', 'info' => '' ), 00709 array( 'code' => 'nomodule', 'info' => 'No upload module set' ), 00710 array( 'code' => 'empty-file', 'info' => 'The file you submitted was empty' ), 00711 array( 'code' => 'filetype-missing', 'info' => 'The file is missing an extension' ), 00712 array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ), 00713 array( 'code' => 'overwrite', 'info' => 'Overwriting an existing file is not allowed' ), 00714 array( 'code' => 'stashfailed', 'info' => 'Stashing temporary file failed' ), 00715 array( 'code' => 'internal-error', 'info' => 'An internal error occurred' ), 00716 array( 'code' => 'asynccopyuploaddisabled', 'info' => 'Asynchronous copy uploads disabled' ), 00717 array( 'fileexists-forbidden' ), 00718 array( 'fileexists-shared-forbidden' ), 00719 ) 00720 ); 00721 } 00722 00723 public function needsToken() { 00724 return true; 00725 } 00726 00727 public function getTokenSalt() { 00728 return ''; 00729 } 00730 00731 public function getExamples() { 00732 return array( 00733 'api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png' 00734 => 'Upload from a URL', 00735 'api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1' 00736 => 'Complete an upload that failed due to warnings', 00737 ); 00738 } 00739 00740 public function getHelpUrls() { 00741 return 'https://www.mediawiki.org/wiki/API:Upload'; 00742 } 00743 00744 public function getVersion() { 00745 return __CLASS__ . ': $Id$'; 00746 } 00747 }