Commit graph

90 commits

Author SHA1 Message Date
umherirrender
50b1cd2fbc Remove never thrown UploadStashNotAvailableException
Also move creation of UploadStash to main entry point of the special
page to avoid use of context before it is set (by called getUser).

Change-Id: Ibcb17b6ee1b853d807f91104ba428b307e9a5208
2015-03-25 19:29:49 +00:00
Mark Holmquist
7585e214d2 Add more detailed upload stash error messages
There are seven (used) error types in the stash class, and we umbrella'd
them all into one error message, which is mighty silly. This should give
us more information.

Also added to the mw.Api.errors list so UploadWizard can handle them.

Change-Id: I79bf0c29a4cef19363d111cc1128e35256ae572a
2014-10-27 19:41:25 +00:00
rillke
c31fbf073e Unify the spelling of MIME in documentation
Writing MIME as written in Wikipedia and some documentation clean up.

Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4
2014-08-07 23:38:45 +02:00
umherirrender
768ac15c70 Cleanup some docs (includes/[s-z])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: Ie419638e909a47aa72a274043604247830ee1a81
2014-07-24 19:43:44 +02:00
Siebrand Mazeland
d185ec734a Pass phpcs-strict on includes/upload
Change-Id: I80eaa22398227a4edb7160d560b625102c7436ac
2014-05-10 10:25:54 +02:00
Siebrand Mazeland
69a2ecfe3e Update formatting of includes/upload/
Change-Id: I8cf59cd3bb6dd8de2ed6509b7bc2ef9ff7c5caf1
2014-05-09 16:53:19 +02:00
umherirrender
957adbef22 Fixed some @params documentation (includes/[file...|upload])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I8804ebe0922d3a414863b162a2110e0b9e49b80f
2014-04-19 17:19:17 +02:00
umherirrender
725d9d125d Removed unneeded spaces and colons in @param and friends
Also swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
2014-04-08 16:02:49 +00:00
jenkins-bot
806df0771e Merge "UploadStash us_props fix for Postgres" 2014-02-21 14:40:14 +00:00
Aaron Schulz
0ef8100a25 UploadStash us_props fix for Postgres
* Follows up c7f4586fe1

Change-Id: I5a8568efaf0817ca743de722d5486457ff1a8d87
2014-02-19 13:28:26 -08:00
saper
c7f4586fe1 Add missing uploadstash.us_props for PostgreSQL
This field was introduced in e5d41cca90
but only for MySQL.

Change-Id: I057b1dd845a5ab7ae05f5597454981a6e2c12698
2013-12-09 20:46:17 +01:00
Brad Jorsch
d4b250ad38 UploadStash::removeFileNoAuth shouldn't need auth
UploadStash::getFile has a "noAuth" parameter, which should be set true
when this is called from UploadStash::removeFileNoAuth.

Callers should already be doing their own auth checking, or calling
UploadStash::removeFile.

Bug: 56298
Change-Id: Ic70c4e2bc6df5cb9b139a3631766f8ff0ec4ef02
2013-10-29 11:58:17 -04:00
Aaron Schulz
c61d48f87e Stop spamming exception log with random upload stash failures
* Things like authorization and validation problems do not belong in the
  exception log.

Change-Id: I3c4c1bab65cfe9111dc2161bda6d023234112900
2013-06-25 16:10:42 -07:00
csteipp
4233341283 SECURITY: Do checks on all upload types
Also, verify file before stashing it

Change-Id: Ib2474cb778d53959a4f479e53d0392f916b18d83
2013-05-21 13:20:06 -07:00
umherirrender
ee31d37821 Fixed spacing in context/installer/media/templates/upload folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9761be9fa47adc3554852a97b19792b4648466ad
2013-04-21 06:22:06 +00:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
umherirrender
8764b3aa7c Remove spaces in function signature
Change-Id: I45aea7a7af88cd913b2f485913620a8af0ab2fed
2013-03-18 20:44:43 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Brad Jorsch
8049aa3384 Fix UploadStash::removeFile() error
If nothing has called getFile() for a key before that key is passed to
removeFileNoAuth(), UploadStash will throw a fatal error when it tries to
remove the file from the filesystem because the UploadStashFile was
never created.

Change-Id: Idf0d2c53ce759b59836f34ff5aaad393b8c371c6
2013-02-26 15:27:30 -08:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
Aaron Schulz
ba5e774de9 [Upload] Added async upload concatenation support.
* Clients can send the last chunk with 'async' to get an immediate
  response and then check the status of the upload by polling the API
  using the 'checkstatus' parameter.
