MediaWiki  master
router.php File Reference

Router for the php cli-server built-in webserver. More...

Go to the source code of this file.

Variables

 $acceptGzip = preg_match( '/\bgzip\b/', $_SERVER['HTTP_ACCEPT_ENCODING'] ?? '' )
 
 $content = file_get_contents( $file )
 
if(!is_readable( $file)) $ext = pathinfo( $file, PATHINFO_EXTENSION )
 
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file = $_SERVER['SCRIPT_FILENAME']
 Item class for a filearchive table row. More...
 
 $mime = 'text/plain'
 
if( $ext=='php') else
 
return true
 

Detailed Description

Router for the php cli-server built-in webserver.

https://www.php.net/manual/en/features.commandline.webserver.php

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file router.php.

Variable Documentation

◆ $acceptGzip

$acceptGzip = preg_match( '/\bgzip\b/', $_SERVER['HTTP_ACCEPT_ENCODING'] ?? '' )

Definition at line 79 of file router.php.

◆ $content

$content = file_get_contents( $file )

Definition at line 76 of file router.php.

Referenced by HttpError\__construct(), MediaWiki\Revision\SlotRecord\__construct(), MediaWiki\EditPage\Constraint\EditFilterMergedContentHookConstraint\__construct(), OutputPage\addContentOverride(), InfoAction\addTable(), MediaWiki\ResourceLoader\Module\buildContent(), ContentHandler\callDeprecatedContentGPO(), MediaWiki\Storage\PageEditStash\checkCache(), Message\content(), Parser\Parsoid\Config\PageConfigFactory\create(), Installer\createMainpage(), FileBackendStore\doGetFileContentsMulti(), SwiftFileBackend\doGetFileContentsMulti(), EditPage\doPreviewParse(), WikiPage\doUserEditContent(), ApiEditPage\execute(), ApiStashEdit\execute(), BenchmarkJSMinPlus\execute(), DumpIterator\execute(), EditCLI\execute(), GetTextMaint\execute(), GrepPages\execute(), ImportSiteScripts\execute(), ImportTextFiles\execute(), MakeTestEdits\execute(), DumpRev\execute(), ViewCLI\execute(), Parser\extensionSubstitution(), Parser\extractTagsAndParams(), SpecialNewpages\feedItemDesc(), ApiFeedContributions\feedItemDesc(), Xml\fieldset(), CssContentHandler\fillParserOutput(), FallbackContentHandler\fillParserOutput(), JavaScriptContentHandler\fillParserOutput(), TextContentHandler\fillParserOutput(), JsonContentHandler\fillParserOutput(), WikitextContentHandler\fillParserOutput(), ContentHandler\fillParserOutputInternal(), FormatMetadata\flattenArrayReal(), AutoloadGenerator\generatePHPAutoload(), GenerateConfigSchema\generateSchemaArray(), GenerateConfigSchema\generateVariableStubs(), BaseTemplate\getAfterPortlet(), ContentHandler\getAutoDeleteReason(), PreferencesFormOOUI\getBody(), MediaWiki\ResourceLoader\WikiModule\getContent(), Parser\Parsoid\Config\PageConfig\getContentModel(), MediaWiki\ResourceLoader\WikiModule\getContentObj(), EditPage\getContentObject(), ContentHandler\getContentText(), EditPage\getCurrentContent(), ContentHandler\getDataForSearchIndex(), FileBackendStore\getFileContentsMulti(), ContentHandler\getForContent(), ChangeTagsLogItem\getHTML(), ChangeTagsRevisionItem\getHTML(), RevDelLogItem\getHTML(), RevDelRevisionItem\getHTML(), BaseTemplate\getIndicators(), Skin\getIndicatorsData(), PNGMetadataExtractor\getMetadata(), MediaWiki\ResourceLoader\FileModule\getPackageFiles(), ContentHandler\getPageViewLanguage(), ContentHandler\getParserOutput(), EditPage\getPreviewText(), RawAction\getRawText(), LogFormatter\getRestrictedElement(), MediaWiki\Storage\DerivedPageDataUpdater\getSecondaryDataUpdates(), BaseTemplate\getSidebar(), DifferenceEngine\getSlotDiffRenderers(), MediaWiki\Revision\RenderedRevision\getSlotParserOutput(), MediaWiki\ResourceLoader\FileModule\getTemplates(), MediaWiki\ResourceLoader\WikiModule\getTitleInfo(), FileBackendGroup\guessMimeInternal(), DumpRenderer\handleRevision(), FixDefaultJsonContentPages\handleRow(), CoreTagHooks\html(), implodeTokens(), CheckStorage\importRevision(), initText(), WikiPage\insertRedirect(), EditPage\internalAttemptSave(), WikiPage\isCountable(), MovePage\isValidMoveTarget(), CoreTagHooks\langconvert(), Benchmarker\loadFile(), MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), MediaWiki\Rest\Handler\EditHandler\mapActionModuleResult(), LinkFilter\matchEntry(), MediaWiki\Storage\RevisionSlotsUpdate\modifyContent(), MediaWiki\Revision\SlotRecord\newDerived(), MediaWiki\Storage\RevisionSlotsUpdate\newFromContent(), MediaWiki\Revision\SlotRecord\newUnsaved(), Parser\ParserObserver\notifyParse(), MediaWiki\HookContainer\HookRunner\onAlternateEditPreview(), MediaWiki\HookContainer\HookRunner\onArticleDeleteComplete(), MediaWiki\HookContainer\HookRunner\onContentAlterParserOutput(), MediaWiki\HookContainer\HookRunner\onContentGetParserOutput(), MediaWiki\HookContainer\HookRunner\onConvertContent(), MediaWiki\HookContainer\HookRunner\onEditFilterMergedContent(), MediaWiki\HookContainer\HookRunner\onEditPageGetPreviewContent(), MediaWiki\HookContainer\HookRunner\onJsonValidateSave(), MediaWiki\HookContainer\HookRunner\onPageContentSave(), MediaWiki\HookContainer\HookRunner\onParserOutputStashForEdit(), MediaWiki\HookContainer\HookRunner\onPlaceNewSection(), InfoAction\onView(), MediaWiki\HookContainer\HookRunner\onWikiPageDeletionUpdates(), OutputPage\output(), MediaWiki\Storage\PageEditStash\parseAndCache(), RebuildTextIndex\populateSearchIndex(), ContentHandler\preloadTransform(), WikitextContentHandler\preloadTransform(), WikiPage\prepareContentForEdit(), ContentHandler\preSaveTransform(), JsonContentHandler\preSaveTransform(), WikitextContentHandler\preSaveTransform(), CompareParsers\processRevision(), MediaWiki\Rest\Handler\HtmlInputTransformHelper\putContent(), ApiFormatXml\recXmlPrint(), DoubleRedirectJob\run(), MediaWiki\Rest\Handler\RevisionSourceHandler\run(), FallbackContentHandler\serializeContent(), TextContentHandler\serializeContent(), WikitextContentHandler\serializeContent(), MediaWiki\Revision\MutableRevisionRecord\setContent(), MediaWiki\Revision\MutableRevisionSlots\setContent(), MediaWiki\Storage\PageUpdater\setContent(), SpecialRecentChanges\setTopText(), ParserOptions\setupFakeRevision(), Parser\statelessFetchTemplate(), LogFormatter\styleRestrictedElement(), Xml\textarea(), EditPage\toEditContent(), MessageCache\updateMessageOverride(), WikiPage\updateRevisionOn(), ContentHandler\validateSave(), JsonContentHandler\validateSave(), wfThumbError(), OOUIHTMLForm\wrapForm(), XmlDumpWriter\writeRevision(), and MediaWiki\Rest\Handler\ParsoidHandler\wt2html().

