aboutsummaryrefslogtreecommitdiffstats
path: root/load.php
Commit message (Collapse)AuthorAgeFilesLines
* ResourceLoader: Follow-up creation of ResourceLoaderEntryPointTimo Tijhof2024-02-221-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows-up Iadea44b7867f48a2be6ccbf00c0e56911a5af74e. ResourceLoaderEntryPoint: * Rename from Resource to ResourceLoader, as it is the entry point for ResourceLoader. * Fix accidental use of ingroup on the file docblock instead of the class. https://phabricator.wikimedia.org/F42046908 * Fix broken "see" reference to "/load.php" on the ResourceEntryPoint class on doc.wikimedia.org. Files are indexed in Doxygen by full name without leading slash. * Remove load.php from docgroup, akin to index.php. tests: * Remove unrelated Rest namespace from test suite. * Remove redundant default values in newResourceLoader(), especially null values were confusing by showing an apparent intent to set a value without actually isplacing the default, given that isset/?? treat set null as not set. * Simplify test by using the built-in startup module instead. EntryPoint: * Remove comment in test about doPostOutputShutdown. It sounded like it was explaining that we use getCapturedOutput() instead of run() because the latter calls doPostOutputShutdown which we want to avoid. Except, we don't avoid it, since run() is called and does call doPostOutputShutdown. Unclear what it was explaining. * Improve docs around getCapturedOutput() in the base class, and make explicit that this seemingly unused complexity exists for the purpose of testing. Bug: T354216 Change-Id: I5139fda90a3d5ac7ea1ed917c8045d1a09961d78
* Namespace includes/contextJames D. Forrester2024-02-081-0/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* ResourceLoader: Factor out ResourceEntryPoint from load.phpdaniel2024-02-021-27/+10
| | | | | | | | The idea is that all entry points should share the code in the MediaWikiEntryPoint base class. This change by itself doesn't achieve much, it should be followed up by a change moving request handling logic from ResourceLoader into ResourceEntryPoint. Bug: T354216 Change-Id: Iadea44b7867f48a2be6ccbf00c0e56911a5af74e
* Centralize logic behind building ChronologyProtector objectAmir Sarabadani2023-08-301-1/+1
| | | | | | | | | | | | | | | | | Building blocks of CP don't really need to depend on LBF. Even the config value for CP stash type is also different. But it's being passed around along the rest of LB/LBF config and possibly down to the DB object. This is making the code much harder to understand, adds more coupling than it needs to, and it's making pieces that don't need to rely on LFB (like load.php) actually depend on LBF just to disable CP. This clean up also helps improving DI of LB/LBF and building of DB objects down the road. Bug: T275713 Change-Id: Ic27269a1f1190ee7a03c6a422ada7ff293c3cab1
* resourceloader: Minor doc changes following PSR-4 namepace changeTimo Tijhof2022-05-291-2/+2
| | | | | | Follows Id08a220e1d60 (after I92998ae6a82e). Change-Id: I33d20201bfee4595baa39c01eaf8b7de6034a8ed
* ResourceLoader namespace (attempt 2)Tim Starling2022-05-241-1/+2
| | | | | | | | | | | | | | | | | | Move ResourceLoader classes to their own namespace. Strip the "ResourceLoader" prefix from all except ResourceLoader itself. Move the tests by analogy. I used a namespace alias "RL" in some callers since RL\Module is less ambiguous at the call site than just "Module". I did not address DependencyStore which continues to have a non-standard location and namespace. Revert of a241d83e0a6dabedf. Bug: T308718 Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
* Revert "ResourceLoader namespace"Lucas Werkmeister (WMDE)2022-05-161-1/+0
| | | | | | | | | | | | This reverts commit e08ea8ccb9932f9924a613056afcb2d01c8c7b39. Reason for revert: Breaks Phan in extensions, and as far as I’m aware, this change isn’t urgently needed for anything, so the simplest fix is to revert it again for now. After PHP 7.4 it should be safer to try this again (we hopefully won’t need the two “hack” classes by then). Bug: T308443 Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
* ResourceLoader namespaceTim Starling2022-05-161-0/+1
| | | | | | | | | | | | | | | | Move ResourceLoader classes to their own namespace. Strip the "ResourceLoader" prefix from all except ResourceLoader and ResourceLoaderContext. Move the tests by analogy. I used a namespace alias "RL" in some callers since RL\Module is less ambiguous at the call site than just "Module". I did not address DependencyStore which continues to have a non-standard location and namespace. Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
* resourceloader: Avoid repeatly calls to getter functionsUmherirrender2021-09-261-4/+6
| | | | | | Use local variable instead Change-Id: If90f510558a138b2294a57c7bbb9dc53ea355f9c
* Reapply Content-Length deferred updates patchesTim Starling2021-04-081-0/+2
| | | | | | | | | | | | | | | * Revert "Disable DEFER_SET_LENGTH_AND_FLUSH headers to avoid HTTP errors" * Reapply "Avoid HTTP protocol errors when fastcgi_finish_request() is unavailable" * Reapply "Move logDataPageOutputOnly() call to outputResponsePayload()" This reverts commit 0393ddbb2a08a4d278b1d0ef65b1f4c391d769b5. This reverts commit 89065a22aac744363dc528f73423a2f37d73ce14. This reverts commit e70757f58b9a3252882f3d3b516f23cd7c61430e. Change-Id: I8a362a80bb1aa147192218a37df34aadba34fb2e
* Revert "Move logDataPageOutputOnly() call to outputResponsePayload()"Reedy2021-04-021-2/+0
| | | | | | | This reverts commit d32c481a648d909f73fc28a1e5d694b0a09b0b7e. Bug: T278579 Change-Id: Ic66827d9ced6aff652962f4b97f6ad0cfd398e4f
* Move logDataPageOutputOnly() call to outputResponsePayload()Aaron Schulz2021-03-291-0/+2
| | | | | | | | | | | | | Trap the extra profiling output via a buffer and append it to the payload string parameter. This way, the Content-Length will be set correctly with the text profiler. Update other entry points to call logDataPageOutputOnly(). Follow-up to f4f0ad970e08d. Bug: T235554 Change-Id: I4915d1096801a063d493443a3606fd3851e771a6
* docs: Improve entry point documentationTimo Tijhof2020-07-021-2/+2
| | | | | | | | | | | | * Unlink the word "Action" in api.php description, which was unhelpfully being autolinked to the index.php Action baseclass. * Add links in the first sentence to the primary classes involved in their handling so that the "Entry points" overview page includes these links (subsequent sentence/paragraphs require an additional click). Change-Id: Ibe882746ea7753d5d4c90a04f6974ea807122d1c
* In Web entry points, move file scope code into a main functionTim Starling2020-06-251-10/+16
| | | | | | | | | | Avoid leaking local variables into the global scope by accident, by moving the entry point code to a function. In index.php, document the intentional $mediaWiki global so that nobody removes it by accident. Change-Id: Ie1a181ae3ebdda90cd2321f0c1b50e31fb0d586e
* docs: Improve "Entry points" documentation pageTimo Tijhof2020-02-041-1/+4
| | | | | | | | | | | | 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
* Remove IE 6 security features from server-side codeTim Starling2019-11-281-5/+0
| | | | | | | | | | | | | | * Deprecate WebRequest::checkUrlExtension() and have it always return true. This reverts the security fixes made for T30235. * Remove IEUrlExtension. This is a helper for checkUrlExtension() which is not used in any extensions. * Remove CSS sanitization code which is specific to IE6. This reverts the changes made to fix T57332, and related followups. I confirmed that the relevant test cases do not result in XSS on IE8. * Remove related tests. Bug: T232563 Change-Id: I7318ea4a63210252ebc64968691d4f62d79a63e9
* Avoid using "enqueue" mode for deferred updates in doPostOutputShutdownAaron Schulz2019-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Set appropriate headers and flush the output as needed to avoid blocking the client on post-send updates for the stock apache2 server scenario. Several cases have bits of header logic to avoid delay: a) basic GET/POST requests that succeed (e.g. HTTP 2XX) b) requests that fail with errors (e.g. HTTP 500) c) If-Modified-Since requests (e.g. HTTP 304) d) HEAD requests This last two still block on deferred updates, so schedulePostSendJobs() does not trigger on them as a form of mitigation. Slow deferred updates should only trigger on POST anyway (inline and redirect responses are OK), so this should not be much of a problem. Deprecate triggerJobs() and implement post-send job runs as a deferred. This makes it easy to check for the existence of post-send updates by calling DeferredUpdates::pendingUpdatesCount() after the pre-send stage. Also, avoid running jobs on requests that had exceptions. Relatedly, remove $mode option from restInPeace() and doPostOutputShutdown() Only one caller was using the non-default options. Bug: T206283 Change-Id: I2dd2b71f1ced0f4ef8b16ff41ffb23bb5b4c7028
* Add MW_REST_API and MW_ENTRY_POINTTim Starling2019-09-031-0/+2
| | | | | | | | | | | | | Define the global constant MW_REST_API in rest.php, by analogy with MW_API. Also generalize this by adding MW_ENTRY_POINT, which contains the entry script name, "cli" or "unknown". This allows tests such as if ( MW_ENTRY_POINT !== 'index' ) which is probably what is really intended by defined('MW_API') in many cases. Change-Id: I24099f4cdd170de17afd6e1bbad67c9b204071fc
* profiler: Centralise output responsibility from ProfilerOutputText to ProfilerTimo Tijhof2019-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | Make it Profiler.php's responsibility to enforce this, based on the existing signal from ProfilerOutput::logsToOutput(). The ProfilerOutputText class should not have to double-check this a second time. Long-term, I'd like even this check in Profiler::logDataPageOutputOnly to be removed, because really the external caller of that should know whether it is safe to output stuff or not rather than stashing its own state inside Profiler::$allowOutput and then implicitly reading it back out again later on. But, that's for another time. Also: * Remove use of deprecated Profiler::setTemplated while at it. * Make 'visible' parameter explicit, as for other parameters. Change-Id: Iaa3fc4ea25a059b90235d769db60c04b8f152f05
* resourceloader: Instantiate main class via ServiceWiringTimo Tijhof2019-02-181-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | It also removes some code duplication which is nice. This unlocks various future changes, including: * Making the `$config` parameter mandatory for the ResourceLoader class constructor, which currently falls back to global state. This should be deprecated and removed. * Making it possible to instantiate the ResourceLoader class without all the default MW modules being registered from global state. E.g. move MW module registration from main class constructor to ServiceWiring, and remove the 'EmptyResourceLoader' class hack from unit tests, and use regular 'new ResourceLoader' instead. * Making ResourceLoader a standalone library (some day), e.g. allowing it to be instantiated from a basic PHP script, in a way that is still useful and perhaps able to serve (most) RL modules without MW itself. Bug: T32956 Change-Id: I4939f296c705b268e9cf8de635e923a739410470
* resourceloader: Disable ChronologyProtector on load.php (again)Timo Tijhof2018-04-201-5/+3
| | | | | | | | | | | | | | This was already disabled in 2016 with 98c6743413118f by calling setRequestInfo() to override the default 'ChronologyProtection' value from Setup.php. This stopped working since 4ccb228bde9294d96d which made getDBLoadBalancerFactory (in ServiceWiring) obtains a LoadBalancer from MWLBFactory::setSchemaAliases, and requestInfo is not re-evaluated after that. Bug: T192611 Change-Id: I68748e8f15bcd7bfa8d7921964788e2798682e05
* resourceloader: Disable ChronologyProtector to speed up wfGetLB()Timo Tijhof2016-09-281-0/+7
| | | | | | | | For load.php requests, Xenon in Wikimedia production measures that half the time for wfGetLB() is spent in ChronologyProtector::initPositions, and its query to Memcached. Change-Id: I24f90897e56fd679c6bd1acf764722ed58e51c67
* Enforce load.php's no-session constraintBrad Jorsch2016-04-181-3/+2
| | | | | | | | Attempts to use session data via this endpoint will now cause exceptions to be thrown. Bug: T127233 Change-Id: Id83eda9564314bb4e11368aa395127f349b2cff4
* resourceloader: Create ResourceLoaderContext::msg() methodTimo Tijhof2016-03-111-2/+5
| | | | | | | | | | | | | | | This makes it easier to fetch messages without having to manually call inLanguage() on each wfMessage() call, which is currently causing some code forget this and use plain wfMessage() which defaults to MediaWiki user language from session. I've considered setting $wgLang or RequestContext::getMain(), but that's still bad since modules get passed a context in their methods and shouldn't be using global context either. The warnings provided by MW_NO_SESSION are exactly what we want. Change-Id: I1288fa5622d9f82d21bb66c8eb6518b90e7cddb4
* Log violations of load.php's no-session constraintBrad Jorsch2016-03-071-0/+5
| | | | | Bug: T127233 Change-Id: I3d9538b36f707ed69c2d163ccf1f807af4b02fc0
* resourceloader: Remove PHP4-compat codeTimo Tijhof2016-02-251-4/+2
| | | | | | No longer relevant per 3df53167a2. Change-Id: I23b82fd699f7f61eba5d1828f5007d398cf7b159
* Remove various double empty newlinesumherirrender2015-12-271-1/+0
| | | | | | | The double empty newline is not needed between functions, variable or at end of file Change-Id: Ib866a95084c4601ac150a2b402cfa184ebc18afa
* Remove PHP detection from entry points other than index.phpTimo Tijhof2015-11-121-5/+0
| | | | | | | | | | | | | | | | | | The following entry points already didn't have it: * opensearch.php * thumb.php * thumb_handlers.php Now removed from api.php and load.php as well. The check was broken because these entry points use the 'use' keyword for PHP namespaces, which results in a syntax error on PHP < 5.3. The check remains in index.php, mw-config/index.php, and Maintenance (for e.g. install.php). Bug: T112942 Change-Id: I9026d69ddfb3e02612256b4a9df525c432bb33c6
* resourceloader: Consistently refer to the framework as ResourceLoaderTimo Tijhof2015-10-281-1/+1
| | | | Change-Id: Ia59e4eac9662723e80d62f7cfcb9e4292e3ee4de
* resourceloader: Make ResourceLoader logger awareTimo Tijhof2015-06-041-1/+6
| | | | Change-Id: Ifa197cce1906bc0530dfa873dfde91abbe540637
* Refactored entry points to have uniform shutdown handlingAaron Schulz2015-05-291-6/+2
| | | | | | | | | | | | * Added doPreOutputCommit() and doPostOutputShutdown(), which most entry points just using the later * Also fixed problem where text profiling did not show up * Avoid calling triggerJobs() in the file streaming entry points Bug: T100127 Bug: T100085 Change-Id: Ibc7e768fd483389a01847f08cdeba4058c853d3f
* Check for dependencies in entry point and Maintenance.phpaude2015-05-231-6/+4
| | | | | | | | | | | | | | | | | | | | | | | This way, if someone tries to install MediaWiki via either web installer or install.php maintenance script, after obtaining from git, they get some useful information on what to do. Put the checks alongside the php version check, as stuff installed via composer (mustache / lightncandy) is used for NoLocalSettings.php and install.php attempts to use logging stuff. Also tried to make PHPVersionError look slightly nicer, with some <h2> elements and more padding for the <p> elements. and centralized this code in one place, as much as possible, for improved ease of maintenance. Bug: T90438 Bug: T88951 Change-Id: Iae4eb42c4266dbe9213c5de8a96fccfbeaa9acb0
* Flush lazy jobs in load.php and api.php tooAaron Schulz2015-05-201-0/+2
| | | | | | | | * A more proper solution will have one method for all this stuff Bug: T99775 Bug: T99849 Change-Id: I16a32b260386a85504eb85ea58f1156b4e581a83
* Made text profiling actually work with load.phpAaron Schulz2015-03-311-0/+1
| | | | Change-Id: I8d28ad8669e8c2f5d7025fe67fb75d0551975e07
* Removed remaining profile callsAaron Schulz2015-01-081-2/+0
| | | | Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
* Make load.php parse in PHP 4 againBartosz Dziewoński2014-11-041-6/+5
| | | | | | Not sure what for, but if it "needs" to parse, then let's make it parse… Change-Id: I28ec3b3a86f6eb90e3341f967649fb4c910966d7
* Require PHP >= 5.3.3Kunal Mehta2014-10-301-1/+1
| | | | | Bug: T839 Change-Id: Iac827ef8505ff0653a40e45d759b0f79619351ee
* resourceloader: Pass a Config to the ResourceLoader constructorKunal Mehta2014-09-051-1/+3
| | | | | | Instead of relying on the default being main, which is deprecated. Change-Id: I200e2c2dc922ae1fa5fa68d449403d0287e41786
* Use PHP_VERSION constant instead of phpversion() function callChad Horohoe2014-07-091-1/+1
| | | | Change-Id: Ifb3d1bd92d6abaa561e7337b311b4cb10c38a2b6
* phpcs: More require/include is not a functionTimo Tijhof2013-05-211-2/+2
| | | | | | | | | | | | | Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81. Also updated usage in text in documentation and the installer LocalSettingsGenerator. Most of them were handled by this regex: - find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$ - replace: $1 $2; Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
* Remove hphpc support and deprecate related functionsTim Starling2013-05-091-5/+1
| | | | | | | | | | | | | | | | | hphpc has been superseded by hhvm, so support for hphpc is no longer needed. * Continue to use Preprocessor_Hash under HipHop since it is still faster under hhvm * Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error before Ic9d1e795 is merged * Migrate the run-server script and associated configuration file to hhvm. Enable EnableStaticContentFromDisk since it doesn't seem ridiculously inefficient at first glance. Run from $IP rather than $IP/.. since hhvm is apparently not picky about sourcing files from outside of the current directory. Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45
* Follow up to dirname( __FILE__ ) clean upHoo man2012-08-281-0/+1
| | | | | | | | Remove a trailing whitespace added by me in dirname( __FILE__ ) clean up and add some comments to the PHP version checks (they can't use __DIR__ as they have to run in older PHP versions. Change-Id: I6a7e8cb7dbf384d91dda4d0ecbef7ce588bc3073
* Use __DIR__ instead of dirname( __FILE__ )jeroendedauw2012-08-271-1/+1
| | | | | | We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :) Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
* Added missing GPLv2 headers in some places.Alexandre Emsenhuber2012-05-231-1/+0
| | | | | | Also made file documentation more consistent. Change-Id: I30e124514396f110a572467b94ca06cefd5f7b46
* Various updates needed to bump min php version to 5.3.2Reedy2012-04-161-1/+1
| | | | Change-Id: I22015387e4ac5839a907059086d787f352746886
* Clean up the mess that is wfDie (resolves r85918). wfDie() doesn't exist ↵Chad Horohoe2011-07-061-11/+4
| | | | | | | | | anymore, so don't use it. The only two usages left since r91590 are php version checks for index/load/api.php, and $wgAPIEnabled check in api.php. Consolidate all of the "bailing for invalid version" into PHPVersionError.php. Leaving $wgAPIEnabled as the only user was silly, so just echo and die like wfDie() would've done Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/91602
* (bug 28840) If the query string hits bug 28235, redirect to a safer URL ↵Tim Starling2011-06-031-11/+1
| | | | | | | instead of showing an unhelpful error message. IE 6 will only use the extension of the final destination for its cache filename. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89397
* HipHop improvements:Tim Starling2011-05-301-1/+6
| | | | | | | | | | | | | | | | | * Added the ability to compile extensions. The build process is bootstrapped by running MediaWiki in interpreted mode. Extension setup file inclusions are slightly modified in a way that makes them register themselves for compilation. Then the same LocalSettings.php uses the compiled extension setup file when the compiled binary runs. * Tested with Cite and ParserFunctions. The code which lets you have an extensions directory in a place other than $IP/../extensions is untested. * Simplified WebStart.php slightly by using a custom $_SERVER variable to mark compiled mode. It will break if you don't use the supplied server.conf, but that will break a lot of things so don't do that. * Fixed the core web entry points to include WebStart.php in compiled mode instead of interpreted. * Made the build directory configurable. This is mostly so that I can grep the source tree without seeing loads of generated C++. * In server.conf, added a rewrite rule allowing a /wiki/$1 article path. * Removed server.conf log file location "/dev/stdout", breaks when you switch user * Disable static content cache, breaks horribly when you set SourceRoot to a directory containing 7GB of files. * Rewrote the run-server script in PHP, mostly to support the configurable build directory feature. * Added an option to the run-server script to allow running in interpreted (hphpi) mode. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89166
* Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION etc.): breaks ↵Tim Starling2011-05-151-7/+3
| | | | | | | HipHop support. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/88176
* Centralise the minimum-required-php-version in a MW_MIN_PHP_VERSION constant ↵Happy-melon2011-05-071-3/+7
| | | | | | | | | in Defines.php. This requires loading Defines.php before the PHP4 version checks, so include a big note reminding people not to include anything other than vanilla define() statements in there. I have a sneaking suspicion that including Defines.php in the entry points might not play nicely with HipHop, but I can't test it (wrong OS). Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/87637