* 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
* 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
* 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
* 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
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
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
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
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
The local temporary file might not live long enough to be
copied into storage during post-send.
Bug: T128124
Change-Id: Ifb5260958db008ec8b9f4db90f95a42e5ecaeadc
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
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
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