Commit graph

103 commits

Author SHA1 Message Date
Sam Reed
2b676156ba And even more documentation 2011-05-28 18:58:51 +00:00
Antoine Musso
6a8e32e986 Single messages can be passed as strings to Api::dieUsageMsg()
Since r88045
2011-05-19 17:51:16 +00:00
Bryan Tong Minh
ef3d06a44c Per CR r75906, reintroduce ApiUpload::transformWarnings() 2011-05-15 14:46:13 +00:00
Bryan Tong Minh
b21d160c83 (bug 1780) Uploading files with non-ascii characters are now forbidden on Windows. PHP on Windows does not reliably support non-ascii characters to forbid them all. Theoretically we could detect the filesystem locale and iconv the filename, but that is just too much hassle. Added message 'windows-nonascii-filename'. 2011-05-15 12:35:50 +00:00
Bryan Tong Minh
8bd336981c API upload errors may now return the parameter that needs to be changed and a sessionkey to fix the error. This is for now only done for uploads that can be fixed by changing the filename, but may be extended later to comment and pagetext. 2011-03-25 21:22:02 +00:00
Neil Kandalgaonkar
331406bf46 don't check title permissions if upload is destined for stash anyway 2011-03-25 20:42:05 +00:00
Neil Kandalgaonkar
43cf8e6d6e change the name of UploadBase::verifyPermissions() to verifyTitlePermissions() for clarity. A wrapper function is left for extensions that rely on the old method 2011-03-25 20:37:26 +00:00
Sam Reed
41e7860130 Implement getRequireOnlyOneParameterErrorMessages, to make the error messages requireOnlyOneParameter can throw.
Use in 4 modules for more dynamicness
2011-02-25 19:09:39 +00:00
Sam Reed
fa64025161 More parameter documentation 2011-02-19 00:30:18 +00:00
Bryan Tong Minh
db7a518a4f Follow-up r70137: Unconditionalize the asyncdownload params and throw asynccopyuploadsdisabled if async is requested without $wgAllowAsyncCopyUploads. 2011-02-10 18:24:19 +00:00
Sam Reed
d251f3ddd2 Normalise casing of svn:keywords Id
Add missing Id to ApiFormatDump and ApiUpload
2011-01-10 22:36:26 +00:00
Sam Reed
bfd67cf818 Remove some blank lines
Spaces to tabs in ApiBase
2011-01-07 02:53:00 +00:00
Sam Reed
8381c3338b Add some more requireOnlyOneParameter related errors
Remove some duplicated errors
2011-01-07 02:42:16 +00:00
Sam Reed
1f05665cf3 Styleli[zs]e the API up to date (Been a while since) 2010-12-30 17:06:09 +00:00
Sam Reed
6309c920dd Delete all the "API for MediaWiki 1.8+" comments
Add since to ApiQueryQueryPage
2010-12-22 20:52:06 +00:00
Neil Kandalgaonkar
902995cb1d core changes for UploadWizard (merged from r73549 to HEAD in branches/uploadwizard/phase3) 2010-11-03 04:32:41 +00:00
Derk-Jan Hartman
dcd547218f Use isset to protect against Undefined index PHP notice. 2010-10-31 22:10:44 +00:00
Sam Reed
42b5c265c0 * (bug 25248) API: paraminfo errors with certain modules
Added a needsToken() function, rather than calling getTokenSalt, which can throw silly errors due to dependencies on parameters
2010-10-01 20:12:50 +00:00
Sam Reed
ee40f73227 Remove some unused keys from foreach
Documentation tweaks
2010-09-25 16:56:03 +00:00
Sam Reed
6c1273bc7d Fill in missing params from a dieUsage
Braces

Fixup parameter documentation
2010-09-25 16:45:41 +00:00
Bryan Tong Minh
3e1eff2a01 Follow-up r70137: Made asynchronous upload working a bit more. It now fully works from the API; works still needs to be done for the normal UI. PHPUnit tests are updated and should cover most code paths that can be called from the API.
ApiUpload:
* Added "statuskey" parameter; this is the key that is returned by an async upload
* Refactored warnings transformation into its own function
* filename is no longer required on all uploads

UploadFromUrlJob:
* Moved upload results to its own entry in $_SESSION, instead of using the one from upload
* Fix storing in session by calling wfSetupSession and session_write_close where needed

Tests:
* Set $wgUser in ApiSetup, so that individual tests don't have to do this for themselves
* Added tests to cover most code paths from the API
* Fixed UploadFromUrlTestSuite so that its tests are included in a regular phpunit invocation (something strange with the AutoLoader; not sure what)

