Commit graph

164 commits

Author SHA1 Message Date
jenkins-bot
8eb1344fba Merge "Removed some unnecessary code in LocalFileDeleteBatch" 2014-12-12 21:18:30 +00:00
Ricordisamoa
fc5fd5c37a Typo fixes and non-code tweaks
Skipped replacements:
* prefered → preferred
* prolly → probably

Skipped files:
* resources/lib/jquery.ui/jquery.ui.mouse.js
* resources/lib/jquery/jquery.form.js

Change-Id: Ib7923f362ddfca1b892bf5d601785d6b5aa5d44c
2014-12-12 18:31:15 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Aaron Schulz
4269e65ff9 Removed some unnecessary code in LocalFileDeleteBatch
Change-Id: I4d03d03fada5c299779b7fb7e998285568672a6c
2014-11-27 12:50:41 -08:00
Aaron Schulz
17cc78767a Switch to LOCK IN SHARE MODE in recordUpload2()
* We just need the latest data; the advisory locking in lock()
  already manages mutual exclusion.

Change-Id: I9af7a892b2dcafd30149332b0084f61d117c9cad
2014-10-29 06:59:51 +00:00
Aaron Schulz
745637c3da Reduced LocalFileRestoreBatch::execute deadlocks when doing batch restores
* Often users restore a batch of many files with similar names.
  This fails due to gap locking on non-existing rows which tangles up
  unrelated actions. Avoid that locking for the common case.
* This changes the return value of LocalFile::lock() from a useless
  one (due to the exception) to one that conveys some useful information.
  The method is fairly internal in any case.

Change-Id: Idb86367cf45b731d4b2a67b1813a660bc0e7a84f
2014-10-17 04:07:54 +00:00
Aaron Schulz
a578bd195b Made LocalFileMoveBatch::addOlds use SH locks instead of EX ones
Change-Id: I928f98deded6e71b4b1e63167ca8b565e39c6394
2014-10-09 22:50:26 +00:00
jenkins-bot
396927c0b6 Merge "Made LocalFile move/delete/restore handle network partitions better" 2014-08-21 15:38:10 +00:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
Aaron Schulz
8dca7488ec Made LocalFile move/delete/restore handle network partitions better
* Previously, the file existence checks would not distinguish an answer
  in the negative from a non-answer. This was a long-standing problem.
  This avoids moving DB entries without moving the files (unless the
  partition happens in the middle of the moves of course).
* Optimized fileExistsBatch() to do concurrent stats if possible.

bug: 40927
bug: 69312
Change-Id: I9132fd5591bb7a3d5852f17514dcf51a3d8b7812
2014-08-14 17:26:57 +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
b883e8c7c0 Cleanup some docs (includes/[e-l])
- 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: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
umherirrender
d5d37cd034 Add missing rollback to LocalFile::recordUpload2
When begin was called, all returns should have rollback called to
close the transaction.

Change-Id: I8197f73fb45c2e2900db6d5e588623f9b0c46ea5
2014-07-17 10:41:18 +02:00
Aaron Schulz
c87c9c14da Added missing unlock() calls in LocalFile
Change-Id: Id427fb424bfb46670f2074664aca750014c70225
2014-07-16 17:14:23 -07:00
jenkins-bot
6f38f78cdd Merge "Fixed possible race condition in LocalFileMoveBatch" 2014-05-22 04:56:48 +00:00
Aaron Schulz
fc6d99cb20 Tweaked timestamp kludge logic in recordUpload2
* This now only does the SELECT FOR UPDATE for the re-upload case

Change-Id: I21b1b0328b6dbfb30f4f0293212515b9ee081778
2014-05-20 14:51:16 -07:00
Aaron Schulz
399198c28e Replace FOR UPDATE with LockManager use in LocalFile::lock()
* This avoids excess contention where inserts of rows for
  similarly named files get blocked. This often would effect
  users of UploadWizard or any bot doing mass uploads.

Change-Id: Ie7a328f7d4f03aa249770804417347a50356ea42
2014-05-20 14:22:52 -07:00
Aaron Schulz
51c173912a Fixed possible race condition in LocalFileMoveBatch
* If a move is blocked by a re-upload and the TRX started outside of
  LocalFile::lock, then the move did not see the new row in the oldimage
  table and so it will not move that version of the file in storage. Use
  the latest DB data to avoid that.

