Commit graph

412 commits

Author SHA1 Message Date
jenkins-bot
8afc7161ed Merge "FSFile and TempFSFile cleanups" 2016-09-20 23:21:30 +00:00
Aaron Schulz
f7e3ac3f95 FSFile and TempFSFile cleanups
* Remove wf* function dependencies. This includes wfTempDir().
  Callers now should specify the directory, though it will try to do
  most of the wfTempDir() logic anyway if they do not.
* Update callers to inject wfTempDir() so $wgTmpDirectory is used by
  TempFSFile instead of it probing to find a valid directory itself.
* Move most of the wfTempDir() logic to TempFSFile::getUsableTempDirectory().
* Remove unused getMimeType() method.

Change-Id: Idd55936b07f9448a6c90577708722b7b52b8fe66
2016-09-19 19:55:09 +00:00
Aaron Schulz
8a573aa1f5 Move some FileBackend related classes to /libs
Change-Id: I0c3a84c2ed8b869519f4d38475a77539c24a88a8
2016-09-19 07:31:25 +00:00
Aaron Schulz
25a1651aad Make LockManager use StatusValue and move classes to /libs
Change-Id: Ifa41fc2939f3515d4a056746b0fcbff79786d25b
2016-09-19 04:34:28 +00:00
Aaron Schulz
740fcb4c58 Remove wf* function dependencies from FSLockManager
Change-Id: I52f08c6e7372ddbbcc1b5f82d505e435b01ff138
2016-09-18 13:45:56 -07:00
Aaron Schulz
c64c3ef9a8 Make Status extend StatusValue and start FileBackend update
* This avoids code duplication.
* Callers can safely start type-hinting StatusValue as well.
* Also moved the wrap() logic out of Status::__construct(), which
  only wrap() was (and should have been) using. Use "static" as
  well, so subclass behave properly.
* The docs and type-hints in /filebackend are updated as an example.
* A migration pattern is to inject a StatusValue wrapper
  into the backend and use it on all returned statuses, so MediaWiki
  will still get Status for message methods.

Change-Id: Iff9255f34870ea6b0c4b91f6ddc69eea95186aba
2016-09-17 15:45:40 -07:00
Aaron Schulz
d32b64235f Switch some callers to WaitConditionLoop
Also fixed up backwards documentation

Change-Id: I00c36aa751a79ca86a754e049a6da78cbb417b81
2016-09-08 19:29:18 -07:00
James D. Forrester
960e4d09ca Documentation: Replace misuse of 'later' when we meant 'latter'
Change-Id: I01bfdb8e0bfaa132533732873f7c840cea7935eb
2016-09-07 13:13:42 -07:00
Amir Sarabadani
381cffb980 Clean array() syntax in docs, part V
Change-Id: Ic65b7b2f1c2396246a3825c8d06d42bd6d06c37e
2016-09-05 02:44:26 +04:30
Aaron Schulz
1ba6d52141 Use WAN cache adaptiveTTL() method in FileBackendStore
Change-Id: I2e8b4e85b12c8892e8640abc63ee13b4b170645d
2016-09-02 15:59:52 -07:00
jenkins-bot
1b8eac21ab Merge "A few more DBLockManager fixes and cleanups" 2016-08-24 03:15:31 +00:00
Aaron Schulz
de1044de2c Fix broken lockmanager-fail-releaselock status messages
Change-Id: Icb0cfa6e38bc81c35430023afe50dd94ef3b2013
2016-08-23 16:05:05 +00:00
Aaron Schulz
8f47c177e3 A few more DBLockManager fixes and cleanups
* Do not do the connection init step if the same DB handle as
  wfGetDB( DB_MASTER ) is being used to avoid clobbering it.
* Remove begin(), since only one of the subclasses wants
  transactions. That one now uses startAtomic() now.
* Make getConnection() throw an error for bad config instead
  of return null, which was not documented or expected.

