aboutsummaryrefslogtreecommitdiffstats
path: root/includes/StreamFile.php
Commit message (Collapse)AuthorAgeFilesLines
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-131/+0
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Replace deprecated MWExceptionDaimona Eaytoy2023-06-091-1/+0
| | | | | Bug: T328220 Change-Id: I66be7a6dd752d6b9c254beb65f4eb5ace3c89776
* Use name constants to access config settings.daniel2022-04-071-8/+10
| | | | | | | | | | | Use name constants instead of string literals in calls to Config::get and ServiceOptions::get, when referring to core configuration variables. This protects against typos and makes the decumentation and schema declaration of the config settings discoverable. This is the first batch, only touching files directly under /includes/ Change-Id: I7252e636c7c86d950d9257b33491af492c6dd5eb
* Add various null checks when null is not possible to use as argumentUmherirrender2022-03-141-1/+1
| | | | | | | | Also check for false if needed Found by phan strict checks Change-Id: I298204653dfb788515a87978dd8705b6e4f9c775
* Refactor global variables to use MediaWikiServices insteadTChin2022-01-101-9/+17
| | | | | | | | | | | | Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI. Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228 * This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it. A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
* Remove or replace usages of "sanity"Reedy2021-11-191-1/+1
| | | | | Bug: T254646 Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
* Rename four config variables to avoid 'blacklist' termReedy2021-09-081-4/+4
| | | | | | | | | | | | | | | As part of our wider work on modernising and making more welcoming the language we use within and around MediaWiki, now is a good time for us to rename these configuration variables: - $wgFileBlacklist is now $wgProhibitedFileExtensions - $wgMimeTypeBlacklist is now $wgMimeTypeExclusions - $wgEnableUserEmailBlacklist is now $wgEnableUserEmailMuteList - $wgShortPagesNamespaceBlacklist is now $wgShortPagesNamespaceExclusions Bug: T277987 Depends-On: I91e065c58fda144a722a41cf532e717f962d7a64 Change-Id: I558a8b20d67d48edccce0d065aec2d22992e9dda
* Use more neutral or alternative languageReedy2021-03-201-1/+1
| | | | | Bug: T277987 Change-Id: Iafc4b3e3137936046487119b7e17635f4e560277
* Remove deprecated StreamFile methodsDannyS7122020-11-221-27/+0
| | | | Change-Id: I066d3e322c6e6c7da315ea81ffa9530571e9e565
* mime: Update usage of MimeAnalyzer methodsOri Livneh2020-05-281-1/+1
| | | | | | | Follow-up to I93bd71ec1. Bug: T252228 Change-Id: I45c9fc592c9e41e0868e7d965206d4c04f4f92e1
* Fix numerous PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-121-2/+2
| | | | Change-Id: I157220c4e9ff516283a60f06af99efa2439332e3
* Streamline/fix code by using short ?: and ?? syntaxThiemo Kreuz2019-11-111-1/+1
| | | | Change-Id: I27dc0c8a1a184571ed96abdea22af953510457cd
* Merge "StreamFile: Deprecate ::parseRange() and ::send404Message() methods"jenkins-bot2019-09-141-0/+4
|\
| * StreamFile: Deprecate ::parseRange() and ::send404Message() methodsDerick Alangi2019-09-121-0/+4
| | | | | | | | | | | | | | StreamFile::parseRange() and StreamFile::send404Message() are now replaced by HTTPFileStreamer::parseRange() and HTTPFileStreamer::send404Message(). Change-Id: Id777211de42a225361ce068adaab64e3ddc03fdc
* | Merge "filebackend: Use HTTPFileStreamer::send404Message() in caller instead"jenkins-bot2019-09-131-0/+2
|\|
| * filebackend: Use HTTPFileStreamer::send404Message() in caller insteadDerick Alangi2019-09-121-0/+2
| | | | | | | | | | | | | | | | | | | | Replaced usage of StreamFile::STEAM_HEADLESS (now making it unused) by HTTPFileStreamer::STREAM_HEADLESS. Also, deprecated these unused constants. Searched around and found nothing and CS also says so too; https://codesearch.wmflabs.org/search/?q=StreamFile%3A%3A(STREAM_ALLOW_OB%7CSTREAM_HEADLESS)&i=nope&files=&repos= Change-Id: Ia3fc2cf072fa2fddb910c64a547d12cb243290d5
* | StreamFile: Merge duplicate switch cases 'jpg' and 'jpeg'Derick Alangi2019-09-121-1/+0
|/ | | | Change-Id: I51d233e80c4b0cebc269b54629582d4cf76e186f
* Replace MimeMagic::singleton() callsReedy2017-11-271-1/+1
| | | | Change-Id: Ieed41b5d6b0f568fe2872e7754f2feae7868fe7a
* Use short type bool/int in param documentationUmherirrender2017-08-201-3/+3
| | | | | | Enable the phpcs sniffs for this and used phpcbf Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
* Add HTTPFileStreamer classAaron Schulz2016-09-231-144/+13
| | | | | | | * Move most StreamFile code to this new class * Remove StreamFile depedency from FileBackendStore Change-Id: I4a272ef49497b589114fc2b37ba800bc26d9161f
* Added Range support to FileBackend::streamFile()Aaron Schulz2016-06-041-65/+143
| | | | | | | | | | | | | | | | | * 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-2/+2
| | | | | | | | | | 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
* Fix whitespace issues around parenthesesVivek Ghaisas2015-06-161-1/+1
| | | | | | | Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff. Bug: T102617 Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
* Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-2/+2
| | | | | | | | | | | | | | | 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
* Use HttpStatus::header instead of manually crafting header()Timo Tijhof2015-06-041-2/+2
| | | | | | | | Also: * Update wfHttpError() to use uppercase DOCTYPE, to match other code such as Html.php, wfThumbError(), HttpError.php, etc. Change-Id: I4027e7fe1a138b03f78797b6d1bfe7bd1064d360
* Removed remaining profile callsAaron Schulz2015-01-081-2/+0
| | | | Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
* Remove obvious function-level profilingChad Horohoe2015-01-071-3/+0
| | | | | | | | | | | Xhprof generates this data now. Custom profiling of various sub-function units are kept. Calls to profiler represented about 3% of page execution time on Special:BlankPage (1.5% in/out); after this change it's down to about 0.98% of page execution time. Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
* Make phpcs-strict pass on includes/ (3/~10)Siebrand Mazeland2014-05-111-4/+8
| | | | Change-Id: Ibf86d03b5479c47ee72c0dafea6777ef8178fe68
* Move closing parenthesis from multi line if and function to own lineumherirrender2013-12-011-2/+2
| | | | | | | | | | | The Line continuation Coding conventions prefers the closing parenthesis on the same line than the beginning curly braces. This is done for ifs and functions. Also move some boolean operator from the end of a line to the beginning and changed some indentation to make the condition hopefully better readable. Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
* Add missing wfProfileOut before throwing an exceptionumherirrender2013-04-081-0/+1
| | | | Change-Id: I1d830da0597f19efd0b2ae48642389975e736e23
* Fixed @param tags to conform with Doxygen format.Tyler Anthony Romeo2013-03-111-9/+9
| | | | | | | | | | | Doxygen expects parameter types to come before the parameter name in @param tags. Used a quick regex to switch everything around where possible. This only fixes cases where a primitve variable (or a primitive followed by other types) is the variable type. Other cases will need to be fixed manually. Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
* Update docs for return and exception infoSiebrand Mazeland2012-10-091-0/+1
| | | | | | | * Removed some inline tabs in the process. * IDE fixed some incorrect leading spaces, too. Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
* Fixed and normalized content-disposition for thumbs.Aaron Schulz2012-08-311-5/+0
| | | | | | * Previously, thumbnails could have a hex tmp file name as the disposition. Change-Id: I495860dc54c02d2b3e053e998a41674cd6d07f2f
* Added sanity check to StreamFile for mwstore paths.Aaron Schulz2012-08-221-2/+6
| | | | Change-Id: Id402f077037f3e84c9158f7d48be0ed82ba4a1cf
* Added missing GPLv2 headers in some places.Alexandre Emsenhuber2012-05-101-1/+20
| | | | | | Also made file/class documentation more consistent and removed a duplicate comment from SpecialPageFactory.php in SpecialPage.php. Change-Id: I99dd2de7fe461f2fad4e0bd315ebc2899958a90f
* More file streaming related profilingAaron Schulz2012-02-251-0/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/112381
* Added some StreamFile profilingAaron Schulz2012-02-251-3/+8
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/112378
* Fixing some of the "@return true" or "@return false", need to be "@return ↵Sam Reed2012-02-091-2/+2
| | | | | | | | | bool" and then the metadata can say true if foo, false if bar Other documentation improvements Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/111048
* In FileBackend:Aaron Schulz2012-01-251-3/+4
| | | | | | | | | | | | * Use 'b' param in some fopen() calls as needed for Windows and newline handling. * Removed some useless padding code in FileBackend::getContainerShard(). Initialized $m to make IDE happy. * Updated some code comments. In SwiftFileBackend: * Manually set the ETag when using php-cloudfiles for creating files to avoid https://github.com/rackspace/php-cloudfiles/issues/59. * Manually set the content type based on how StreamFile::getType(). This makes it safe to read files directly out of the proxy to end-users. The streamFile() backend functions already uses a similar content-type check. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/109980
* Improve documentation for content type choiceTim Starling2012-01-241-0/+4
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/109961
* * Fixed type check in StreamFile::prepareForStream() for 404sAaron Schulz2012-01-171-3/+3
| | | | | | | * Code comment tweaks and fixes Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/109106
* In FileBackend:Aaron Schulz2012-01-081-15/+45
| | | | | | | | | | | | | | | | | | * Added getFileSize()/getFileStat() functions. Refactored some functions to use the stat function for better reuse and caching/consistency. * Refactored streamFile() to allow for subclasses to avoid local file copying with less duplication. Also make last-modified check actually work since we always get the timestamp of the original file. * Renamed 'ignoreErrors' parameter to 'force'. In FileBackendMultiWrite: * Simplified how read ops are done (use 'master' backend for consistency). * Added consistency check to doOperationsInternal() to check if the files are synced. * Various fixes after testing. In StreamFile: * Split out prepareForStream() function from stream() in StreamFile for code reuse. In FileBackendTest: * Properly cover FileBackendMultiWrite in tests. * Various test improvements. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/108353
* Added a bit to StreamFile docsAaron Schulz2012-01-051-1/+4
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/108107
* StreamFile::StreamFile() tweaks:Aaron Schulz2011-11-201-18/+26
| | | | | | | | * Replaced unused $request param with $sendErrors to suppress sending error messages * Added boolean return value (success/failure) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103742
* Move wfStreamFile() into a class, update all callers in core (only 3 ↵Chad Horohoe2011-08-131-96/+99
| | | | | | | | | extensions use it afaict), leave wfStreamFile() as a b/c alias for now. Yay less global functions, autoloading and less manual require()s. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/94427
* Removed some error suppression operatorsAlexandre Emsenhuber2011-07-081-1/+3
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/91743
* And more documentation. YaaaaySam Reed2011-05-281-1/+4
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89047
* More documentation updates and additionsSam Reed2011-05-211-1/+5
| | | | | | | Getting bored of this tonight now I think... Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/88543
* Remove some unused variables and globalsSam Reed2010-11-281-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/77393
* Remove $wgContLanguageCode usage in core.Platonides2010-09-071-2/+2
| | | | | | | | | | | | | sed -i 's/$wgContLanguageCode/$wgLanguageCode/g' These are now the same, always. Per and since r15827. $wgLanguageCode wins due to being the one set by LocalSettings. $wgContLanguageCode definition at includes/Setup.php kept for now. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/72561