MediaWiki
master
|
The MediaWiki class is the helper class for the index.php entry point. More...
Classes | |
class | MediaWikiServices |
MediaWikiServices is the service locator for the application scope of MediaWiki. More... | |
class | OutputHandler |
Public Member Functions | |
__construct (IContextSource $context=null) | |
doPostOutputShutdown () | |
This function does work that can be done after the user gets the HTTP response so they don't block on it. More... | |
doPreOutputCommit (callable $postCommitWork=null) | |
getAction () | |
Returns the name of the action that will be executed. More... | |
getTitle () | |
Get the Title object that we'll be acting on, as specified in the WebRequest. More... | |
restInPeace () | |
Ends this task peacefully. More... | |
run () | |
Run the current MediaWiki instance; index.php just calls this. More... | |
Static Public Member Functions | |
static | emitBufferedStatsdData (IBufferingStatsdDataFactory $stats, Config $config) |
Send out any buffered statsd data according to sampling rules. More... | |
static | preOutputCommit (IContextSource $context, callable $postCommitWork=null) |
This function commits all DB and session changes as needed before the client can receive a response (in case DB commit fails) and thus also before the response can trigger a subsequent related request by the client. More... | |
Private Member Functions | |
initializeArticle () | |
Initialize the main Article object for "standard" actions (view, etc) Create an Article object for the page, following redirects if needed. More... | |
main () | |
Determine and send the response headers and body for this web request. More... | |
maybeDoHttpsRedirect () | |
If the stars are suitably aligned, do an HTTP->HTTPS redirect. More... | |
outputResponsePayload ( $content) | |
Print a response body to the current buffer (if there is one) or the server (otherwise) More... | |
parseTitle () | |
Parse the request to get the Title object. More... | |
performAction (Article $article, Title $requestTitle) | |
Perform one of the "standard" actions. More... | |
performRequest () | |
Performs the request. More... | |
schedulePostSendJobs () | |
If enabled, after everything specific to this request is done, occasionally run jobs. More... | |
shouldDoHttpRedirect () | |
Check if an HTTP->HTTPS redirect should be done. More... | |
triggerAsyncJobs ( $n, LoggerInterface $runJobsLogger) | |
triggerSyncJobs ( $n) | |
tryNormaliseRedirect (Title $title) | |
Handle redirects for uncanonical title requests. More... | |
Static Private Member Functions | |
static | getUrlDomainDistance ( $url) |
Private Attributes | |
string null | $action |
Cache what action this request is. More... | |
Config | $config |
IContextSource | $context |
int | $postSendStrategy |
Class DEFER_* constant; how non-blocking post-response tasks should run. More... | |
const | DEFER_CLI_MODE = 3 |
Do not try to make post-send updates async (e.g. More... | |
const | DEFER_FASTCGI_FINISH_REQUEST = 1 |
Call fastcgi_finish_request() to make post-send updates async. More... | |
const | DEFER_SET_LENGTH_AND_FLUSH = 2 |
Set Content-Length and call ob_end_flush()/flush() to make post-send updates async. More... | |
The MediaWiki class is the helper class for the index.php entry point.
Definition at line 38 of file MediaWiki.php.
MediaWiki::__construct | ( | IContextSource | $context = null | ) |
IContextSource | null | $context |
Definition at line 61 of file MediaWiki.php.
References $context, DEFER_CLI_MODE, DEFER_FASTCGI_FINISH_REQUEST, DEFER_SET_LENGTH_AND_FLUSH, and RequestContext\getMain().
MediaWiki::doPostOutputShutdown | ( | ) |
This function does work that can be done after the user gets the HTTP response so they don't block on it.
This manages deferred updates, job insertion, final commit, and the logging of profiling data
Definition at line 820 of file MediaWiki.php.
References WebResponse\disableForPostSend(), and MWExceptionHandler\rollbackPrimaryChangesAndLog().
Referenced by MediaWiki\Rest\EntryPoint\execute().
MediaWiki::doPreOutputCommit | ( | callable | $postCommitWork = null | ) |
callable | null | $postCommitWork | [default: null] |
Definition at line 649 of file MediaWiki.php.
|
static |
Send out any buffered statsd data according to sampling rules.
For web requests, this is called once by MediaWiki::restInPeace(), which is post-send (after the response is sent to the client).
For maintenance scripts, especially long-running CLI scripts, it is called more often, to avoid OOM, since we buffer stats (T181385), based on the following heuristics:
IBufferingStatsdDataFactory | $stats | |
Config | $config |
ConfigException |
Definition at line 1172 of file MediaWiki.php.
References IBufferingStatsdDataFactory\clearData(), Config\get(), IBufferingStatsdDataFactory\getData(), IBufferingStatsdDataFactory\hasData(), and MWExceptionHandler\logException().
Referenced by Maintenance\output(), Maintenance\shutdown(), and wfLogProfilingData().
MediaWiki::getAction | ( | ) |
Returns the name of the action that will be executed.
Definition at line 176 of file MediaWiki.php.
MediaWiki::getTitle | ( | ) |
Get the Title object that we'll be acting on, as specified in the WebRequest.
Definition at line 160 of file MediaWiki.php.
References SpecialPage\getTitleFor(), and parseTitle().
|
staticprivate |
string | $url |
Definition at line 799 of file MediaWiki.php.
References WikiMap\getWikiFromUrl(), and WikiMap\isCurrentWikiId().
|
private |
Initialize the main Article object for "standard" actions (view, etc) Create an Article object for the page, following redirects if needed.
Definition at line 416 of file MediaWiki.php.
References $file, $title, Article\newFromWikiPage(), and wfWarn().
|
private |
Determine and send the response headers and body for this web request.
Definition at line 865 of file MediaWiki.php.
References $cache, $title, $wgTitle, getTitle(), Profiler\instance(), ErrorPageError\report(), ErrorPageError\STAGE_OUTPUT, and HTMLFileCache\useFileCache().
|
private |
If the stars are suitably aligned, do an HTTP->HTTPS redirect.
Note: Do this after $wgTitle is setup, otherwise the hooks run from isRegistered() will do all sorts of weird stuff.
Definition at line 992 of file MediaWiki.php.
References $title, Title\newFromText(), NS_MAIN, and wfDebugLog().
|
private |
Print a response body to the current buffer (if there is one) or the server (otherwise)
This method should be called after doPreOutputCommit() and before doPostOutputShutdown()
Any accompanying Content-Type header is assumed to have already been set
string | $content | Response content, usually from OutputPage::output() |
Definition at line 1033 of file MediaWiki.php.
References $content, Profiler\instance(), and DeferredUpdates\pendingUpdatesCount().
|
private |
Parse the request to get the Title object.
MalformedTitleException | If a title has been provided by the user, but is invalid. |
Definition at line 80 of file MediaWiki.php.
References $action, $title, MediaWiki\MediaWikiServices\getInstance(), SpecialPage\getTitleFor(), Title\makeTitle(), Title\newFromID(), Title\newFromLinkTarget(), Title\newFromTextThrow(), Title\newFromURL(), Title\newMainPage(), NS_FILE, and NS_MEDIA.
Referenced by getTitle().
Perform one of the "standard" actions.
Definition at line 502 of file MediaWiki.php.
References $t, $title, Profiler\instance(), PROTO_INTERNAL, and wfExpandUrl().
|
private |
Performs the request.
MWException|PermissionsError|BadTitleError|HttpError |
Definition at line 196 of file MediaWiki.php.
References $title, $wgTitle, and SpecialPage\getTitleFor().
|
static |
This function commits all DB and session changes as needed before the client can receive a response (in case DB commit fails) and thus also before the response can trigger a subsequent related request by the client.
If there is a significant amount of content to flush, it can be done in $postCommitWork
IContextSource | $context | |
callable | null | $postCommitWork | [default: null] |
Definition at line 664 of file MediaWiki.php.
References DeferredUpdates\doUpdates(), IContextSource\getConfig(), IContextSource\getOutput(), IContextSource\getRequest(), IContextSource\getUser(), MWExceptionHandler\logException(), wfDebug(), and wfDebugLog().
Referenced by MediaWiki\Rest\EntryPoint\execute(), and ApiMain\executeActionWithErrorHandling().
MediaWiki::restInPeace | ( | ) |
Ends this task peacefully.
Definition at line 1104 of file MediaWiki.php.
References DeferredUpdates\doUpdates(), Profiler\instance(), and wfDebug().
MediaWiki::run | ( | ) |
Run the current MediaWiki instance; index.php just calls this.
Definition at line 564 of file MediaWiki.php.
References $cache, MWExceptionRenderer\getHTML(), MWExceptionHandler\handleException(), HTMLFileCache\MODE_OUTAGE, and HTMLFileCache\useFileCache().
Referenced by MediaWiki\Rest\SimpleHandler\execute().
|
private |
If enabled, after everything specific to this request is done, occasionally run jobs.
Definition at line 597 of file MediaWiki.php.
References DeferredUpdates\addUpdate(), getTitle(), and wfReadOnly().
|
private |
Check if an HTTP->HTTPS redirect should be done.
It may still be aborted by a hook, so this is not the final word.
Definition at line 948 of file MediaWiki.php.
References PROTO_HTTPS, and wfExpandUrl().
|
private |
int | $n | Number of jobs to try to run |
LoggerInterface | $runJobsLogger |
Definition at line 1207 of file MediaWiki.php.
References SpecialRunJobs\getQuerySignature(), JobQueueGroup\TYPE_DEFAULT, and wfParseUrl().
|
private |
int | $n | Number of jobs to try to run |
Definition at line 1195 of file MediaWiki.php.
References Profiler\instance().
|
private |
Handle redirects for uncanonical title requests.
Handles:
Behaviour:
Title | $title |
HttpError |
Definition at line 356 of file MediaWiki.php.
References $title, SpecialPage\getTitleFor(), PROTO_CURRENT, and wfExpandUrl().
|
private |
Cache what action this request is.
Definition at line 47 of file MediaWiki.php.
Referenced by MediaWiki\Permissions\PermissionManager\checkActionPermissions(), MediaWiki\Permissions\PermissionManager\checkCascadingSourcesRestrictions(), MediaWiki\Permissions\PermissionManager\checkPageRestrictions(), MediaWiki\Permissions\PermissionManager\checkPermissionHooks(), MediaWiki\Permissions\PermissionManager\checkQuickPermissions(), MediaWiki\Permissions\PermissionManager\checkReadPermissions(), MediaWiki\Permissions\PermissionManager\checkSiteConfigPermissions(), MediaWiki\Permissions\PermissionManager\checkSpecialsAndNSPermissions(), MediaWiki\Permissions\PermissionManager\checkUserBlock(), MediaWiki\Permissions\PermissionManager\checkUserConfigPermissions(), MediaWiki\Auth\AuthManager\fillRequests(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\getAuthenticationRequests(), MediaWiki\Auth\AuthManager\getAuthenticationRequests(), MediaWiki\Block\BlockActionInfo\getIdFromAction(), MediaWiki\Permissions\PermissionManager\getPermissionErrors(), MediaWiki\Permissions\PermissionManager\getPermissionErrorsInternal(), MediaWiki\User\TempUser\RealTempUserConfig\isAutoCreateAction(), MediaWiki\User\TempUser\TempUserCreator\isAutoCreateAction(), MediaWiki\Permissions\PermissionManager\missingPermissionError(), MediaWiki\HookContainer\HookRunner\onAuthChangeFormFields(), parseTitle(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\queueRecursiveJobs(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\queueRecursiveJobsForTable(), MediaWiki\Permissions\PermissionManager\quickUserCan(), MediaWiki\Permissions\PermissionManager\userCan(), MediaWiki\Permissions\PermissionManager\userHasAllRights(), MediaWiki\Permissions\PermissionManager\userHasAnyRight(), MediaWiki\Permissions\PermissionManager\userHasRight(), and MediaWiki\Preferences\DefaultPreferencesFactory\watchlistPreferences().
|
private |
Definition at line 44 of file MediaWiki.php.
Referenced by MediaWiki\User\TempUser\DBSerialProvider\__construct(), MediaWiki\User\TempUser\FilteredRadixSerialMapping\__construct(), MediaWiki\User\TempUser\RealTempUserConfig\__construct(), MediaWiki\User\TempUser\ScrambleMapping\__construct(), MediaWiki\User\TempUser\LocalSerialProvider\__construct(), MediaWiki\User\TempUser\LocalizedNumericSerialMapping\__construct(), MediaWiki\Auth\Throttler\__construct(), MediaWiki\Widget\CheckMatrixWidget\__construct(), MediaWiki\Widget\DateInputWidget\__construct(), MediaWiki\Widget\DateTimeInputWidget\__construct(), MediaWiki\Widget\NamespaceInputWidget\__construct(), MediaWiki\Widget\NamespacesMultiselectWidget\__construct(), MediaWiki\Widget\PendingTextInputWidget\__construct(), MediaWiki\Widget\SearchInputWidget\__construct(), MediaWiki\Widget\SpinnerWidget\__construct(), MediaWiki\Widget\TagMultiselectWidget\__construct(), MediaWiki\Widget\TitleInputWidget\__construct(), MediaWiki\Widget\TitlesMultiselectWidget\__construct(), MediaWiki\Widget\UserInputWidget\__construct(), MediaWiki\Widget\UsersMultiselectWidget\__construct(), MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\__construct(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\__construct(), MediaWiki\Config\ConfigRepository\add(), MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\doIncrementalUpdate(), MediaWiki\Deferred\LinksUpdate\LinksTableGroup\get(), MediaWiki\Widget\CheckMatrixWidget\getConfig(), MediaWiki\Widget\DateInputWidget\getConfig(), MediaWiki\Widget\DateTimeInputWidget\getConfig(), MediaWiki\Widget\ExpiryInputWidget\getConfig(), MediaWiki\Widget\NamespaceInputWidget\getConfig(), MediaWiki\Widget\NamespacesMultiselectWidget\getConfig(), MediaWiki\Widget\SearchInputWidget\getConfig(), MediaWiki\Widget\TagMultiselectWidget\getConfig(), MediaWiki\Widget\TitleInputWidget\getConfig(), MediaWiki\Widget\TitlesMultiselectWidget\getConfig(), MediaWiki\Widget\UserInputWidget\getConfig(), MediaWiki\Widget\UsersMultiselectWidget\getConfig(), MediaWiki\Config\ConfigRepository\getDescriptionOf(), MediaWiki\Auth\UserDataAuthenticationRequest\getFieldInfo(), MediaWiki\Widget\DateInputWidget\getInputElement(), MediaWiki\Widget\NamespaceInputWidget\getNamespaceDropdownOptions(), MediaWiki\Config\ConfigRepository\getValueOf(), MediaWiki\Settings\LocalSettingsLoader\loadLocalSettingsFile(), MediaWiki\Settings\WikiFarmSettingsLoader\loadWikiFarmSettings(), and MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\newRandom().
|
private |
Definition at line 42 of file MediaWiki.php.
Referenced by __construct(), MediaWiki\Shell\Command\__destruct(), MediaWiki\Permissions\PermissionManager\checkUserBlock(), MediaWiki\Logger\LogCapturingSpi\createLogger(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), MediaWiki\Logger\LegacyLogger\destination(), MediaWiki\Logger\Monolog\LogstashFormatter\fixKeyConflicts(), MediaWiki\Logger\LegacyLogger\format(), MediaWiki\Logger\LegacyLogger\formatAsWfDebug(), MediaWiki\Logger\Monolog\LogstashFormatter\formatV0(), MediaWiki\Logger\Monolog\LogstashFormatter\formatV1(), MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), MediaWiki\Actions\ActionFactory\getAction(), MediaWiki\Rest\Handler\ActionModuleBasedHandler\getApiMain(), MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(), MediaWiki\Preferences\DefaultPreferencesFactory\getForm(), MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor(), MediaWiki\Preferences\DefaultPreferencesFactory\getTimezoneOptions(), MediaWiki\Logger\LegacyLogger\interpolate(), MediaWiki\Preferences\DefaultPreferencesFactory\loadPreferenceValues(), MediaWiki\Logger\ConsoleLogger\log(), MediaWiki\Logger\LegacyLogger\log(), MediaWiki\Auth\Throttler\logRejection(), MediaWiki\Api\ApiHookRunner\onApiFeedContributions__feedItem(), MediaWiki\Api\ApiHookRunner\onApiFormatHighlight(), MediaWiki\HookContainer\HookRunner\onArticleFromTitle(), MediaWiki\Revision\RenderedRevision\outputVariesOnRevisionMetaData(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\searchPreferences(), MediaWiki\Logger\LegacyLogger\shouldEmit(), MediaWiki\Preferences\DefaultPreferencesFactory\skinPreferences(), MediaWiki\Preferences\DefaultPreferencesFactory\submitForm(), and MediaWiki\Preferences\DefaultPreferencesFactory\watchlistPreferences().
|
private |
Class DEFER_* constant; how non-blocking post-response tasks should run.
Definition at line 49 of file MediaWiki.php.
|
private |
Do not try to make post-send updates async (e.g.
for CLI mode)
Definition at line 56 of file MediaWiki.php.
Referenced by __construct().
|
private |
Call fastcgi_finish_request() to make post-send updates async.
Definition at line 52 of file MediaWiki.php.
Referenced by __construct().
|
private |
Set Content-Length and call ob_end_flush()/flush() to make post-send updates async.
Definition at line 54 of file MediaWiki.php.
Referenced by __construct().