Change-Id: Ib09a7972d6569c29e83e329a8f7f9f47a393b896
2016-08-22 22:05:47 -07:00
Aaron Schulz
7f3faf091f Split DBLockManager classes into their own files
Change-Id: If903a90a5be2d6ff11504d34eb125e86c1ab1191
2016-08-20 10:33:37 -07:00
Aaron Schulz
8ad0394d69 Fix DBLockManager comments
Change-Id: I5431caf4b80995c71d4bc5ab739954d70081111a
2016-08-15 14:29:04 -07:00
Aaron Schulz
8b15f8456f Unbreak "localDBMaster" mode in MySqlLockManager by using a separate connection
Change-Id: I4f9328e1555d814e0849cea86aca20896c6dfacf
2016-07-29 19:18:58 -07:00
Aaron Schulz
20c5c48bb1 filebackend: Fix DBLockManager IDEA warnings
Change-Id: I5e671bcee0915f65082c139be8f42aafad6413f1
2016-07-22 23:37:37 +00:00
Aaron Schulz
d42a05475a Added Range support to FileBackend::streamFile()
* Added HTTP options headers parameter to streamFile().
* Refactored doStreamFile() to either call StreamFile::stream()
  or delagate that to the subclass. SwiftFileBackend now relays
  the full Swift response rather than manually making the headers.
  This also makes Range headers easy to support.
* Made use of this in img_auth.php for performance on private wikis.
* Elimate stat call in streamFile() for Swift if "headers" is empty.
* Refactored StreamFile a bit to inject request headers instead
  of using the $_SERVER global. A header options parameter is used
  instead, which also supports Range.
* Removed now unused prepareForStream().
* Cleaned up streamFile() unit tests.

Change-Id: I2ccbcbca6caabb8cf65bd6b3084cede2e6ea628a
2016-06-04 05:43:43 -07:00
Aaron Schulz
7ed633595d Log when resyncFiles() fails in FileBackendMultiWrite
This distinguishes cases that recover from sync errors
from those that do not.

Change-Id: Ibcdea18041e7344077c8308359a1a6087139f2e0
2016-04-29 12:16:13 -07:00
Aaron Schulz
48fc04e656 Optimize consistencyCheck() in FileBackendMultiwrite
doOperationsInternal() already set "preserveCache" but never actually
filled it in to begin with. This should lower round trips if sync checks
are enabled.

Change-Id: Ica67b8d66e7602faed842408365edbd466688f61
2016-04-27 05:18:25 +00:00
jenkins-bot
8f96f8f411 Merge "More FSFile docs" 2016-04-12 22:41:54 +00:00
Aaron Schulz
8cec086be0 filebackend: Make resyncFiles() easier to use
Pass in the resync mode as a flag instead of using
the object instance.

Change-Id: I2da661a65afd712403db936b6e31fba8e8069096
2016-04-12 21:17:51 +00:00
Aaron Schulz
b33df614b7 More FSFile docs
Change-Id: I1ca3e0bc9d5db4ca043f313fb15a780ae102c50a
2016-04-12 14:13:53 -07:00
Max Semenik
943563062f Kill mbstring fallbacks
In the age when we require PHP 5.5, pretending that mbstring emulation
is not slow and silly is silly.

Bug: T129435
Change-Id: Ic8235c9da9a926df63ec7388900c44eab454eebe
2016-04-06 22:14:48 +00:00
Reedy
b5656b6953 Many more function case mismatches
Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
2016-03-19 00:20:58 +00:00
Aaron Schulz
a14ef91251 Add FileOperationReplication log to improve multiwrite backend logging
Change-Id: I541eac740f4a07182067294c9597cdd49330e86c
2016-03-07 13:55:27 -08:00
jenkins-bot
7e6a9ce4ad Merge "filebackend: Clean up TempFSFile and fix IDEA errors" 2016-03-03 01:38:05 +00:00
Aaron Schulz
b3c80a0ff5 filebackend: Clean up TempFSFile and fix IDEA errors
Change-Id: I4e25e3bf906fa3a918f4462fac1a6be5e85696aa
2016-03-03 01:25:37 +00:00
Aaron Schulz
a5d903860a Allow FSFile objects for src in FileBackend::do*Operations
Convenience aside, this lets multiwrite backends do async replication for
"store" operations safely, buy keeping a handle to the source file that
prevents it from getting prematurely deleted before the post-send writes
to the secondary backends can happen.

Bug: T91869
Change-Id: I1254de527c47835c35fed6e526b42953c1b2b2ca
2016-03-02 18:49:56 +00:00
Bartosz Dziewoński
c161c46d26 Improve code suffering from PHP 5.3's lack of support for foo()[]
I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored
everything involving isset(), unset() or array assigments, then
skimmed through the remaining results and changed things where they
made sense. These changes were not automated, so please review them.

Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
2016-02-28 22:49:20 +01:00
Aaron Schulz
c0446571d5 Use sync writes for replication of 'store' operations
The local temporary file might not live long enough to be
copied into storage during post-send.