* Pass the User object along to stash functions within UploadFromChunks.

Change-Id: Ie2ad4c7e94862a728e8a687c3195306e16a5059e
2012-12-05 09:39:31 -08:00
Aaron Schulz
e5d41cca90 [Upload] [Schema] Added us_props column to avoid expensive GETs.
* We already compute the props when stashing, so including that in a column
  lets us reuse it later when the stashed file is to be published.

Change-Id: I3d6adb6528f1e992d8986058806e745c4e1c0300
2012-12-03 10:23:40 -08:00
Aaron Schulz
7ecf9ab87e Various simple optimizations for the chunked upload process.
* This adds an UnregisteredLocalFile::setLocalReference()
  function, which is used to avoid an extra GET request.
* This removes the useless rename() in stashFile(). We just
  need to make sure the stashed file has the right extension.
  Getting rid of the rename makes setLocalReference() usable.
* Also adds some debug logging with ellapsed time.

Change-Id: I087701ad0c27a4eba74591e6b49f5667b011424c
2012-11-18 12:40:30 -08:00
Antoine Musso
9362bb6c56 miscellaneous doxygen warnings
* @licence -> @license
* Protects inline HTML by using double quotes, our inline comments uses
  elements such as <h1> or <firstnameLastname@gmail.com>
* Commands in lowercase (@TODO -> @todo, @NOTE -> @note)
* removes @abstract and @static since doxygen detects them from PHP
  code.
* various undocumented function parameters
* typos in parameters declarations

Change-Id: I62ad6fc124c355bf31acc780b9614a59cf79a421
2012-10-22 14:00:08 +02:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Aaron Schulz
7cfc4f818e Removed useless begin()/commit() calls as DBO_TRX is not on in cli mode.
Change-Id: Icb80c26b64ace1f36871c6a9c772aaf1dfa6a111
2012-09-24 20:00:09 -07:00
Reedy
be32e26699 Fix strict error in UploadStashFile
Strict standards: Declaration of UploadStashFile::thumbName() should be compatible with that of File::thumbName() in /var/www/wiki/mediawiki/core/includes/upload/UploadStash.php on line 498

Call Stack:
    0.0004     645672   1. {main}() /var/www/wiki/mediawiki/core/index.php:0
    0.0756    5904264   2. MediaWiki->run() /var/www/wiki/mediawiki/core/index.php:59
    0.0756    5904264   3. MediaWiki->main() /var/www/wiki/mediawiki/core/includes/Wiki.php:446
    0.0797    6328272   4. MediaWiki->performRequest() /var/www/wiki/mediawiki/core/includes/Wiki.php:536
    0.0960    7042800   5. SpecialPageFactory::executePath() /var/www/wiki/mediawiki/core/includes/Wiki.php:290
    0.1041    8003528   6. SpecialPage->run() /var/www/wiki/mediawiki/core/includes/SpecialPageFactory.php:494
    0.1041    8003528   7. SpecialSpecialpages->execute() /var/www/wiki/mediawiki/core/includes/SpecialPage.php:611
    0.2082   17300016   8. SpecialSpecialpages->getPageGroups() /var/www/wiki/mediawiki/core/includes/specials/SpecialSpecialpages.php:42
    0.2083   17300016   9. SpecialPageFactory::getUsablePages() /var/www/wiki/mediawiki/core/includes/specials/SpecialSpecialpages.php:54
    0.4498   30176624  10. SpecialPageFactory::getPage() /var/www/wiki/mediawiki/core/includes/SpecialPageFactory.php:372
    0.4527   30373096  11. SpecialUploadStash->__construct() /var/www/wiki/mediawiki/core/includes/SpecialPageFactory.php:344
    0.4861   33604352  12. FileRepo->getUploadStash() /var/www/wiki/mediawiki/core/includes/specials/SpecialUploadStash.php:52
    0.4861   33604832  13. AutoLoader::autoload() /var/www/wiki/mediawiki/core/includes/AutoLoader.php:0
    0.4898   33952264  14. require('/var/www/wiki/mediawiki/core/includes/upload/UploadStash.php') /var/www/wiki/mediawiki/core/includes/AutoLoader.php:1150

Change-Id: Iee2aae16df804f42cbae9c21c870781a08ad3850
2012-09-16 18:18:27 +01:00
Alexandre Emsenhuber
c7870d2eae Pass the parameters to the error message in UploadStash::stashFile().
Currently it shows the error message without any parameters since
$error is an array with the message name and its parameters, and
the Message class thinks that this is a message with its fallbacks
(see wfMessageFallback())

