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
* This will defer writes to non-master backends till the
end up the web request. This is useful for multi-DC setups.
Bug: T112708
Change-Id: I118c07764dd4a4f4f2590d4548238df12860e750
These are available in phpunit since 3.5.0, which I think
is reasonable to expect people to have at this point,
especially when we actually require 3.7.0 or higher in phpunit.php:
Use assertSame instead of assertArrayEquals in UIDGeneratorTest.
assertSame (and assertEqual) care about sortorder of the array,
and is perfectly sufficient in this case to check they array is correct.
if ( $puVersion !== '@package_version@' && version_compare( $puVersion, '3.7.0', '<' ) ) {
die( "PHPUnit 3.7.0 or later required; you have {$puVersion}.\n" );
}
Change-Id: Ic32ab45110e4c4304ef046ae8d0e98c741255559
* Use MediaWikiTestCase::getNewTempFile and getNewTempDirectory
instead of wfTempDir().
The upload api tests wrote a tempnam() file directly (where
wfTempDir() is typically shared with other systems and concurrent
runs). Use MediaWikiTestCase::getNewTempFile and
getNewTempDirectory instead.
This also ensures its removal by the teardown handler without
needing manual unlink() calls. And it doesn't rely on the test
passing. (Many unlink calls where at the bottom of tests,
which wouldn't be reached in case of failure).
* For the upload test, the presistent storing of
'Oberaargletscher_from_Oberaar.jpg' (downloaded from Commons)
was removed. Note that this didn't work for Jenkins builds anyway
as Jenkins builds set $wgTmpDirectory to a unique directory
in tmpfs associated with an individual build.
* For filebackend tests, moved directory creation from the dataProvider
to the main test.
Implemented addTmpFiles() to allow subclasses to register
additional files (created by other means) to be cleaned up also.
Removed unused $tmpName and $toPath parameters in data
provider for FileBackendTest::testStore. And fixed weird double
$op2 variable name to be called $op3.
* Skipped parserTest.inc, MockFileBackend.php, and
UploadFromUrlTestSuite.php as those don't use MediaWikiTestCase.
Change-Id: Ic7feb06ef0c1006eb99485470a1a59419f972545
* This can be useful for carrying over metadata when copying files around
* Also fixed a bug in sanitizeHdrs() for Swift (broken content-disposition)
Change-Id: I4534e9acac2b306086797b3677f85c05b98e39fc
* Added a new curl multi wrapper under libs/.
* Used the new MultiHttpClient class instead of CloudFiles
* Removed CDN related config and code as it does not work.
well due to mutating files and tiny purge rate limits by CDNs.
* Also removed the unused and esoteric 'swiftAnonUser' parameter.
* Support concurrent 'describe' operations.
* Set ACLs on containers on intial PUT instead of in two steps.
Previously if the second step failed, prepare() would never
set the ACLs correctly since it aborts if the container exists.
* Improve token deletion to only trigger on 401s rather than other
random errors like 50X timeouts.
* Removed duplicative getResponse* code by just using one closure
called for both the concurrent and serial cases. Both cases are
now funneled through doExecuteOpHandlesInternal().
* Add the MD5 to stat info, as it might be useful for speeding up
the copy scripts in some cases (when both backends have md5 set).
* Avoid use of trigger_error() since there is a swift log group.
* A few other small code cleanups.
Change-Id: I1adb3e2df6df8cf01d3ad74158de96ea9a79da2e
Actually this messes with the implicit backend made for things like Math (when unconfigured), which uses the "new" operator.
This reverts commit 1f129a22cb.
Change-Id: I4c72c4f7c8b82e38df5496cf2b90fc9e19c40334
* Moved some of the graph construction work to FileBackendGroup.
This helps the code in not depending on the rest of MW so much.
* Updated tests and FileBackendMultiwrite, which are the only things
directly constructing FileBackend objects.
Change-Id: I188a053c70ce088ce34613d5db40e6708e3ea9b7
* Used this parameter to speed up copyFileBackend.php.
* Also added mtime checks to copyFileBackend.php and a few cleanups.
* Also fixed some incorrect getDirListPageInternal/getFileListPageInternal docs.
Change-Id: I424ef238f7adf4cf1f33b74e3a4e187dcb328a99
Make each run of the FileBackendTest be for a different "wiki"
so you could have multiple runs at the same time without them
interfering with each other.
There's been intermittent failures on jenkins for this test. I'm
not sure if its some race condition (which wouldn't really make
sense given each run should be independent I thought), but this
can't hurt.
Change-Id: I3b639f1c783efc140028c3acdce35ef3f58bf66f
Also update some previous inconsistencies pointed out by Krinkle in change IDs:
* Ide20743a2e84ff68549286120e6cff9d9f396f54
* I811ca957b6588085d67606ebc0cd4033a1e53839
Change-Id: Ife33b931870d0d7e04fcb40974997436d27f528f
* Previously, for doQuickOperations(), the default move function
would just delete the file if it was moved over itself. In fact,
the php-cloudfiles bindings have this same bug in its move function.
* For both copy and move, when the source and destination are the
same path, make sure that the headers get updated as specified.
This only applies for the 'overwrite' case (not 'overwriteSame').
* Fixed bad status for doQuickOperations() when copying a file over
itself using FSFileBackend.
* Clarified the documentation for 'overwriteSame' option.
* Renamed destSameAsSource to overwriteSameCase in FileOp for clarity.
Change-Id: I3f609d9413795c654de27958b1e807b1fc785f31
* Beefed up unit tests for this case and other "ignoreMissingSource" cases
such as when the source container or parent directory do not exist.
Change-Id: Iea6dae2424edfd0c4367e5cff606c09a4e8a865b
* Improved handling of corrupt values in cache for MemcLockManager.
Also improved the use of Status warnings a bit.
* Removed broken special-case handling for SH->EX lock escalation.
Updated MysqLockManager to compensate.
* Made FSLockManager only use one handle per file, which is more
efficient and avoids errors when escalating locks (SH->EX).
* Made lock unit tests have more useful output on failure.
Change-Id: Ib304712fa2b6b3fd02bfc1b08b6f238c771960c2
tests/phpunit/includes/StringUtilsTest.php:42:3
- avoid function calls in a FOR loop test part
tests/phpunit/includes/PathRouterTest.php:155 to 165
- fix space/tabs indenting
- convert double quotes to single for consistency
tests/phpunit/data/xmp/7.result.php
- reindent to use tabs instead of spaces
- removed trailing whitespaces
tests/phpunit/includes/filebackend/FileBackendTest.php
- spaces in indentation
Change-Id: I9c15803f961fc88b798ada3dd6c2b292c1de2143
Fix almost all occurences of the following sniffs:
Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
* This partially reverts b80bd6159b.
* Clarified 'headers' parameter documentation a bit.
* Added the "describe" function wrappers that the other ops have.
Change-Id: I7142fd4d973f5f3407d244a4cae793934083bc26
* Added a 'describe' file operation type to doOperations()/doQuickOperations().
This can be used by scripts to fill in headers like X-Content-Duration for
files that already exists.
* Removed wrong comments about removing headers (they don't get removed with null).
* Added some quick unit tests.
Change-Id: I43c5907b59421beaa9487eefac0cdbf8bc6c6d85
This is necessory to close all handlers on the directory and than it is
possible to rmdir the directory without a 'permission denied' on a
windows machine.
Corresponding unit test failure:
1) FileBackendTest::testRecursiveClean
Dir mwstore://localtesting/unittest-cont1/e/a no longer exists
(FSFileBackend).
Failed asserting that true matches expected false.
Change-Id: Ide58c6d0ec101bf0ddcd6b7414c51075fc28825b
* This can speed up certain video file operations for scripts that support
specifying source files via URLs and support HTTP Range headers.
* Updated unit tests.
Change-Id: I60cb95c2e3dd9f7df1f740e9182be7c79af69d6e