Bug: T128124
Change-Id: Ifb5260958db008ec8b9f4db90f95a42e5ecaeadc
2016-02-27 00:20:13 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Ricordisamoa
b982fbbd07 Stop doing $that = $this in includes/filebackend
Closures support $this as of PHP 5.4

Change-Id: Ib11139ec81336710c22146f9ff714e8afd3aa2cf
2016-02-10 18:33:52 +01:00
jenkins-bot
3639bb8736 Merge "Fix some FSFileBackend IDEA errors" 2015-12-31 01:18:46 +00:00
Aaron Schulz
1e03c50891 Fix some FSFileBackend IDEA errors
Change-Id: I372ad7af21f223b670498ac17ecac90918ceb2a8
2015-12-29 01:46:05 -08:00
Aaron Schulz
d1f9b125f9 Fix some FileOpBatch IDEA errors
Change-Id: Idd670054b2e257255da18bb8e7048ea9041be269
2015-12-29 01:34:22 -08:00
Reedy
00c426e3c2 Replace wfBaseConvert with Wikimedia\base_convert
Change-Id: Iadab3d018c3559daf79be90edb23d131729bdb68
2015-11-24 22:51:42 +00:00
umherirrender
78328dee73 Use Database::fetchRow instead of array cast
Change-Id: I71435955de604a9b3c2b2570e144b55b35421e4c
2015-11-20 20:44:56 +01:00
Aaron Schulz
ddd2454967 Make Swift iterators throw errors on failure
This is in line with FSFileBackend and is provides the calling
loop of a way to know the listing failed, rather than just
giving incomplete information.

Change-Id: I34c66d9dbf84e5f33982d17e61364c1595d3e9f7
2015-11-06 16:10:05 -08:00
jenkins-bot
b85aeec5e2 Merge "Improve MIME detection in FileBackend" 2015-11-03 11:10:41 +00:00
Timo Tijhof
8a821011ce Remove getLocalServerInstance try/catch in UIDGenerator and DBLockManager
Follows-up 17c91ad610 in which the exception was removed.

Change-Id: If0c8465d0e04f69f29f3f2602dac7ae4538f7542
2015-11-02 22:16:05 +00:00
Aaron Schulz
17c91ad610 Replace newAccelerator() with getLocalServerInstance()
The name is clearer and more consistent, with simpler arguments.

Change-Id: I7205a99ce033e8b086a52cd02c8a721e99c84b1e
2015-11-02 21:39:08 +00:00
Aaron Schulz
de290cd02d Improve MIME detection in FileBackend
The content type detector will now inspect the file contents
to better handle extensionless files.

Also dependency inject the callback and make the default one
use FileInfo.

Change-Id: Iad59bf6c6a416b706f976a4c425763fd30e2debb
2015-11-02 00:36:54 +00:00
Aaron Schulz
642ca3862b Normalize header case for FileBackend operations
Normalize all headers to lower case at the start of the
FileBackend operation methods. This makes it easy for
subclasses to check for certain headers, e.g. content-type.

Change-Id: Ia69976326d17a51bcaa61f2781aa669ae7bd9c28
2015-10-27 12:34:35 -07:00
jenkins-bot
8ab6c38d4f Merge "Make Swift backend respect Content-Type in create/store" 2015-10-27 10:40:11 +00:00
Aaron Schulz
8c4e6beaf3 filebackend: Remove some old Content-Disposition b/c code
Change-Id: I6af4a84bd549e2bfb1b110fa790f499d144f236b
2015-10-26 18:16:27 +00:00
Aaron Schulz
0e3bfab533 Make Swift backend respect Content-Type in create/store
Change-Id: I479d1fc4f261bdcdc380404db0cb2f2397877759
2015-10-26 11:16:18 -07:00
Aaron Schulz
5262d41a6c Minor fix to primeFileCache() comment
Change-Id: I7d040c5a914574df72fa31612df0eb28e15fd46c
2015-10-23 17:18:56 -07:00
Aaron Schulz
72734cfffa Replace some calls to wfGetMainCache()
Change-Id: I9ba8fd5918877af6312b0854634bd36211438f00
2015-10-20 23:52:07 -07:00
Aaron Schulz
7c07943eab Update more docs and type hints to use IDatabase
Change-Id: I8c8d85b32a8aba21e14d2a2dde4c25eb509186c1
2015-10-06 18:49:52 -07:00