Commit graph

138 commits

Author SHA1 Message Date
Brion VIBBER
bca71b173e Revert "(bug 30625) Add, to every API upload response, the warnings raised."
Inconsistent formatting (returns an empty array vs a full object, breaks UploadWizard)

This reverts commit e2b3d53db5
2012-05-23 19:27:48 +00:00
Mark Holmquist
e2b3d53db5 (bug 30625) Add, to every API upload response, the warnings raised.
The current API implementation has a parameter for uploads that is
called "ignorewarnings". Currently, it will not only suppress any
warnings from stopping the upload, it will also lose any data from
those warnings.

This patch is sort of on the way to solving Bug 30625, which is in
the UploadWizard extension. That extension needs to know when a file
upload *will* fail, barring a change in some data, in order to make
it easier for a user to fix the foreseeable problems. The solution is
either to fix it this way, or to somehow spoof a file upload, and see
if it succeeds. In the hopes that other extensions will also find
this useful, I opted for the former.

Change-Id: I08b4e29e89ade6cf391ae044fceb788aaba3f5b4
2012-05-22 14:23:23 -07:00
Reedy
2edbe14e39 Normalising return statements
Add/improve parameter documentation

Change-Id: I4c7fa319be60a47b7fcd81131458577bccb009fb
2012-04-27 16:40:14 +01:00
Erik Moeller
631519fde7 Fix for chunked uploading support in API.
Chunked uploading is currently only implemented by Upload Wizard,
but is supported in MediaWiki core. It's enabled in Upload Wizard
by setting $wgUploadWizardConfig['enableChunked'] to true.

When enabled, large files will be split into smaller chunks, by
default of 1 MB. This is done through a series of API POST
requests. The file is identified by means of a 'filekey' to
allow for continuation of uploads from previous offsets.

Previously broken behavior: Files were concatenated correctly,
but instead of the whole file, one of the chunks was uploaded
to the wiki. This was due to the API using the filekey of the
chunk, as opposed to the filekey of the whole file.

In addition, this change also cleans out the stash information
for both filekeys after the upload is complete.

[Patch set 2: Whitespace fix]
[Patch set 3: Move filekey result past status check]

Change-Id: Idac94e953676787f9516051e47c006525f198fd4
2012-04-08 20:27:02 -07:00
Sam Reed
b834075972 * (bug 32341) Add upload by URL domain limitation.
Essentially reverts r109741  live again

Which was r109562, r109564, r109570
2012-02-09 23:22:38 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Sam Reed
af198296ef Revert feature out of r109562, r109564, r109570
Leaving typo/brace fixes and other minor code improvements
2012-01-22 17:33:44 +00:00
Sam Reed
f619564720 * (bug 32341) Add upload by URL domain limitation. 2012-01-19 19:16:06 +00:00
Sam Reed
6115b93df8 Re-instate most of the revisions for bug 33147 "API examples should explain what they do"
Using this to sync up my working copies

Should have the little niggles tidied up though
2011-12-27 16:22:35 +00:00
Brion Vibber
02bb594ac7 Revert r106521: creates lots of long, unwrappable lines in help output 2011-12-20 21:26:57 +00:00
Sam Reed
b0818acd86 More example conversions/additions
Ping r106439
2011-12-17 19:10:33 +00:00
Max Semenik
da663eaf97 Caps fix in API parameter description 2011-12-12 17:22:20 +00:00
Jan Gerber
0095c08ed2 Use database to track uploaded chunks and concatenate at the end.
with i18n documentation dont break phpunit

follow up r93720
2011-11-30 14:56:40 +00:00
Roan Kattouw
e83bb90997 Revert r104659 and its followup r104665: break the unit tests with a fatal error. This cripples our CI system, we can't detect new failures this way. 2011-11-30 13:54:35 +00:00
Jan Gerber
d70c169b90 Use database to track uploaded chunks and concatenate at the end.
follow up r93720
2011-11-30 08:55:16 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
John Du Hart
2e7d867478 Removed the 'eclipse helper' bit on top of every API module
It's a parctice that dates back to 2006 when the API was first written, and frankly isn't covered by the coding conventions. Same thing with the docblocks, they're all copypasted with some bits changed and don't even make sense if you look at them in the genereated code docs.
I don't feel that any of us depend on this anymore (get a better IDE), so in the inerest of consistancy it's time we said goodbye to it.
2011-11-16 00:17:26 +00:00
Sam Reed
87446c808a Documentation 2011-11-10 20:50:21 +00:00
John Du Hart
40f19e6def Adding context to the API
This will probably break something somewhere so when it does please yell at me on IRC and I'll fix it.
2011-10-26 23:27:01 +00:00
Bryan Tong Minh
f3fc3c7f43 Follow-up r98430, use dedicated error message for filename too long error. Adds 'filename-toolong' message. 2011-10-07 18:20:55 +00:00
Sam Reed
0ca8ed8792 3 PHP Fatal error: Call to undefined method LocalFile::getFileKey() in /usr/local/apache/common-local/php-1.18/includes/api/ApiUpload.php on line 150
Tag: REL1_18, 1.18wmf1
2011-10-05 13:47:02 +00:00
Sam Reed
469cc76775 Return documentation 2011-09-21 16:36:43 +00:00
Sam Reed
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Sam Reed
8dc7b8889f Whitespace
Documentation
2011-08-11 23:58:29 +00:00
Jan Gerber
bdb437b164 dont use deprecated function WebRequest::getFileSize 2011-08-05 08:49:43 +00:00
Jan Gerber
87dc065d41 result of finished Chunk Upload has to be Success 2011-08-02 12:44:26 +00:00
Jan Gerber
5acb37d00e use tabs. for consistant whitespaces 2011-08-02 11:01:01 +00:00
Jan Gerber
65c85b5072 Extend upload api adding an option to upload files in chunks,
using UploadStash to track the unfinished upload.
2011-08-02 10:13:56 +00:00
Ian Baker
aa5d7bbcea Added a workaround for the lack of RequestContext in 1.17, so this code can be rolled into production.
This code can be removed in 1.18+, but it'll work either way.
2011-07-25 22:39:52 +00:00
Neil Kandalgaonkar
3241602f14 removing xdebug call 2011-07-18 18:59:56 +00:00
Sam Reed
6e84e9ccd9 Followup r92396, add help urls for most of the core (non query) modules 2011-07-17 16:38:24 +00:00
Ian Baker
9b50e7ade7 properly handle the case where a file disappears during the uploadwizard process
remove database records for files that move out of the stash
2011-07-14 23:01:00 +00:00
Ian Baker
c2e2c8270e Added us_status column for future expansion re Bryan's suggestion
Implemented changes suggested in code review on r92009:
 constructor bug handling passed repo/stash
 up-to-date timestamp generation
 fetching db handle from repo
 iterating over select results according to convention
 changed uploadstash.us_media_type to enum to mirror image.img_media_type
 removed (most) new references to $wgUser, instead using ApiBase::createContext to find the user
2011-07-13 19:08:51 +00:00
Ian Baker
9d4fd0c567 Refactored UploadStash and related classes to use the database for file metadata storage instead of the session, see bug 26179
Tweaked the UploadWizard to work properly with the new backend code, updated tests
2011-07-12 21:11:43 +00:00
Sam Reed
8edf4a2d92 Fix trailing whitespace
Swap methods that call $this->getResult() to use temporary variable
2011-06-29 23:46:39 +00:00
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