Commit graph

56 commits

Author SHA1 Message Date
Mark A. Hershberger
234f54a88e * Set $titleObj to null by default on getWatchlistValue since it often isn't needed & check that it is set when it is needed. (follow up r64197).
* Refactoring ApiUpload & UploadBase to make it easier to extend & read.
* Use a class constant for the upload session key instead of a hard-coded-across-several-files value.
* Add UploadBase::appendToUploadFile() method to enable protocols that do incremental upload.
2010-03-30 19:10:10 +00:00
Sam Reed
789cc18185 Followup r64197
Return null in getWatchlistValue if no change

Fixup unneccessary watch/unwatch calls

Remove useless unwatch from ApiUpload
2010-03-28 15:08:45 +00:00
Sam Reed
480257da0d Minor followup to r64197
Allow unwatch via ApiUpload, UploadBase doesn't allow/cater for unwatching, so use the $wgUser object to do it, rather than possibly causing a breaking change in UploadBase
2010-03-25 22:31:41 +00:00
Sam Reed
88df448d36 Fix bug 22944 in a much better fashion (using watchlist parameter)
Deprecate old watch/unwatch parameters

Move generic watchlist stuff to ApiBase/getWatchlistValue (maybe needs renaming better?)

Tweak some braces in ApiEditPage
2010-03-25 22:15:08 +00:00
Sam Reed
a0999b5835 Revert my api changes to pre r64815 2010-03-25 22:12:28 +00:00
Sam Reed
a2c56fb129 Add array( 'show' ), to getPossibleErrors 2010-03-25 21:19:49 +00:00
Sam Reed
f757b2bc7e Watch/unwatch to ApiUpload
Prevent mutually exclusive values
2010-03-25 21:17:51 +00:00
Bryan Tong Minh
30a062321a Remove internalhttpsession from ApiUpload; remnant from reverted feature. 2010-03-12 19:20:01 +00:00
Bryan Tong Minh
dd349d7b3a Merge r63621 and r63636 from REL1_16:
* Rollback chunked uploading support for 1.16
* 	Pass $sessionKey as parameter to UploadFromStash::initialize.
2010-03-12 18:26:12 +00:00
Jack Phoenix
7ced9bc569 API: fix copyright symbol, coding style cleanup, more braces 2010-02-26 13:18:56 +00:00
Mark A. Hershberger
c871b75a3e follow up r62231, r61779, r62175
* Fix up messages
* For new FileRepo::append(), use flags to determine whether to delete or not
* Add more error checking for appending
* Fix a couple of places in Revision.php and LogPage.php where DB errors were produced when comment was null
* Remove bogus checking for !$comment, etc on the DONE phase of chunked uploading
* Don't pretend to return a value when raising an exception
* Add more tests for chunked uploads
* Verify that Status::getErrorsArray() (at least where it is used in ApiUpload::execute()) returns an array that we can pass to dieUsageMessage()
* Ensure that checkWarnings(), etc work only on the complete file
2010-02-22 02:15:30 +00:00
Sam Reed
878c7da630 Followup to r62557 as per Roans comment 2010-02-16 21:59:16 +00:00
Sam Reed
0e8b0b41ac Refactor requiresToken to getTokenSalt - Returns salt if exists, null if no salt, else false if no token required
Move sessionfailure (token validation checking) up a couple of levels

Part of bug 21991

Followup to r62482 and r62504
2010-02-15 23:53:43 +00:00
Mark A. Hershberger
293641976a follow-up r62498 — use the new functionality of requireOnlyOneParameter of allowing “false” defaults 2010-02-15 17:50:35 +00:00
Sam Reed
80f9448690 Start of "Bug 21991 - Move common query parameter (uc, rc) validation, token requiringness/checking to ApiBase/Similar"
Move token requringness check to the ApiMain

Adding an exception if we're using "gettoken" (block/unblock)

Remove array( 'missingparam', 'token' ), from the getPossibleErrors of modules that set requireToken method to true
2010-02-14 22:20:27 +00:00
Sam Reed
40dd0530f9 Stylize API files 2010-02-13 01:41:37 +00:00
Sam Reed
d299fc6a55 Complete dieUsage errors in 7 more Api files 2010-02-13 01:21:52 +00:00
Sam Reed
d2d950d256 Start of blanket coverage of dieUsageMsg in getPossibleErrors
Only basic ones done.