Change-Id: I7ec46941170293c96b99a449cb396517108e8b3d
2014-05-19 15:18:05 -07:00
Aaron Schulz
582fd02fb9 Use FOR UPDATE in prior LocalFile timestamp check
* This covers the case with a snapshotted transaction outside of lock()/unlock()

Change-Id: I8639c2e51cb918f452dc1576681d6224fb4fb2c0
2014-05-14 09:43:02 -07:00
Aaron Schulz
605329976f Made LocalFile avoid duplicate (name,timestamp) pairs
* Various bits of code seem to assume uniqueness already

bug: 65264
Change-Id: Ib00fdbe87a79296c640cd69d74928236ce7a4aee
2014-05-13 15:03:32 -07:00
Siebrand Mazeland
4b8523198f Make phpcs-strict pass on includes/ (4/~10)
Change-Id: I2767205a7059adfb8fa090a82abd332e518f2590
2014-05-11 19:35:09 +00:00
umherirrender
2d11016ecd Pass $user to LocalFileDeleteBatch
This avoids the use of $wgUser

Change-Id: I60cab27e0708a818c77791cc89194b6dd726da0b
2014-05-06 21:31:29 +02:00
Jeff
8c62609dc8 PostgreSQL: decode image.img_metadata
The img_metadata field was not being decoded from bytea into text.

This change to core fixes the reported problem with PdfHandler against
1.22.6, origin/REL1_23 and git head.

Bug: 59147
Change-Id: I285a317a57a29713af1f7f630b340278bd5400da
2014-05-05 16:02:55 -07:00
umherirrender
3cca294d75 Avoid raw sql in LocalFileDeleteBatch::doDBInserts
Use Database::conditional instead of raw sql.

Change-Id: Ic00146e9ec582a263b9dec117b12532fdc24789e
2014-05-05 21:28:32 +02:00
Aaron Schulz
250b23aa01 Removed commented-out migrateThumbFile() code
Change-Id: Ic52d3a8d93808b365c3f06fef9e51d65efcd1d57
2014-04-30 00:30:37 -07:00
umherirrender
26e705f808 Add $user param to Revision::newNullRevision
This avoids the use of $wgUser in Revision constructor and makes the
dependency on the global visible.

Change-Id: Ib67bd706a3c4ef081f475406e9aa1094c42222ef
2014-04-28 18:59:20 +02:00
Ori Livneh
776d0900b9 Simplify LocalFile::isVolatile
Make the logic a bit easier to follow. Follow-up to I99a39c3d2.

Change-Id: I9b815d7f0d229ef25db5b7f48f6e49ca4dac046e
2014-04-24 15:57:09 -07:00
jenkins-bot
7b8af70f26 Merge "Made LocalFile::loadExtraFromDB() handle re-upload race conditions" 2014-04-24 22:17:51 +00:00
Aaron Schulz
3eced85d60 Made LocalFile::loadExtraFromDB() handle re-upload race conditions
Change-Id: I99a39c3d2b5d7a227be9b11a2f23c534ea4739d9
2014-04-24 15:05:12 -07:00
Siebrand Mazeland
f994817f6b Pass phpcs-strict on various files in includes/
These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23
2014-04-24 21:50:01 +02:00
Aaron Schulz
bb0651087f Use slave DB connections for LocalFile cache misses
* Previously LocalFile cache misses would hit the master DB
  (even for shared repos like Commons).
* Since lock() is always called before file changes, this has
  been modified to call a new markVolatile() method to track
  changing (or recently changed) files in memcached. On cache
  miss this tracking is used to decide whether to use the
  slave or the master DB.

Change-Id: I942f5e28dd9e0953b6382cc2247ca480494d5718
2014-04-24 05:55:21 +00:00
Aaron Schulz
2354da0538 Fixed slow query in LocalFileDeleteBatch::getHashes()
* All the old files will have the oi_name of the $file

bug: 62360
Change-Id: Ie3aeee44a7ec1ef4cad0c0fcde9b7d0dba003da2
2014-04-21 22:58:42 -07:00
jenkins-bot
10de9847fb Merge "Avoid image table updates on file upload failure" 2014-04-21 16:54:19 +00: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
Aaron Schulz
17480be012 Avoid image table updates on file upload failure
* If the publish() call did not really do anything, then there is
  no use in saving the page and file DB records. Previously the
  user would get an error but the description page would be made.