Change-Id: I5d825144795ad108f0a71f90cc530629c5c98a41
2012-08-10 21:17:18 +02:00
Jan Gerber
c239df639b cleanup temp files left around by UploadStash
stashFile renames files to add an extension, this way it is no longer
cleaned up by php. So we have to unlink it after storing it in the FileRepo.

Change-Id: Iab697fc4535546dd25231dddf220e18f3b0b73be
2012-07-20 01:18:31 +00:00
Antoine Musso
d5737f8f17 update @param @return doc in several files
Change-Id: I0e23227330f90dc4121fd2a313d2e9a33c3c97a7
2012-07-10 17:08:52 +02:00
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
Aaron Schulz
c8e1463cc0 [FileRepo] Various code cleanups.
* Made File::isHashed() wrap FileRepo::getHashLevels(). Removed now-used FileRepo::isHashed().
* Removed FileRepo::simpleClean(). Not useful anymore since the paths in Status errors don't have $IP or upload dirs anymore.
* Removed code in FileRepo::fileExistsBatch() and FileRepo::cleanupBatch() to handle FS file paths, which should never be passed in anymore. Likewise, removed FILES_ONLY parameter.
* Removed FileRepo::append()/appendFinish() stub functions.
* Added FileRepo::assertWritableRepo() function to better handle repos that are read-only by design rather than the hack of overwriting each function (several were missed).
* Added FileBackend::isPathTraversalFree() function and used it in FileRepo::validateFilename() to avoid duplication.
* Tweaked FileRepo::freeTemp() to avoid file locking and made FileRepo::cleanupBatch() return a Status.
* Moved FileRepo::cleanupDeletedBatch() near FileRepo::deleteBatch().
* Added type hinting to a few places.
* Tweaked some misleading doc comments and added function visibility markers.

Change 1:
* Simplified NullRepo to also use assertWritableRepo(). It is currently only used by a single unit test.

Change-Id: I1cd0f4971011772e38e5156f94ffc50325372f28
2012-04-05 12:48:47 -07:00
Sam Reed
09a78c1368 More return documentation 2012-02-09 21:36:14 +00:00
Aaron Schulz
16dc83e8e4 r110979: removed implode() call and format the message as plaintext, as any HTML will be escaped anyway for such exceptions. 2012-02-08 23:25:58 +00:00
Ian Baker
a8ae834581 Properly expand the "error storing file" message. Fixes bug 33846 2012-02-08 23:09:19 +00:00
Antoine Musso
2bf8d0db90 Fix doc for includes/upload 2012-02-08 17:03:43 +00:00
Sam Reed
765b318283 Add __METHOD__ to begin/commit
Improve error message from r109433
2012-01-18 21:27:28 +00:00
Aaron Schulz
14863b9aa5 Cleaned up some references to FSRepo in code and comments. This should have no noticeable functional changes. 2011-12-20 19:25:23 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Jure Kajzer
be3bbfc539 * Added getInfinity to DatabaseOracle
* Block - replaced 'infinity' strings with DB->getInfinity calls
* UploadStash - added sequence value generation for ID
2011-11-10 07:41:12 +00:00
Sam Reed
9d41b95053 Kill various unused variables
Comment some out also

Add some bits of documentation
2011-10-29 01:17:26 +00:00
Ian Baker
bfc89c6ade Fixed incorrect userId reference 2011-09-14 17:23:09 +00:00
Ian Baker
a26afff4e0 Cleaning up little things, updates to code clarity, documentation fixes per Catrope's suggestions.
followup to r94536, r94592, r94594
2011-08-16 17:57:32 +00:00
Ian Baker
53f3c48a95 Removed the ability to pass a key into stashFile(), which simplifies the stash row creation a great deal.
Updated UploadFromUrlJob to properly use the database stash
followup to r92200
2011-08-15 23:58:40 +00:00
Ian Baker
36babe9a7d Removed complex replag handling, now just query master when record isn't present on slave.
followup to r92009
2011-08-15 23:40:57 +00:00
Ian Baker
6b292f7804 cleaned up database query, doesn't have to be aware of column names anymore (thanks Catrope!)
followup to r92009
2011-08-15 18:17:51 +00:00
Ian Baker
9cb2d4743a Fixed incorrect usage of || operator, added test
removed spurious use of empty()
listFiles() was broken, now works
followup to r92009
2011-08-15 18:10:10 +00:00