Commit graph

55 commits

Author SHA1 Message Date
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Alexandre Emsenhuber
58bb669812 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Ia1a7230adc92079b505362317d2e03b36130cc8b
2012-05-29 13:01:11 +02:00
Reedy
f8d2958da9 Can't return values from functions that don't return anything
Change-Id: If964ce2f39904f1e9e3101e7cafaa6a96d58adfc
2012-04-19 14:07:40 +01:00
Sam Reed
4ee96a4a4b Followup r11120, wfParseUrl() can return false, if it does, the host isn't going to be valid 2012-02-11 15:13:01 +00: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
09a78c1368 More return documentation 2012-02-09 21:36:14 +00:00
Antoine Musso
2bf8d0db90 Fix doc for includes/upload 2012-02-08 17:03:43 +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
9553784f82 Followup r109562
Don't use such a naieve host check
2012-01-19 20:26:10 +00:00
Sam Reed
f619564720 * (bug 32341) Add upload by URL domain limitation. 2012-01-19 19:16:06 +00:00
Sam Reed
68480e2ed3 Improve/add to documentation
Add braces

Explicitly define member variable
2011-12-24 23:11:25 +00:00
Brion Vibber
a16a028057 * (bug 29154) Allow upload-by-URL to follow HTTP redirects 2011-09-22 01:15:06 +00:00
Sam Reed
896f05efde Trim trailing whitespace
Add documentation

Remove unused variables

Remove an extract from ImageFunctionsTest
2011-07-24 21:36:04 +00:00
Brion Vibber
c07ed42491 * (bug 29174) Fix regression in upload-by-URL: files larger than PHP memory limit work again
r65152 switched upload-by-URL ($wgAllowCopyUploads) to use Http / MwHttpRequest class instead of CURL directly.
While this is mostly nice, it switched from saving large files directly to a temp file to buffering them in memory, causing large files to fail when they hit the PHP memory limit.

Fix uses MwHttpRequest's callback capability to override the read handler; now appending it to the temporary file as we go, and can confirm that largish files work again; was able to upload a 64mb .ogv that previously didn't work for me: http://prototype.wikimedia.org/tmh/images/b/b2/File-Arborophila_brunneopectus_pair_feeding_-_Kaeng_Krachan.ogv

Also expanded the documentation on MwHttpRequest::setCallback to clarify the function parameters and return value for the callback (which currently matches the low-level CURL handler's callback directly).
Note that the non-CURL implementation doesn't abort the read if the callback doesn't return the expected number of bytes, but this is an immediate fatal end of request on the Curl backend. May want further cleanup.
2011-05-27 22:31:48 +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
Brian Wolff
6f7958499a trim the upload_by_url field from upload form, since if you have an extra space at the beggining like I
did when copying and pasting a url, gives a really misleading error message.
2011-03-04 22:21:48 +00:00
Sam Reed
baf83f74b8 More explicit variable definitions, function documentation 2011-02-20 13:33:42 +00:00
Bryan Tong Minh
b20a0d3327 Follow-up r81612, disable $wgAllowAsyncCopyUploads 2011-02-06 22:53:07 +00:00
Sam Reed
bdb325cb4e Fixup some trailing newlines
Fixup indentation of a few methods

Add a couple of return type hints
2011-02-02 10:42:17 +00:00
Bryan Tong Minh
db544af120 $wgMaxUploadSize may now be set to an array to specify the upload size limit per upload type.
Backwards compatible, if not set to an array, applies to all uploads. If set to an array, per upload type maximums can be set, using the file and url keys. If the * key is set this value will be used as maximum for non-specified types.
2011-01-06 19:42:55 +00:00
Sam Reed
03e4248def Properly qualify usage of class constants 2010-12-22 00:25:16 +00:00
Mark A. Hershberger
d0b46f4bbe re r75906 — replace the removed getSessionKey() with stashSession() 2010-12-08 18:59:43 +00:00
Brian Wolff
8adc7befe5 (Bug 25872) Rename HttpRequest class to MWHttpRequest to avoid conflict with php extension.
This also keeps the old HttpRequest class name around, so it should not break backwards compatability.
2010-11-12 07:32:09 +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
Alexandre Emsenhuber
2d078552de * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-20 20:39:04 +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
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
b2c4d114e9 Style fixes on UploadFromUrl.php 2010-07-28 13:43:38 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +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
Mark A. Hershberger
ec31dd602e Start adding support for leaving user's messages. Begin using it in UploadFromUrl.php
In the end, we should probably use a template if its around and do something sane with the subject line if not.
2010-05-14 20:36:23 +00:00
Alexandre Emsenhuber
e1f61b0a78 Per siebrand: missing global declaration of $wgTmpDirectory 2010-04-18 09:53:46 +00:00
Mark A. Hershberger
f47ce6663c for r65152: fixed web ui for UploadFromUrl
* Add watchlist and ignorewarnings params for job — not used yet
* Add permissions check for isValidRequest
2010-04-17 21:44:51 +00:00
Sam Reed
375f069f0e Fix
<siebrand> PHP Warning:  Missing argument 4 for UploadFromUrl::initialize(), called in /www/w/includes/upload/UploadFromUrl.php on line 99 and defined in /www/w/includes/upload/UploadFromUrl.php on line 38
2010-04-17 20:03:10 +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
356e9a4bca re: r65152 fix translatewiki problems
* Recover lost $permErrorsUpload in uploadBase::verifyPermissions
* Use Http::isValidURI() to replace UploadFromUrl::isvalidurl()
2010-04-17 16:36:48 +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
Bryan Tong Minh
738de2e691 Refactored UploadFromUrl to use HttpFunctions.
Errors while fetching the file are now properly handled and also displayed in a reasonable way to the user (bug 22015).
2010-04-15 08:44:25 +00:00
Mark A. Hershberger
2e2c089898 follow up r61407
rename UploadBase::initialize to UploadBase::initializeFileInfo
Each sub-class implements initialize() with a different prototype.  Only two sub-classes actually use the parent initialize().
2010-02-09 03:54:59 +00:00
Mark A. Hershberger
5162f49f97 Random whitespace cleanup 2010-02-05 04:25:30 +00:00
Alexandre Emsenhuber
a0d9c508b2 Fix E_STRICT: UploadFromUrl::initialize() should have the same signature as UploadBase::initialize() 2009-12-02 16:37:38 +00:00
Raimond Spekking
5a7ac07b35 Fix PHP Strict Standards: Declaration of UploadFromUrl::initialize() should be compatible with that of UploadBase::initialize() in /var/www/w/includes/upload/UploadFromUrl.php on line 137 2009-11-27 21:53:34 +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
Bryan Tong Minh
3b2c160d7d Do a weak boolean comparison against $asyncdownload in order to accept null as false (fixes API upload by URL). 2009-10-29 20:17:23 +00:00
Bryan Tong Minh
c824e30197 * Updated upload hooks documentation
* Allow users to submit a modified file description without ignoring warnings
2009-10-23 20:05:31 +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
c2033042ee * Code style & commenting on upload functions.
* Move isValidURI from UploadFromUrl to HttpFunctions.
* Made some functions in UploadBase static.
2009-08-26 17:05:24 +00:00
Michael Dale
6af2322f85 * ( bug 19930 ) default to SYNC_DOWNLOAD 2009-07-27 19:00:27 +00:00