Couple of other modules done manually
2010-02-13 00:09:05 +00:00
Mark A. Hershberger
57c2247c81 Final(?) changes to enable chunked uploading. 2010-02-12 06:28:03 +00:00
Sam Reed
8238e6657b Remove old/deprecated $this->getMain()->isWriteMode(); from ApiUpload 2010-02-11 22:25:31 +00:00
Mark A. Hershberger
fd27d340b5 Make sure Firefogg gets the json it needs. 2010-02-11 06:14:15 +00:00
Mark A. Hershberger
c0cd377c0f follow-up r61355
Actually test UploadChunks code against Firefogg.  Uploads work, but
feedback on the Firefogg side seems not too.  Also, Firefogg makes a
complete upload, but then attempts more uploads.
2010-02-11 05:35:21 +00:00
Mark A. Hershberger
c74fe71cd8 * new FauxResponse class to help with unit testing
* Add append() method to FileRepo classes to enable chunked uploading
* Change chunksessionkey to chunksession
* Remove echo json stuff
* Fix a multitude of bugs in my own code
* still to test: mwEmbed use of chunked upload
2010-02-10 10:36:11 +00:00
Mark A. Hershberger
15fec3ab7f * Fix up ApiTest a bit, cookie handling works
* Start upload chunks testing
* found some problems with messages
2010-02-09 08:37:38 +00:00
Mark A. Hershberger
5b5d7ef6f7 follow up r61355, initial, incomplete dealing with TimStarlings CR 2010-02-01 07:05:23 +00:00
Sam Reed
47c24175d3 Add/remove whitelines to increase readability in API code files 2010-01-23 22:26:40 +00:00
Roan Kattouw
7be0ea84e0 Fix indentation in r61407. PLEASE don't use spaces for indentation, always use tabs. 2010-01-23 15:09:16 +00:00
Mark A. Hershberger
eecb86354a follow up r61355 2010-01-23 05:20:31 +00:00
Mark A. Hershberger
c5d228be4c UploadChunks added from js2 branch. Refactored. Still needs to be
tested w/o the UI first.
2010-01-22 04:37:23 +00:00
Aryeh Gregor
3758769f0d stylize.php on API code
"I wouldn't object to stylizing the API code to bring it in line with
the rest of MW on principle, but I'm not gonna bother myself." --Roan
<http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60657#c5108>

If you're seeing this commit in blames, tell your blame tool to ignore
whitespace, e.g., git blame -w or svn blame -x -w.
2010-01-11 15:55:52 +00:00
Roan Kattouw
455bb78b12 API: Minor cleanup for r59258, general whitespace cleanup 2009-12-02 12:28:27 +00:00
Tim Starling
7688101426 Removed JS2 work (has been moved to the js2-work branch). Has been lightly tested, should mostly work. Some of the more complicated associated changes are listed below.
* Reverted HttpFunctions.php to r45549 and renamed wgSyncHTTPTimeout back to wgHTTPTimeout
* Edited out the asynchronous features from UploadFromUrl. Made fetchFile() use the curlCopy() function from new-upload r47811 instead of Http::doDownload(). Wrote my own URL validity check to avoid having to use either of the two buggy precedents.
* Removed UploadFromChunk
* Removed chunk upload and background status from ApiUpload.php
* Reverted r54669, use of addScriptClass()
* Left getHeadScripts() in its current location (OutputPage) instead of moving it back to SkinTemplate, just added wikibits.js to it to replace the removed addCoreScripts2Top()
2009-11-26 12:00:36 +00:00
Sam Reed
9546d0bffc Apply patch from bug 21589 API: Separate summary and initial page text for uploads 2009-11-22 15:14:19 +00:00
Tim Starling
251c21e84b Rework of libAddMedia. The changes are entirely untested and there may be bugs, but at least the code is nicer to look at now. This commit message is probably incomplete.
In libAddMedia:
* Made many style changes, renamed many variables.
* Wrote a doc comment for most functions
* Renamed messages: 
   * fogg-check_for_fogg -> fogg-check_for_firefogg
   * fogg-for_improved_uplods -> fogg-for_improved_uploads
   * fogg-use_latest_fox -> fogg-use_latest_firefox
   * mwe-upload-stats-fileprogres -> mwe-upload-stats-fileprogress

* Renamed functions:
   * doRemapFormToApi -> remapFormToApi
   * doUploadSwitch -> doUpload
   * proccessIframeResult -> processIframeResult
   * getEditForm -> getForm
   * dispProgressOverlay -> displayProgressOverlay
   * cancel_button -> getCancelButton
   * cancel_action -> onCancel
   * doControlHTML -> createControls
   * getTargetHtml -> getControlHtml
   * doControlBindings -> bindControls
   * getOSlink -> getFirefoggInstallUrl
   * doPreviewControl -> createPreviewControls
   * doRenderPreview -> renderPreview
   * selectFogg -> selectSourceFile
   * selectFoggActions -> updateSourceFileUI
   * saveLocalFogg -> doLocalEncodeAndSave
   * doChunkWithFormData -> doChunkUploadWithFormData
   * proccessPresetControl -> getPresetControlHtml
   * proccessCkControlHTML -> getConfigControlHtml
   * selectByUrl -> selectSourceUrl