bug: 64071
Change-Id: I1959f8c1ef33dbd1b238f6020117d2862d4b0fd3
2014-04-18 12:36:20 -07:00
umherirrender
1e64c2d0c9 Avoid using raw sql in LocalFile.php
Now the IN-List is created by the database abstraction layer.

Change-Id: I08d309eb4aad830ad6141cbfbe16447eb2674f52
2014-04-09 17:35:20 +02:00
Brian Wolff
ceb5abb7e0 When uploading a new file, save to memcached directly after commit
Previously if an exception was thrown when creating the description
page, the old (negative) memcached entry would not be purged, and
the file would appear not to exist until 24 hours later.

This way, as soon as we have the image row committed to db, we
change the memcache entry, so memcache of image row always looks
like actual image row.

Bug: 32551
Change-Id: I9c260e9a4a1e0d6ade1771542dd834f969904cef
2014-04-06 02:30:22 +00:00
Aaron Schulz
3cc06f6d8c Speed up LocalFile locking behavior
* Lowered the lock() timeout
* Wrap the destination DB write with memcached locks for move
  ops since it is easier to control that lock timeout than the
  DB lock timeouts.
* Cleanup locks in the destructor (e.g. on exceptions). Other
  process can pile up more if locks have to expire.

bug: 63058
Change-Id: I38b28d81ec96daa80ece2354db284a614289ba0b
2014-04-01 09:27:38 +00:00
Prod
fe019f8568 Execute LocalFilePurgeThumbnails hook before purging thumbnails
bug: 62273
Change-Id: I08ae902debb36039d2c0be829eec07a109e70a24
2014-03-12 22:10:57 -04:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
Brad Jorsch
a2120b0bd0 Make imagelinks work like templatelinks
Due to bug 17259 (which is fixed in a better way in Id44d566a),
imagelinks only records the redirect and not the actual image used when
an image redirect is referenced. This causes various problems, such as
cascading protection not working through image redirects.

It makes more sense for imagelinks to work like tempaltelinks, recording
both so that things like cascading protection don't have to care about
image redirects explicitly.

Comparing imagelinks to templatelinks also reveals a few places
(WikiPage::doDeleteUpdates, WikiPage::doCascadeProtectionUpdates) that
should be triggering a LinksUpdate if the image links changed.

Bug: 23002
Bug: 23542
Bug: 26503
Change-Id: I64fe7d25646cae2c8213211893c6f821f3504dbf
2014-01-07 23:13:43 +00:00
Siebrand Mazeland
7b1642d1b5 Change line breaks in LocalFile::recordUpload2()
Change-Id: Ib27e381106d048bb0a24286a877c85f0e62408cf
2013-12-05 23:32:50 +01:00
Siebrand Mazeland
43605121f8 Satisfy code analyzer by ensuring $urls is defined
Change-Id: I0f399edfca51c8949f0d0ce02c7a84f0890db92f
2013-12-04 22:30:00 +00:00
Siebrand Mazeland
417d4fbbfa Update documentation for file repo related classes
Change-Id: I626d972f92934afc9349e11d3a5550c4044dcb53
2013-12-04 23:06:53 +01:00
jenkins-bot
0a54e70cdd Merge "Set visibility on class properties in LocalFile.php" 2013-12-04 09:20:19 +00:00
Siebrand Mazeland
aab1a070d2 Set visibility on class properties in LocalFile.php
Change-Id: Ibab58651bb147433bd99046013e11f8c773bef70
2013-12-04 10:10:33 +01:00
Aaron Schulz
3775237e78 Avoid calling oldFileFromRowFactory field directly
Change-Id: Ibbd5a8baa27015eec443349a67edc57ede5d174d
2013-12-02 10:47:24 -08:00
Siebrand Mazeland
f742b27dd3 Break long lines in file repo files
Change-Id: I6d95c1b3e14a947a92127efa681007baaeab89ba
2013-11-23 21:17:08 +00:00
Siebrand Mazeland
bb39b5a6e4 Update formatting of file repo classes
Change-Id: I780070e07352d84d7cda7628994b28b04e8a1ebf
2013-11-23 21:00:11 +01:00
umherirrender
5dbfd5bf80 Fixed spacing
- Removed trailing spaces in comments
- Removed multiple empty lines
- Removed space after object operator

Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
2013-11-21 18:52:25 +00:00