aboutsummaryrefslogtreecommitdiffstats
path: root/includes/WebStart.php
Commit message (Collapse)AuthorAgeFilesLines
* Add dark mode support to plain html outputsEbrahim Byagowi2024-06-091-1/+1
| | | | | | | | Nowadays files transferred to browser via text/* MIME are also getting automatic dark mode by the browsers so this makes these simple pages compatible with those features of the browsers. Change-Id: Id8360ff3ca6dbe7b78e30194fde292763479cb21
* Namespace includes/contextJames D. Forrester2024-02-081-2/+3
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* entrypoint: Restore doc grouping for MediaWikiEntryPointTimo Tijhof2024-01-051-8/+0
| | | | | | | | | | | | | | | Follows-up Ib70e4e67e4cb1. * This removed index.php from the "entrypoint" group, but did not add MediaWikiEntryPoint in its stead. * Fix broken `@see` reference, leading slash is not part of the identifier for the `@file` block index.php, only works without it. * Move the defgroup to a more natural place in the parent class' file. Bug: T354216 Change-Id: I1281e0934368884f4d1ffbbd3f5588b9a211356f
* Use ::class for class name resolutionUmherirrender2023-09-211-1/+1
| | | | Change-Id: Ic74a3d317c9d36509a50c658e52fad65026e7ac7
* Reorg: Move NoLocalSettings to Output/Amir Sarabadani2023-09-061-1/+1
| | | | | | | | It's not a class, so it doesn't need alias and only in one place directly called (WebStart) which the path got fixed. Bug: T321882 Change-Id: I415eed06d228f10a87b4900534cbc676b7d615b5
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-051-1/+1
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* WebStart: Document output buffering in wfWebStartSetup()Aaron Schulz2023-03-101-2/+8
| | | | Change-Id: I012a14642ef024de698d318520710b410011c9ef
* Setup.php: Remove internal use of $IPTimo Tijhof2022-05-131-8/+4
| | | | | | Follows-up bedd996fe6 (I157abfd9049fb838). Change-Id: Ib7a7e26f564ca996f1de3edd37b2359c5abec9d2
* Setup.php: clarify the use of $IP.daniel2022-05-031-7/+4
| | | | | | | The global variable $IP has been replaced by the MW_INSTALL_PATH constant. Clarify the continued use of $IP on Setup.php. Change-Id: I157abfd9049fb8382da53005a084ab86f47e8d8a
* Define MW_INSTALL_PATH constant and BaseDirectory config.daniel2022-03-041-2/+1
| | | | | | | | | | | Application logic should use the BaseDirectory config variable. Framework code should use MW_INSTALL_PATH to locate files should. NOTE: Update https://www.mediawiki.org/wiki/Manual:$IP Bug: T300301 Depends-On: I7142af16d692f26e90673b058029f572c1ea3991 Change-Id: Ib4caa80bb7007c4c7960a2fd370cf5da7d9ba344
* Pass SettingsBuilder into config callbacks.daniel2022-02-211-1/+3
| | | | | | | | | We are already passing SettingsBuilder into callbacks registered with MW_SETUP_CALLBACK. Do the same for MW_CONFIG_CALLBACK. This will allow us to avoid messing with global variabls in more places. Bug: T294739 Change-Id: Ic6296907139912351b53dc80672ef950c0aefeb3
* Allow main settings file to be selected via env variable.daniel2022-02-061-3/+3
| | | | | | | | | | | | | | This allows a file other than LocalSettings.php to be used as the primary settings file by setting the MW_CONFIG_FILE environment variable. This also allows the primary settings file to use YAML or JSON format. Using static configuration files should be the default in the future. However, YAML files in the document root could easily be exposed to the public. Better not to encourage that, and require them to be enabled explicitly and loaded from a different place. Bug: T294750 Change-Id: I7747f83481cb05a6d05f819be652259951183819
* Reapply "SettingsBuilder: allow maintenance scripts to manipulate config"Ppchelko2022-01-261-1/+3
| | | | | | | | | | This reverts commit 4f7a4a2477ceeac68011d8f550a30d005c78dfdf. Reason for revert: This change is good, just need some preparation in extensions. Depends-On: I24221be2cedfa132fc94d39d72e4a133cc3cdb12 Depends-On: I5e6119b650e581c6aa5a1132aa071b49cff8b8ca Change-Id: I5a5a9000751fa3914c9d432eb49475091b3bdb80
* Revert "SettingsBuilder: allow maintenance scripts to manipulate config"Ppchelko2022-01-261-3/+1
| | | | | | | | This reverts commit a652f306a542c0efdfa0bef33cd68c8f6587e0bc. Reason for revert: need to prepare extensions first Change-Id: Iccedf38a8dc964db7c49fd51c971912655122081
* SettingsBuilder: allow maintenance scripts to manipulate configdaniel2022-01-261-1/+3
| | | | | | | | | | | Maintenance scripts often need to manipulate configuration settings. This introduces a way to do this cleanly via SettingsBuilder, removing the need to rely on global variables. Bug: T294739 Bug: T294742 Bug: T300128 Change-Id: Ibf443fd564bbbf388cce8ab4dabba55ebca0dfa4
* Using @return never documentation on always-throw-functionUmherirrender2021-09-071-0/+3
| | | | | | | | | | This helps phan to detect unreachable code and also impossible types after the functions. It helps phan to avoid false positives for array keys when the keys are checked before Bug: T240141 Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
* Merge "WebStart: Avoid conditionally declared functions in this file"jenkins-bot2021-03-121-19/+17
|\
| * WebStart: Avoid conditionally declared functions in this fileFlorian2021-03-121-19/+17
| | | | | | | | | | | | | | | | Defining functions conditionally seems to break preloading functionality, as the function is tried to be redeclared. Bug: T240775 Change-Id: I7d1df9f13927f0a7af33f9ee955b0ed8dc47a359
* | MWLBFactory: rename magic HTTP header for opting out of sqlite write lockC. Scott Ananian2021-02-041-1/+1
|/ | | | | | | | | | | It was suggested this header be renamed to be consistent with the infrastructure header added in T91820. We have to explicitly allow the REST API to use this header in the WebStart sanity check. Bug: T91820 Bug: T259685 Followup-To: b75ac3953e750fd6b1b29868a77dbebd7969fbdc Change-Id: I0c4ec63bb26641b237c92dbd3bc5367811ca0675
* Setup: Move simple shortcuts together in Setup.php and improve docsTimo Tijhof2020-03-141-5/+5
| | | | | | | I've moved the simple config expansions that don't depend on anything else in Setup.php together, more compactly. Change-Id: Iefb7f8ffdca70bcfbf7cbf49f7939747c5ab0d76
* docs: Improve "Entry points" documentation pageTimo Tijhof2020-02-041-0/+8
| | | | | | | | | | | | Turn this into a doc group, and let the descriptions come directly from the files in question. This makes the list easier to maintain, and alsom means that the overview page becomes discoverable whenever one is looking at the entry point file as well. Previously the doc page pointed to the entry points, but not the other way around. This is also fixed. Bug: T244294 Change-Id: I891c5a37e17592edc1136d7367949927121c8bc8
* WebStart: Avoid DB or uselang for nonwrite-api-promise-error messageTimo Tijhof2019-08-251-4/+7
| | | | | | | | Make the code easier to reason about by not involving global state from LBFactory, RequestContext, SessionManager, and User. Bug: T189966 Change-Id: I88d2bf58ebd481009ce295335d730a34dbb277fb
* Remove "Squiz.WhiteSpace.FunctionSpacing" from phpcs exclusionsReedy2019-05-111-0/+4
| | | | Change-Id: I78b3315f26ab91b6b443f5b028a635552f82f5a3
* Merge "Setup: Move mbstring.func_overload from WebStart to Setup"jenkins-bot2018-04-181-4/+0
|\
| * Setup: Move mbstring.func_overload from WebStart to SetupTimo Tijhof2018-04-171-4/+0
| | | | | | | | | | | | | | | | | | | | Follows-up 26c2d03c17, 41d1fa1c3a and r11547 (c7f363f886). Also add references to the relevant tasks about why the check exists. Bug: T189966 Change-Id: Ic1f0c79a1b5638bb30351a0cab55699931d1fded
* | WebStart: Remove deprecated $wgRequestTimeTimo Tijhof2018-04-171-7/+0
|/ | | | | | | | | This variable is not read anywhere in Wikimedia Git. Follows-up 06ba5ca383e2. Bug: T189966 Change-Id: Ib86ebc44b12fee3a986838c5a302540b97066e5a
* WebStart: Remove redundant unset() for $IPTimo Tijhof2018-04-171-2/+0
| | | | | | | | | | | | | This seems redundant given it is unconditionally being set two statements later. Probably a left-over from r36353 (c6b902f180), which did an unset() because there was another variable called $preIP, and the original would no longer be needed. However, we currently only use one variable ($IP) and there's no need to unset() it before setting. Bug: T189966 Change-Id: I17d516709beabeb80bd72b37f70ac9b666a501d4
* Convert OutputHandler functions to a classTimo Tijhof2018-03-201-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * Convert OutputHandler.php from global functions to a class. - wfOutputHandler → OutputHandler::handle (no alias, no usage outside core) - wfGzipHandler → OutputHandler::handleGzip (private, no usage outside class) - wfRequestExtension → OutputHandler::findUriExtension (private, no usage outside class) - wfMangleFlashPolicy → OutputHandler::mangleFlashPolicy (private, no usage outside class) - wfDoContentLength → OutputHandler::emitContentLength (private, no usage outside class) - wfHtmlValidationHandler → OutputHandler::validateAllHtml (private, no usage outside class) * Add the class to autoload.php for exposure outside WebStart. Specifically, for use in ApiFormatPhpTest. This also removes the need to manually load the class because this code runs after Setup.php loads AutoLoader.php. Bug: T189966 Change-Id: I27a41ec0ae0ee30aeb313a616323b967605c4055
* WebStart: Remove use of realpath() for $IPTimo Tijhof2017-11-291-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When installing MediaWiki in a sub directory of document root, and including it from an /index.php file in the document root, MediaWiki succesfully includes WebStart from index.php, but WebStart.php fails to include Setup.php. For example, MediaWiki installation at /var/www/mediawiki with the following file at /var/www/index.php. ``` <?php require __DIR__ . '/mediawiki/index.php'; ``` Failure: > Fatal error: > require_once(): Failed opening required '/var/www/includes/Setup.php' > (include_path='.:/usr/local/lib/php') in > /var/www/mediawiki/includes/WebStart.php on line 97 > > Stack trace: > 1. {main}() /var/www/index.php:0 > 2. require() /var/www/index.php:3 > 3. require() /var/www/mediawiki/index.php:40 Bug: T153882 Change-Id: Icd8cfa580ce1c22bc3bf177570a9f4a940d2427c
* Setup: Merge PreConfigSetup into Setup.phpTimo Tijhof2017-10-241-43/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up 41ea7e2fefff65. The following previously happened between PreConfigSetup and Setup and must now happen either before it, after it, or moved inside it. * WebStart: Detect missing composer. This must be after Autoloader/Vendor but before the first call to wfDebugLog (or other loggers) so that we can output a more descriptive error instead of a generic "Unknown class" fatal error. Moving it to before Setup is too early, and after is too late. Move it to within Setup.php and make it work in CLI mode. * WebStart: Install header callback Moving it to before Setup is too early, and after is too late. Move it to within Setup.php (no-op in CLI mode). * WebStart/Maintenance: Load LocalSetings. Must be between PreConfigSetup and Setup. Move to Setup.php to maintain execution order. Utilise MW_CONFIG_File for custom handling in Maintenance.php. * WebStart: Initialise output buffering Utilise (new) MW_SETUP_CALLBACK hook. * WebStart: Display NoLocalSettings.php Utilise MW_CONFIG_CALLBACK hook. * Maintenance: Setting $wgLocalisationCacheConf, calling Maintenance::finalSetup. Utilise (new) MW_SETUP_CALLBACK hook. Change-Id: I633a6ff235b4275391c48034c0525d2fbfa3fecd
* Split common pre-setup code out of WebStart/doMaintenanceTim Starling2017-08-231-25/+1
| | | | | | | | | | | Introduce PreConfigSetup.php, which is common file-scope code run before LocalSettings.php. I'm not maintaining autoload.ide.php since it supports closed source software which I don't have, and it apparently needs significant work to make it not be weird and hacky. Change-Id: I44ac69b6b00a51d015546b9766d89d1c59749334
* WebStart.php: Update the file's doc commentKevin Israel2017-05-261-5/+4
| | | | | | | | The doc comment did not reflect the removal of MW_NO_SETUP in edc9edbc769b570c, or the fact that Setup.php no longer loads AutoLoader.php or GlobalFunctions.php. Change-Id: I19a12fd83e369828b9e08176ddf3bfca16aae465
* Merge "includes: Replace implicit Bugzilla bug numbers with Phab ones"jenkins-bot2017-02-281-1/+1
|\
| * includes: Replace implicit Bugzilla bug numbers with Phab onesJames D. Forrester2017-02-211-1/+1
| | | | | | | | | | | | | | It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345" except where it doesn't, so let's just standardise on the real numbers. Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
* | Log a backtrace from the culprit location if headers were already sentTim Starling2017-02-231-0/+3
|/ | | | | | | | Install the backtrace collector very early, so that we can get the backtrace even if headers were sent from LocalSettings.php. Bug: T157392 Change-Id: I9bc732b34481c95afb5362e135a87bd4302498e2
* Remove check for MW_NO_SETUPChad Horohoe2017-01-121-3/+1
| | | | | | | | | | | | | | | This protection is in place for a single extension, Maintenance. Said extension is probably broken anyway and has been for quite some time. Plus, it doesn't even really work like it would intend, the extension uses special pages and this is a require_once, so a subsequent request to WebStart.php (which isn't even called by extensions) wouldn't re-require it. tldr: This is pointless Change-Id: I22e7418d2b46c00d4009c370c24ac4b8bc43190a
* Fix various phpcs error from last security patchesumherirrender2016-05-201-1/+1
| | | | | | | | | Found by tests: https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-trusty/1069/console Breaking merges Change-Id: If01b94705cd7b939ac380053730b1b602c838a8e
* SECURITY: Check for mbstring.func_overload at runtimeBrad Jorsch2016-05-201-0/+4
| | | | | | | | | | The installer already checks for this, let's also catch the case when someone enables this after installation. Bug: T122807 Change-Id: Ieddbc932f482d52da1688d472f494074c81124b2 Signed-off-by: Chad Horohoe <chadh@wikimedia.org>
* build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"Kunal Mehta2016-02-171-1/+0
| | | | | | | | | | * Fix errors spotted by new release * Introduce "composer fix", which uses phpcbf to automatically fix some errors spotted by phpcs. * Drop $PHPCS_ARGS variable that didn't work on Windows, and add -s flag * Remove rules from phpcs.xml that are now in MW-CS ruleset. Change-Id: I13e2155695918c918b67497ac65b85a03897095e
* Convert all array() syntax to []Kunal Mehta2016-02-171-1/+1
| | | | | | | | | | 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
* Remove REQUEST_TIME_FLOAT hack for old PHPMax Semenik2016-02-111-5/+0
| | | | Change-Id: Id11f4f479d5225d92e38b2ae83b25315591b73d6
* Remove register_globals and magic_quotes_* checksMax Semenik2016-02-111-13/+0
| | | | | | Yay, this crap is finally gone as of PHP 5.4! Change-Id: I2cb01b5bf0fdde4c8cf5286ef6aff93ac45e99fd
* Remove various double empty newlinesumherirrender2015-12-271-3/+0
| | | | | | | The double empty newline is not needed between functions, variable or at end of file Change-Id: Ib866a95084c4601ac150a2b402cfa184ebc18afa
* Fix HHVM RepoAuthorative mode againReedy2015-12-141-2/+5
| | | | Change-Id: I0fe75797ebe1c8c22be603a62102bd25bce29f49
* Move PSR-3 support check right after autoloader setupGergő Tisza2015-12-131-0/+15
| | | | | | | | | This ensures that, in case "composer install" has not been run, the user will see the error message about setting up dependencies (as opposed a plain "Class not found" error because some other dependency was used first). Change-Id: Ib6026123770d21cc9f8960a1de361c8178b1b044
* Add header to flag API POST requests with no write intentionsAaron Schulz2015-11-061-0/+22
| | | | | | | | | | | | | | | This performs sanity check that request *is* for a non-write module. By handling the validation, the CDN layer can simply use the presence of this header to route POST requests to the local datacenter. Without validation, users could cause strange traffic patterns and slow cross-DC database writes (which can involve many RTTs). This is useful for AJAX widgets that need to post a payload to get a response, but that don't actually change anything in the process. They should be able to use the local datacenter. Bug: T91820 Change-Id: I34248ddee33033e3d1d86c3391236259d917d4a7
* WebStart.php: Make lines shorter to make phpcs happierAmir E. Aharoni2015-09-261-4/+4
| | | | Change-Id: Ifbcf572a08837e9572cc4ed9bd274d4e5ad676ab
* Fix some space-related phpcs warnings in includes/Ricordisamoa2015-08-151-1/+1
| | | | Change-Id: I7cf7206696a5e77bc02e3630d1d88d4c176ea844
* Try to make POSTs as transactional as possibleAaron Schulz2015-08-121-0/+5
| | | | | | | | | | | * WMF has has ignore_user_abort() for *all* request in configuration for many years. This brings this to default MediaWiki for all POST requests, which are likely to do writes. Of course, some do not, notably parse requests and previews, since GET cannot carry the payload. Avoiding data corruption is more important though. Bug: T102890 Change-Id: I11c8b0d99583a682f756cef9747ec5ba9751c5e3
* Remove $wgRUstart, unusedChad Horohoe2015-04-161-1/+0
| | | | Change-Id: Ia57f8fb2da4eed6b185ea0592d521e3119411f0e