* Promoted anonymous functions to methods:
   * onSubmit
   * onAjaxUploadStatusTimer
   * onAjaxUploadStatusResponse
   * onPreviewClick

In mvBaseUploadInterface:
* Made http_copy_upload lazy-initialised
* Made detectUploadMode() do only what it says, moved the actual upload stage to a callback.
* Refactored doUpload(), splitting out doApiCopyUpload() and doPostUpload()
* Refactored apiUpdateErrorCheck() into isApiSuccess() and showApiError()

In mvFirefogg:
* Made have_firefogg, sourceFileInfo lazy initialised
* Rearranged autoEncoderSettings() to make it the accessor getEncoderSettings()
* Rearranged firefoggCheck() to make it the accessor getFirefogg()
* Split encodeDone into the anonymous doEncode() done callbacks, and also the new function onLocalEncodeDone()

In mvAdvFirefogg:
* Refactored autoEncoderSettings() into getEncoderSetings() and updateSourceFileUI()

Elsewhere:
* Fixed spelling error UploadBase::MIN_LENGHT_PARTNAME
2009-11-20 07:23:08 +00:00
Raimond Spekking
534bce0273 Follow-up r55613: Fix typo. I guess that 'baddaccess-groups' was a typo because such a message does not exists.
But 'badaccess-groups' has two parameters: $1 a list of groups and $2 the count of them. These parameters are missing.
2009-11-04 16:07:42 +00:00
Bryan Tong Minh
3d6ca209f3 * Validate sessionkey for stashed uploads
* (bug 21235) Switch around fetchfileerror to the proper order
2009-10-28 22:23:00 +00:00
Michael Dale
7e0fcad32b ( bug 21320 ) adds early checks for wgAllowCopyUpload and 'upload_by_url' permission so that web server does not make extra requests. 2009-10-28 03:38:23 +00:00
Bryan Tong Minh
91e4d80448 Rewrote Special:Upload to allow easier extension. Mostly backwards compatible towards the end user: tested with Commons' upload scripts.
* Special:Upload now uses HTMLForm for form generation
* Upload errors that can be solved by changing the filename now do not require reuploading.
2009-10-18 19:41:01 +00:00
Michael Dale
ab2745e92b * ( bug 21089 ) fixes js2 upload stash support.
* Tested with chunk firefogg uploads, normal js2 uploads and http copy by url uploads
2009-10-15 00:14:05 +00:00
Bryan Tong Minh
bc20609885 Follow up to r56639: Remove some existence check duplication and fix ApiUpload for changed return format of getExistsWarning. 2009-09-19 15:49:54 +00:00
Alex Z
406b6916c7 Actually use the filename supplied by the user. 2009-09-17 01:03:52 +00:00
Bryan Tong Minh
efd86ed3aa * Add buffering to ApiFormatBase, which allows buffering the result without needing ob_* functions. This is for async downloads, but I couldn't get it to work yet so this commit does not contain the files that actually use the buffering.
* Hide internalhttpsession parameter from web requests
2009-08-28 21:18:39 +00:00
Michael Dale
8fbc2feb5a enabled async downloaded via configuration var: wgEnableAsyncDownload (pending windows fix) 2009-08-27 14:46:54 +00:00
Bryan Tong Minh
fdc9df9629 * Output warnings as filenames rather than an array representation of a File object.
* Renamed variable in UploadBase::checkWarnings to better indicate its meaning
2009-08-27 14:21:53 +00:00
Bryan Tong Minh
05a916153f * Cleanup ApiUpload
* UploadBase::verifyUpload now always returns a status array
* Disabled async upload by url because wfShellBackgroundExec is broken
2009-08-26 19:38:38 +00:00
Bryan Tong Minh
05336e91ad Unify properties in ApiQueryAllimages, ApiQueryImageinfo and ApiUpload. 2009-08-26 17:30:36 +00:00
Michael Dale
cf7448516a hard coded requested imageinfo prop in api upload result (to avoid static call to non-static: ApiQueryImageInfo::getAllowedParams(); 2009-08-22 06:36:19 +00:00
Michael Dale
305179ffa3 * added missing setIndexedTagName for some upload api array results
* switched apiFormatJson output from 'application/json' to 'text/javascript'
2009-08-15 10:22:20 +00:00
Michael Dale
9bdeb8a885 improved upload api documentation 2009-07-28 17:52:09 +00:00
Michael Dale
996d17d401 * ignorewarnings fixes
* removed extra debug statement 
* supports do_close_session_update for php based requests
2009-07-27 21:32:25 +00:00