aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filebackend/FileBackendStore.php
Commit message (Collapse)AuthorAgeFilesLines
* Move FileBackendStore and FileOp classes to /libsAaron Schulz2016-09-231-1977/+0
| | | | Change-Id: If490f64bec282e5dfcdaf7feb1cbf46d3dce1064
* Remove wfDebugLog() dependency from FileOp classesAaron Schulz2016-09-231-1/+1
| | | | Change-Id: Ib8ab9edd1afdb28f7444f5e13cf34a696a066234
* Add HTTPFileStreamer classAaron Schulz2016-09-231-6/+11
| | | | | | | * Move most StreamFile code to this new class * Remove StreamFile depedency from FileBackendStore Change-Id: I4a272ef49497b589114fc2b37ba800bc26d9161f
* Dependency cleanups to FileBackendStoreAaron Schulz2016-09-231-46/+46
| | | | | | | | | | * Inject a PSR logger in place of wf* logging methods. * Replace wfTimestamp() call with ConvertableTimestamp. * Inject the Profiler object. * Rename $wiki => $domain to avoid "wiki" mentions. * Remove stray FSFile::extractImageSizeInfo() method. Change-Id: I3e3a43d36506bec341dc5727b52f5f5a5d32bff5
* Simplify and clean up FileBackend exceptionsAaron Schulz2016-09-221-3/+4
| | | | | | | | Use standard exceptions for unexpected errors and remove FileBackendException class, leaving FileBackendError. The later is actually intended to be caught in some cases. Change-Id: I735a525e0b14e518b2da5f18762e0f293064dfc2
* Make Status extend StatusValue and start FileBackend updateAaron Schulz2016-09-171-60/+60
| | | | | | | | | | | | | | * 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
* Documentation: Replace misuse of 'later' when we meant 'latter'James D. Forrester2016-09-071-1/+1
| | | | Change-Id: I01bfdb8e0bfaa132533732873f7c840cea7935eb
* Use WAN cache adaptiveTTL() method in FileBackendStoreAaron Schulz2016-09-021-2/+2
| | | | Change-Id: I2e8b4e85b12c8892e8640abc63ee13b4b170645d
* Added Range support to FileBackend::streamFile()Aaron Schulz2016-06-041-24/+24
| | | | | | | | | | | | | | | | | * 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
* Convert all array() syntax to []Kunal Mehta2016-02-171-72/+72
| | | | | | | | | | 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
* Replace wfBaseConvert with Wikimedia\base_convertReedy2015-11-241-1/+1
| | | | Change-Id: Iadab3d018c3559daf79be90edb23d131729bdb68
* Merge "Improve MIME detection in FileBackend"jenkins-bot2015-11-031-6/+14
|\
| * Improve MIME detection in FileBackendAaron Schulz2015-11-021-6/+14
| | | | | | | | | | | | | | | | | | 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 header case for FileBackend operationsAaron Schulz2015-10-271-8/+13
|/ | | | | | | | 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
* Minor fix to primeFileCache() commentAaron Schulz2015-10-231-1/+1
| | | | Change-Id: I7d040c5a914574df72fa31612df0eb28e15fd46c
* Prevent IDEA error in doOperationsInternal()Aaron Schulz2015-09-201-0/+1
| | | | Change-Id: I2f0a1885803fff9dc0eb8ca4a595a83736ce421b
* Cleaned up getScopedFileLocks() return valueAaron Schulz2015-09-181-1/+1
| | | | | | | | * Just return the ScopedLock itself without wrappig it in an array. This also makes getScopedLocksForOps() actually return the correct type according to the docs Change-Id: Ic2d01d56c3fcb22af3adb5e5d4d1586d62316552
* Allow "." in filebackend container prefixesAaron Schulz2015-06-261-11/+30
| | | | | | | | | | | * This character in $wgDBname seems to be common enough. The wiki ID is the default container prefix, and if it is not accepted, then confusing errors occur that block all file uploads. The case of dots is handled now. * Improved variable naming in resolveStoragePath(). Bug: T46066 Change-Id: I68458a876855894d01e8cf880bd6cfcfdae17bd0
* Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-4/+4
| | | | | | | | | | | | | | | wfSuppressWarnings() and wfRestoreWarnings() were split out into a separate library. All usages in core were replaced with the new functions, and the wf* global functions are marked as deprecated. Additionally, some uses of @ were replaced due to composer's autoloader being loaded even earlier. Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to mediawiki/vendor. Bug: T100923 Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* Converted FileBackendStore to using the WAN cacheAaron Schulz2015-04-301-20/+8
| | | | | Bug: T93141 Change-Id: I76efb0dc45a697c5fdfc50932e1198a6d663a445
* Merge "Fix and make PHPDoc tags in FileBackend more specific"jenkins-bot2015-03-181-4/+6
|\
| * Fix and make PHPDoc tags in FileBackend more specificThiemo Mättig2015-03-181-4/+6
| | | | | | | | | | | | A pure documentation patch. Should almost be a no-brainer. ;-) Change-Id: I9bf4d6056f7cde193fe5882a04a7973af9b5a7f4
* | Never treat persistent stat cache as "latest" in FileBackendAaron Schulz2015-02-101-4/+5
| | | | | | | | | | bug: T89184 Change-Id: I035c0f85a641efa0e4e3209b2bcf9847c08ab0d2
* | Removed remaining profile callsAaron Schulz2015-01-081-10/+0
| | | | | | | | Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
* | Converted some section profiling to scopedProfileInAaron Schulz2015-01-071-28/+28
|/ | | | Change-Id: If69de34a046f4f33fc57b93beaf264f522ce7386
* Fix some stuttering in comments and documentationRicordisamoa2014-12-171-1/+1
| | | | Change-Id: I9c0088b9aab37335203cad45a1d6fa8ac3f43321
* Cleanup some docs (includes/[e-l])umherirrender2014-07-241-1/+1
| | | | | | | | | | - 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
* Standardize @todoumherirrender2014-07-231-1/+1
| | | | | | | Always use lowercase @todo Changed some "@FIXME" to "@todo FIXME: " Change-Id: I016d1f9511e6f3bbd22427f0fffeccd77ab5e0db
* Fixed spacingumherirrender2014-07-201-1/+1
| | | | | | | | | | - use tab as indent instead of spaces - Added space after closures "function" - Added spaces around string_concat - Added newline inside empty blocks - Removed four spaces after comma Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
* filebackend: Avoid using popen() when "parallelize" is disabledAaron Schulz2014-06-181-0/+1
| | | | | Bug: 66467 Change-Id: Iaf8eb2ecfad166e26e265a98933399dc4bc255a3
* Improved FileBackend failure logging a bitAaron Schulz2014-05-221-2/+4
| | | | | | * This partly follows up on 2cfce9f Change-Id: I9d15f44d8000f52fd7b307d358c895452ee96a8d
* Merge "Make room for preloadFileStat() call in ↵jenkins-bot2014-04-211-0/+7
|\ | | | | | | FileBackend::doOperationsInternal"
| * Make room for preloadFileStat() call in FileBackend::doOperationsInternalAaron Schulz2014-04-181-0/+7
| | | | | | | | Change-Id: I60f71155abcf7f69423639b10ec301ac192df728
* | Merge "Bail out on FileBackend operations if the initial stat calls failed"jenkins-bot2014-04-211-5/+18
|\ \
| * | Bail out on FileBackend operations if the initial stat calls failedAaron Schulz2014-04-181-5/+18
| |/ | | | | | | | | | | | | | | | | | | | | * The preloadFileStat() call acts as a good canary for whether all affected servers are up. If anything failed in it, then it's not worth bothering to send the actual write requests. * Also made FileBackend::preloadFileStat abstract while at it since the two subclasses implemented it and so should any others. * Fixed a silly comment typo. Change-Id: I5bd427f654aa4a9d6bfe4ed7566276e8ac520b30
* | Fixed some @params documentation (includes/[file...|upload])umherirrender2014-04-191-6/+6
| | | | | | | | | | | | | | | | | | 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
* | docs: closure -> Closure; callback -> callableumherirrender2014-04-191-1/+1
|/ | | | | | | Changed closure to capital word Closure in doc and type hint, also changed callback in docs to callable Change-Id: I52c8e8f13d38a837052101c38b9986be780ca057
* Tweaked "latest" handling of filebackend stat entriesAaron Schulz2014-03-241-1/+16
| | | | | | | | * Let "latest" stat entries override non "latest" so that future getFileStat() calls with the "latest" flag can actually have a cache hit. Change-Id: I1e9391039537d608b89773b4d51575e3b364a751
* Make use of strong consistency with Ceph RGWAaron Schulz2014-03-191-2/+4
| | | | Change-Id: Ic3b764363e91c3279d3dc017ddce630dae26bec5
* Avoid key fragmentation in FileBackendAaron Schulz2014-02-241-2/+2
| | | | | | | | * Make sure that global backends do not prefix the cache keys with local wiki IDs for container and file stat entries. This causes fragmentation and breaks invalidation. Change-Id: Ic02d6e41f828dc82cc07c7d24c8af29c46392a9c
* Added concurrent HEAD request support for SwiftAaron Schulz2014-02-201-13/+71
| | | | | | | | | | | | * This adds a new preloadFileStat() method to FileBackend. * FileBackend::doOperations() makes use of this instead of primeFileCache(). The later was mostly useless due to the 'latest' flag, which stat entries rarely had (and since they use add(), 'latest' ones do not override the non-'latest' ones). * Simplified primeContainerCache/primeFileCache to no longer accept FileOp objects and made sure nothing passes those in anymore. Change-Id: Iee3878cadd69c3a594c701c0aff81aab5f473de5
* Update formattingSiebrand Mazeland2014-02-061-0/+4
| | | | Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
* Fixed bogus var usage in SwiftFileBackendAaron Schulz2014-01-091-1/+1
| | | | Change-Id: Ia0dec914208cb3100b7f5bbd2291985eac05dc02
* filebackend: Added supported for retrieving file metadata/headersAaron Schulz2014-01-081-2/+63
| | | | | | | * 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
* filebackend: exception handling cleanupsAaron Schulz2013-12-071-8/+9
| | | | | | * Split out FileBackendException class and reduced direct use of MWException Change-Id: I325c1798b6d90972c12a5dccc37989af34d857f3
* Update ternary notationSiebrand Mazeland2013-12-041-1/+1
| | | | Change-Id: I553dd1d42477326848e6e40b824058b6790e2eb5
* Remove unused local variableSiebrand Mazeland2013-11-251-1/+1
| | | | | | Just count if there are array members Change-Id: I4f9cc8ba554404796822317fdb285e2f560d01dd
* Update documentation of file backend classesSiebrand Mazeland2013-11-231-33/+53
| | | | Change-Id: I2113aecc53f1b361d9c276113bc0a9f7076cd21c
* Update formatting of file backend classesSiebrand Mazeland2013-11-221-4/+45
| | | | Change-Id: Ie69c324e2f1ea0b8a654adee06ebda494cebd10c
* Removed excess profile callsAaron Schulz2013-11-161-6/+0
| | | | Change-Id: Idd57e8d7fff56c62a66c7fcaf4627b9096f0c363