◆ $ext

if (!is_readable($file)) $ext = pathinfo( $file, PATHINFO_EXTENSION )

Definition at line 48 of file router.php.

Referenced by MediaWiki\ResourceLoader\Image\__construct(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendFileExtensions(), PHPVersionCheck\checkExtensionExistence(), UploadBase\checkFileExtension(), UploadBase\checkFileExtensionList(), UploadFromChunks\concatenateChunks(), HTTPFileStreamer\contentTypeFromPath(), StreamFile\contentTypeFromPath(), Installer\dirIsExecutable(), LocalFileDeleteBatch\doDBInserts(), FSFileBackend\doGetLocalCopyMulti(), MemoryFileBackend\doGetLocalCopyMulti(), SwiftFileBackend\doGetLocalCopyMulti(), SpecialVersion\execute(), ApiImageRotate\execute(), LocalFileDeleteBatch\execute(), FileBackend\extensionFromPath(), File\getArchiveThumbUrl(), File\getArchiveUrl(), MediaWiki\Revision\MainSlotRoleHandler\getDefaultModel(), ApiFormatBase\getFilename(), MediaWiki\ResourceLoader\Image\getMimeType(), IEContentAnalyzer\getMimeTypeForVersion(), ApiBase\getModuleSourceInfo(), MWFileProps\getPropsFromPath(), FSFile\getPropsFromPath(), File\getStorageKey(), MediaHandler\getThumbType(), UploadBase\getTitle(), MimeAnalyzer\getTypesForExtension(), File\getUrl(), FileRepo\getZoneUrl(), ForeignAPIRepo\getZoneUrl(), FileBackendGroup\guessMimeInternal(), MimeAnalyzer\guessTypesForExtension(), LocalRepo\hiddenFileHasKey(), ChannelFeed\httpHeaders(), MimeAnalyzer\improveTypeFromExtension(), FileRepo\nameForThumb(), MediaWiki\FileBackend\FSFile\TempFSFileFactory\newTempFSFile(), MediaWiki\HookContainer\HookRunner\onMimeMagicImproveFromExtension(), ImagePage\openShowImage(), WebInstallerOptions\submit(), and wfLoadExtensions().

◆ $file

ArchivedFile $file = $_SERVER['SCRIPT_FILENAME']

Item class for a filearchive table row.

Definition at line 42 of file router.php.

Referenced by DumpPipeOutput\__construct(), DumpBZip2Output\__construct(), DumpDBZip2Output\__construct(), DumpFileOutput\__construct(), DumpGZipOutput\__construct(), DumpLBZip2Output\__construct(), Exif\__construct(), Dump7ZipOutput\__construct(), UnlistedSpecialPage\__construct(), IncludableSpecialPage\__construct(), LocalFileDeleteBatch\__construct(), LocalFileRestoreBatch\__construct(), OutputPage\addScriptFile(), Wikimedia\Rdbms\DatabaseSqlite\attachDatabase(), OutputPage\buildCssLinksArray(), GIFHandler\canAnimateThumbnail(), ApiDelete\canDeleteFile(), ImageHandler\canRender(), TiffHandler\canRender(), WebPHandler\canRender(), XCFHandler\canRender(), FindOrphanedFiles\checkFiles(), Sqlite\checkSqlSyntax(), UploadBase\checkXMLEncodingMissmatch(), UploadBase\detectScript(), UploadBase\detectVirus(), Installer\dirIsExecutable(), SpecialRedirect\dispatchFile(), PopulateImageSha1\doDBUpdates(), FileDeleteForm\doDelete(), FileOpPerfTest\doPerfTest(), RevDelFileList\doPostCommitUpdates(), UploadBase\doStashFile(), DjVuImage\dump(), MediaWiki\Logger\LegacyLogger\emit(), SpecialUndelete\execute(), SpecialVersion\execute(), ApiImageRotate\execute(), ApiQueryFilearchive\execute(), ApiQueryStashImageInfo\execute(), BenchmarkCommentFormatter\execute(), BenchmarkJSMinPlus\execute(), BenchmarkTidy\execute(), BlockUsers\execute(), CheckImages\execute(), CleanupUploadStash\execute(), DeleteArchivedFiles\execute(), DeleteBatch\execute(), DumpIterator\execute(), EraseArchivedFile\execute(), ExportSites\execute(), FindDeprecated\execute(), FindMissingFiles\execute(), ImportImages\execute(), ImportSites\execute(), ImportTextFiles\execute(), InvalidateUserSessions\execute(), GenerateNormalizerDataAr\execute(), GeneratePhpCharToUpperMappings\execute(), MigrateFileRepoLayout\execute(), MoveBatch\execute(), PatchSql\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), MwSql\execute(), UpdateMediaWiki\execute(), UpdateSearchIndex\execute(), ExtensionProcessor\extractExtensionMessagesFiles(), ExtensionProcessor\extractMessagesDirs(), FormatMetadata\fetchExtendedMetadata(), Parser\fetchFileAndTitle(), Parser\fetchFileNoRegister(), FileRepo\fileExists(), FileRepo\fileExistsBatch(), ForeignAPIRepo\fileExistsBatch(), CoreParserFunctions\filepath(), LocalRepo\findBySha1s(), RiffExtractor\findChunks(), RiffExtractor\findChunksFromFile(), Installer\findExtensionsByType(), RepoGroup\findFileFromKey(), FileRepo\findFiles(), LocalRepo\findFiles(), SvgHandler\formatMetadata(), ImageListPager\formatValue(), WikiFilePage\getActionOverrides(), MediaWiki\ExtensionInfo\getAuthorsFileName(), ImageHistoryPseudoPager\getBody(), ExifBitmapHandler\getCommonMetaArray(), FileContentHandler\getDataForSearchIndex(), PurgeChangedFiles\getDeletedPath(), UploadForm\getDescriptionSection(), DjVuHandler\getDimensionInfo(), ImageHandler\getDimensionsString(), SpecialUpload\getDupeWarning(), WikiFilePage\getDuplicates(), MediaHandler\getEntireText(), SpecialUpload\getExistsWarning(), FormatMetadata\getExtendedMetadataFromFile(), FormatMetadata\getExtendedMetadataFromHook(), WebInstallerDocument\getFileContents(), Parser\Parsoid\Config\DataAccess\getFileInfo(), MWDebug\getFilesIncluded(), WikiFilePage\getForeignCategories(), MediaHandler\getGeneralLongDesc(), MediaHandler\getGeneralShortDesc(), ApiQueryImageInfo\getInfo(), MetadataStorageHelper\getJsonMetadata(), GIFHandler\getLength(), PNGHandler\getLength(), MediaWiki\ExtensionInfo\getLicenseFileNames(), ImageHandler\getLongDesc(), MediaHandler\getLongDesc(), SvgHandler\getLongDesc(), MediaWiki\Languages\LanguageNameUtils\getMessagesFileName(), SpecialFilepath\getRedirect(), ExifBitmapHandler\getRotation(), MediaWiki\ResourceLoader\FileModule\getScript(), MediaWiki\ResourceLoader\FileModule\getScriptURLsForDebug(), ImageHandler\getShortDesc(), MediaHandler\getShortDesc(), MediaHandler\getSizeAndMetadataWithFallback(), MediaWiki\ResourceLoader\FileModule\getStyles(), MediaWiki\ResourceLoader\FileModule\getStyleURLsForDebug(), ImageHistoryList\getThumbForLine(), LocalFile\getThumbnails(), ForeignAPIFile\getThumbnails(), TransformationalImageHandler\getThumbnailSource(), Wikimedia\ParamValidator\SimpleCallbacks\getUploadedFile(), MWExceptionHandler\handleError(), ConvertExtensionToRegistration\handleExtensionMessagesFiles(), MWExceptionHandler\handleFatalError(), MediaWiki\Rest\Handler\MediaFileHandler\hasRepresentation(), ThumbnailRenderJob\hitThumbUrl(), ImagePage\imageDupes(), ImageHistoryList\imageHistoryLine(), ImportableUploadRevisionImporter\import(), SiteImporter\importFromFile(), Installer\includeExtensionFiles(), UploadStash\initFile(), AutoloadGenerator\initMediaWikiDefault(), SvgHandler\isAnimatedImage(), MediaWiki\BadFileLookup\isBadFile(), DjVuHandler\isExpensiveToThumbnail(), TiffHandler\isExpensiveToThumbnail(), XCFHandler\isFileMetadataValid(), TransformationalImageHandler\isImageAreaOkForThumbnaling(), MovePage\isValidFileMove(), MovePage\isValidMoveTarget(), Benchmarker\loadFile(), MediaWiki\Settings\LocalSettingsLoader\loadLocalSettingsFile(), BackupDumper\loadPlugin(), Parser\makeImage(), Linker\makeImageLink(), DummyLinker\makeImageLink(), Linker\makeMediaLinkFile(), DummyLinker\makeMediaLinkFile(), SqliteInstaller\makeStubDBFile(), Linker\makeThumbLink2(), DummyLinker\makeThumbLink2(), Linker\makeThumbLinkObj(), DummyLinker\makeThumbLinkObj(), Parser\modifyImageHtml(), TransformationalImageHandler\mustRender(), ImportStreamSource\newFromFile(), ArchivedFile\newFromRow(), LocalFile\newFromRow(), OldLocalFile\newFromRow(), ImportStreamSource\newFromURL(), MediaWiki\HookContainer\HookRunner\onFileDeleteComplete(), MediaWiki\HookContainer\HookRunner\onFileTransformed(), MediaWiki\HookContainer\HookRunner\onFileUpload(), MediaWiki\HookContainer\HookRunner\onGetExtendedMetadata(), MediaWiki\HookContainer\HookRunner\onImageBeforeProduceHTML(), MediaWiki\HookContainer\HookRunner\onImagePageFileHistoryLine(), MediaWiki\HookContainer\HookRunner\onImagePageFindFile(), MediaWiki\HookContainer\HookRunner\onLanguage__getMessagesFileName(), MediaWiki\HookContainer\HookRunner\onLinkerMakeMediaLinkFile(), MediaWiki\HookContainer\HookRunner\onLocalFile__getHistory(), MediaWiki\HookContainer\HookRunner\onLocalFilePurgeThumbnails(), MediaWiki\HookContainer\HookRunner\onMimeMagicGuessFromContent(), MediaWiki\HookContainer\HookRunner\onParserMakeImageParams(), MediaWiki\HookContainer\HookRunner\onValidateExtendedMetadataCache(), ApiUpload\performUpload(), ExtensionRegistry\processAutoLoader(), BackupDumper\processOptions(), DummyLinker\processResponsiveImages(), Linker\processResponsiveImages(), MediaWiki\ResourceLoader\FileModule\processStyle(), PruneFileCache\prune_directory(), FileRepo\publishBatch(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), LocalFile\purgeThumbList(), ForeignAPIFile\purgeThumbnails(), AutoloadGenerator\readDir(), MediaWiki\ResourceLoader\FileModule\readStyleFiles(), LocalFileRestoreBatch\removeNonexistentFiles(), LocalFileRestoreBatch\removeNonexistentFromCleanup(), MediaWiki\Search\SearchWidgets\FullSearchResultWidget\render(), Parser\renderImageGallery(), BitmapHandler\rotate(), JpegHandler\rotate(), ThumbnailRenderJob\run(), ImagePage\setFile(), WikiFilePage\setFile(), OutputPage\setFileVersion(), SpecialUpload\showUploadWarning(), MediaWiki\Actions\FileDeleteAction\tempDelete(), ApiUpload\transformWarnings(), UploadBase\tryStashFile(), wfBacktrace(), wfExtractThumbParams(), wfGenerateThumbnail(), wfImageAuthMain(), and wfThumbIsStandard().