Other files:
* Allow passing session id to wfSetupSession
* Explicitly close the session before doing jobs, so that jobs can't manipulate the current session
2010-09-06 10:18:53 +00:00
Platonides
50e2405a03 Refactor to avoid defining globals inside switches. 2010-08-12 14:25:07 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Sam Reed
ddc7efbedf stylize api up to date 2010-08-05 07:02:09 +00:00
Sam Reed
f77fff0ffb Followup r70461 if PARAM_REQUIRED is set, use for missing param in getPossibleErrors in ApiBase
All but ApiQueryBacklinks
2010-08-04 19:20:15 +00:00
X!
1afd723c5b Followup to r70460 and r70461: Use true instead of 1 2010-08-04 14:29:39 +00:00
X!
8b466d3d0d Followup to r70460: Committed wrong version of ApiBase.php, convert all core API modules to PARAM_REQUIRED syntax 2010-08-04 14:15:33 +00:00
Platonides
e333031c75 Follow up r70095. Remove the now unused $wgAllowCopyUploads global. 2010-07-31 23:26:16 +00:00
Bryan Tong Minh
d7e6870b8f Made asynchronous upload by URL working, partly. Hid it behind $wgAllowAsyncCopyUploads. If there are no errors then everything works expected; the same if there are unrecoverable errors. User intervention to solve warnings is not yet possible, because $_SESSION is not available in runJobs. This also means that async with leavemessage = false is broken.
Other changes:
* Moved verifyPermissions check in ApiUpload down pending r70135 implementation in the API.
* In User::leaveMessage: append message to end of talk page; add a newline before the heading
2010-07-29 13:53:51 +00:00
Bryan Tong Minh
1cae743ecb Refactor some code out of execute into selectUploadModule. Fixed an undefined variable. 2010-07-28 17:31:32 +00:00
Bryan Tong Minh
796933d11f Restructured upload-by-url:
* In ApiUpload: moved stuff that is checking instead of actual uploading out of performUpload method
* Made UploadFromUrl conform to standards: 
** In initialize* do only initialization, no actual work
** Moved file fetching to fetchFile
** Consistent use of tempnam()
** Perform the uploading in performUpload, don't define our own doUpload method
* Moved almost all job magic to the UploadFromUrlJob class. This way the job is almost a regular client, and we don't need many special cases to deal with async uploading. 
* Made leaving a message optional; results will be stored in the session otherwise

I did not actually test the async uploading, because I first wanted to commit a properly working synchronous upload-by-url system.
2010-07-28 17:14:51 +00:00
Bryan Tong Minh
b4310925ba Follow-up r70037: Fix ApiUpload by passing a WebRequestUpload to the the initializer
Follow-up r64403 and r69911: Fix broken upload from stash in Api. 

Please tests your commits, even if the change seems totally harmless. You can use <http://mwclient.svn.sourceforge.net/viewvc/mwclient/tests/upload_api_test.py?revision=HEAD&view=markup> to automatically test uploading via the Api.
2010-07-27 21:53:52 +00:00
Sam Reed
8ce3c5cf23 Fixup some more wrong static usages 2010-07-25 21:08:34 +00:00
Sam Reed
5387b8a806 Stylize API up to date
Fix spaces from r69755

Minor update to RELEASE-NOTES per r69753
2010-07-23 07:33:40 +00:00
Mark A. Hershberger
b874469e86 re r64403 - remove never-actually-used $flag parameter from verifyUpload() 2010-07-23 00:07:35 +00:00
Sam Reed
cb83bfa579 LIMIT_SML2, LIMIT_BIG2 are in ApiBase, not ApiMain 2010-07-22 21:52:06 +00:00
Sam Reed
f5c639fd10 Stylize API
Add a few braces
2010-07-06 13:15:59 +00:00
Derk-Jan Hartman
921619b119 Correct the address of the FSF in some of the GPL headers
59 Temple Place -> 51 Franklin Street
2010-06-21 13:13:32 +00:00
Mark A. Hershberger
e519859e49 * re r65152 add back async option for uploadByURL API call
* Remove vestigal commented-out code and make sure permission checking works
2010-06-12 03:58:31 +00:00
Sam Reed
e55ed729c4 Mixture of things.
Couple of class comments

Normalisation of "." usage at end of lines (removed)

Normalisation of {prefix}parameter as per bug 23461
2010-05-11 22:30:18 +00:00
Sam Reed
0769301e87 Stylize Api upto date 2010-04-17 20:58:04 +00:00
Mark A. Hershberger
ea37b415e2 re: r65152
* Make Job::insert() return true on success
* Change from Status object to array for API result on URL upload.
2010-04-17 16:49:20 +00:00
Mark A. Hershberger
9c7a7e57f0 * New UploadFromUrlJob class to handle Upload-by-Copy
* Define variable for ApiUserrights.php that wasn't defined before.
* Add convertVerifyErrorToStatus and getVerificationErrorCode to
  UploadBase to translate error consts since UploadFromUrl will
  need a message to display to end-users.
* refactor mime-checking out of UploadBase::verifyFile into
  UploadBase::verifyMimeType
* Make UploadBase::verifyFile always return arrays for errors
* Use HttpFunctions instead of custom curl handler for async downloading
* TODO: Need a way to feed errors back to the requestor
* TODO: Need to add watchlist param handling and warnings checks.
2010-04-17 02:43:13 +00:00
Bryan Tong Minh
7a92e75a9f (bug 17941) $wgMaxUploadSize is now honored by all upload sources 2010-04-15 09:28:33 +00:00
Mark A. Hershberger
e90d1ecd97 * EOL ws clean on ApiBase.php
* Use an actual value for ApiUpload.php
* Commit some code I must've missed for r64852
2010-04-14 04:57:27 +00:00
Sam Reed
d840fbbc95 Revert r64955
Again partial fix to bug 23167

Bugfix watch on creation (edit and upload), in current form, setting unwatch, or nochange would follow watchcreation, which wasn't requested
2010-04-12 10:44:45 +00:00
Sam Reed
7e7178e341 Partial fix to bug 23167
Api doesn't watch new file on upload (and didn't previously). Now watches on creation
2010-04-12 10:23:09 +00:00
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