◆ $mime

◆ else

foreach (\Wikimedia\Mime\MimeMap::MIME_EXTENSIONS as $type=> $exts) if (preg_match('#^text/#', $mime) else)
Initial value:
{
require_once __DIR__ . "/../../../includes/libs/mime/MimeMap.php"

Definition at line 52 of file router.php.

◆ true

return true

Definition at line 92 of file router.php.

Referenced by MediaWiki\Tidy\RemexDriver\__construct(), MemcachedPeclBagOStuff\__construct(), DatabaseUpdater\addExtensionField(), DatabaseUpdater\addExtensionIndex(), DatabaseUpdater\addExtensionTable(), HTMLFormField\checkStateRecurse(), FileRepo\cleanupBatch(), FileBackendMultiWrite\consistencyCheck(), CopyFileBackend\copyFileBatch(), CommentStore\createComment(), FileRepo\deleteBatch(), MemcachedPeclBagOStuff\doDelete(), FileOpPerfTest\doPerfTest(), MemcachedPeclBagOStuff\doSet(), DatabaseUpdater\dropExtensionField(), DatabaseUpdater\dropExtensionIndex(), DatabaseUpdater\dropExtensionTable(), ApiFormatJson\execute(), ApiHelp\execute(), ApiQueryUsers\execute(), FixDoubleRedirects\execute(), EtcdConfig\fetchAllFromEtcdServer(), FileOp\fileExists(), CoreParserFunctions\filepath(), FileOp\fileSha1(), FileOp\fileSize(), ApiImageRotate\getAllowedParams(), ApiUserrights\getAllowedParams(), ApiEmailUser\getAllowedParams(), ApiMove\getAllowedParams(), ApiOptions\getAllowedParams(), ApiQueryAllPages\getAllowedParams(), ApiQueryBlocks\getAllowedParams(), ApiQueryDeletedrevs\getAllowedParams(), ApiQueryQueryPage\getAllowedParams(), ApiQueryRandom\getAllowedParams(), ApiQuerySearch\getAllowedParams(), ApiQueryUserContribs\getAllowedParams(), ApiQueryUsers\getAllowedParams(), ApiRevisionDelete\getAllowedParams(), ApiRollback\getAllowedParams(), ApiStashEdit\getAllowedParams(), ApiUndelete\getAllowedParams(), ApiValidatePassword\getAllowedParams(), Wikimedia\Rdbms\DatabasePostgres\getAttributes(), Wikimedia\Rdbms\DatabaseSqlite\getAttributes(), OOUIHTMLForm\getButtons(), PostgresUpdater\getCoreUpdateList(), ParserCache\getDirty(), SpecialChangeContentModel\getFormFields(), MWFileProps\getPropsFromPath(), UploadForm\getSourceSection(), Wikimedia\ParamValidator\TypeDef\PresenceBooleanDef\getValue(), FileRepo\initDirectory(), Html\input(), User\isItemLoaded(), ApiAuthManagerHelper\loadAuthenticationRequests(), DatabaseUpdater\modifyExtensionField(), DatabaseUpdater\modifyExtensionTable(), MediaWiki\Session\UserInfo\newAnonymous(), HTMLCacheUpdateJob\newForBacklinks(), XmlTypeCheck\newFromFilename(), DuplicateJob\newFromJob(), ForeignAPIFile\newFromTitle(), Wikimedia\Rdbms\DatabaseSqlite\open(), ConverterRule\parse(), FileRepo\publishBatch(), FileRepo\quickPurgeBatch(), DatabaseUpdater\renameExtensionIndex(), FileBackendMultiWrite\resyncFiles(), Message\setContext(), FileRepo\storeBatch(), WebInstallerName\submit(), SkinTemplate\tabAction(), Wikimedia\Rdbms\DatabaseSqlite\tableExists(), MediaWiki\Session\UserInfo\verified(), and Article\view().