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

if(!is_readable( $file)) $ext = pathinfo( $file, PATHINFO_EXTENSION )
 
 $f = fopen( $file, 'rb' )
 
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file = $_SERVER['SCRIPT_FILENAME']
 
 $lines = explode( "\n", file_get_contents( "includes/libs/mime/mime.types" ) )
 
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

◆ $ext

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

Definition at line 48 of file router.php.

Referenced by ResourceLoaderImage\__construct(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendFileExtensions(), PHPVersionCheck\checkExtensionExistence(), UploadBase\checkFileExtension(), UploadBase\checkFileExtensionList(), UploadFromChunks\concatenateChunks(), StreamFile\contentTypeFromPath(), HTTPFileStreamer\contentTypeFromPath(), MimeAnalyzer\detectMimeType(), MimeAnalyzer\detectZipType(), Installer\dirIsExecutable(), LocalFileDeleteBatch\doDBInserts(), MemoryFileBackend\doGetLocalCopyMulti(), FSFileBackend\doGetLocalCopyMulti(), SwiftFileBackend\doGetLocalCopyMulti(), MimeAnalyzer\doGuessMimeType(), ApiImageRotate\execute(), WebInstallerOptions\execute(), SpecialVersion\execute(), LocalFileDeleteBatch\execute(), FileBackend\extensionFromPath(), TempFSFile\factory(), ImportImages\findFiles(), File\getArchiveThumbUrl(), File\getArchiveUrl(), Revision\MainSlotRoleHandler\getDefaultModel(), MediaStatisticsPage\getExtensionList(), ApiFormatBase\getFilename(), ResourceLoaderImage\getMimeType(), CSSMin\getMimeType(), IEContentAnalyzer\getMimeTypeForVersion(), ApiBase\getModuleSourceInfo(), MWFileProps\getPropsFromPath(), FSFile\getPropsFromPath(), File\getStorageKey(), MediaHandler\getThumbType(), UploadBase\getTitle(), MimeAnalyzer\getTypesForExtension(), File\getUrl(), FileRepo\getZoneUrl(), ForeignAPIRepo\getZoneUrl(), File\getZoneUrl(), FileBackendGroup\guessMimeInternal(), MimeAnalyzer\guessMimeType(), MimeAnalyzer\guessTypesForExtension(), MediaWiki\OutputHandler\handleGzip(), LocalRepo\hiddenFileHasKey(), ChannelFeed\httpHeaders(), MimeAnalyzer\improveTypeFromExtension(), MimeAnalyzer\isMatchingExtension(), MimeAnalyzer\loadFiles(), moveToExternal(), FileRepo\nameForThumb(), ImagePage\openShowImage(), AutoloadGenerator\readDir(), GenerateSitemap\sitemapFilename(), WebInstallerOptions\submit(), MimeAnalyzerTest\testImproveTypeFromExtension(), and wfLoadExtensions().

◆ $f

◆ $file

if (PHP_SAPI !='cli-server') if (!isset($_SERVER[ 'SCRIPT_FILENAME'])) $file = $_SERVER['SCRIPT_FILENAME']

Definition at line 42 of file router.php.

Referenced by IncludableSpecialPage\__construct(), UnlistedSpecialPage\__construct(), DumpBZip2Output\__construct(), DumpDBZip2Output\__construct(), DumpGZipOutput\__construct(), DumpFileOutput\__construct(), DumpLBZip2Output\__construct(), DumpPipeOutput\__construct(), Dump7ZipOutput\__construct(), ImageBuilder\addMissingImage(), OutputPage\addScriptFile(), HHVMMakeRepo\appendDir(), ReleaseNotesTest\assertFileLength(), Wikimedia\Rdbms\DatabaseSqlite\attachDatabase(), AutoLoader\autoload(), OutputPage\buildCssLinksArray(), GIFHandler\canAnimateThumbnail(), ImageHandler\canRender(), TiffHandler\canRender(), XCFHandler\canRender(), WebPHandler\canRender(), AutoLoaderStructureTest\checkAutoLoadConf(), FindOrphanedFiles\checkFiles(), Sqlite\checkSqlSyntax(), UploadBase\checkXMLEncodingMissmatch(), ForeignResourceManager\cleanUp(), ImagePage\delete(), UploadFromUrlTest\deleteFile(), ApiDelete\deleteFile(), ApiUploadTestCase\deleteFileByTitle(), ParserTestRunner\deleteFiles(), FileBackendTest\deleteFiles(), MigrateFileRepoLayoutTest\deleteFilesRecursively(), MimeAnalyzer\detectMimeType(), UploadBase\detectScript(), UploadBase\detectVirus(), Installer\dirIsExecutable(), SpecialRedirect\dispatchFile(), PopulateImageSha1\doDBUpdates(), MimeAnalyzer\doGuessMimeType(), FileOpPerfTest\doPerfTest(), RevDelFileList\doPostCommitUpdates(), UploadBase\doStashFile(), MovePageForm\doSubmit(), FileBackendTest\doTestDoQuickOperations(), FileBackendTest\doTestGetDirectoryList(), FileBackendTest\doTestGetFileList(), DjVuImage\dump(), DjVuImage\dumpForm(), ParserTestPrinter\dumpToFile(), MediaWiki\Logger\LegacyLogger\emit(), ApiFormatBaseTest\encodeData(), CSSMin\encodeImageAsDataURI(), BenchmarkTidy\execute(), ApiImageRotate\execute(), ExportSites\execute(), ImportSites\execute(), HHVMMakeRepo\execute(), ApiQueryStashImageInfo\execute(), FindMissingFiles\execute(), BenchmarkCSSMin\execute(), CheckImages\execute(), BenchmarkJavaScriptMinifier\execute(), ApiQueryFilearchive\execute(), DeleteArchivedFiles\execute(), GeneratePhpCharToUpperMappings\execute(), MigrateFileRepoLayout\execute(), CleanupUploadStash\execute(), EraseArchivedFile\execute(), PatchSql\execute(), InvalidateUserSesssions\execute(), SpecialVersion\execute(), ImportTextFiles\execute(), CreateCommonPasswordCdb\execute(), DeleteBatch\execute(), GenerateNormalizerDataAr\execute(), RefreshFileHeaders\execute(), MwSql\execute(), MoveBatch\execute(), UpdateSearchIndex\execute(), FindHooks\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), ImportImages\execute(), FindDeprecated\execute(), SpecialUndelete\execute(), ResourceLoaderFileModule\expandPackageFiles(), ResourceLoaderOOUIFileModule\extendSkinSpecific(), ExtensionProcessor\extractExtensionMessagesFiles(), ExtensionProcessor\extractMessagesDirs(), Parser\fetchFileAndTitle(), Parser\fetchFileNoRegister(), FileRepo\fileExists(), ForeignAPIRepo\fileExistsBatch(), FileRepo\fileExistsBatch(), CoreParserFunctions\filepath(), DumpUploads\filterItem(), ImportImages\findAuxFile(), LocalRepo\findBySha1s(), RiffExtractor\findChunks(), RiffExtractor\findChunksFromFile(), Installer\findExtensionsByType(), RepoGroup\findFileFromKey(), LocalRepo\findFiles(), ImportImages\findFiles(), FileRepo\findFiles(), ParserEditTests\findTest(), SpecialUndelete\formatFileRow(), SvgHandler\formatMetadata(), ImageListPager\formatValue(), GenerateCollationData\generateFirstChars(), ImageHistoryPseudoPager\getBody(), MWDebug\getCallerDescription(), FileContentHandler\getDataForSearchIndex(), UploadForm\getDescriptionSection(), ImageHandler\getDimensionsString(), SpecialUpload\getDupeWarning(), WikiFilePage\getDuplicates(), SpecialUpload\getExistsWarning(), SpecialVersion\getExtAuthorsFileName(), SpecialVersion\getExtLicenseFileName(), SpecialUndelete\getFileComment(), ImportImages\getFileCommentFromSourceWiki(), WebInstallerDocument\getFileContents(), SpecialUndelete\getFileLink(), WebRequest\getFileName(), MWDebug\getFilesIncluded(), WebRequest\getFileTempname(), SpecialUndelete\getFileUser(), ImportImages\getFileUserFromSourceWiki(), WikiFilePage\getForeignCategories(), MediaHandler\getGeneralLongDesc(), MediaHandler\getGeneralShortDesc(), ImagePageTest\getImagePage(), ImagePage404Test\getImagePage(), WebPHandler\getImageSize(), SvgHandler\getImageSize(), DjVuImage\getInfo(), ApiQueryImageInfo\getInfo(), PNGHandler\getLength(), GIFHandler\getLength(), MWExceptionHandler\getLogMessage(), MWExceptionHandler\getLogNormalMessage(), ImageHandler\getLongDesc(), SvgHandler\getLongDesc(), MediaHandler\getLongDesc(), Language\getMessagesFileName(), CSSMin\getMimeType(), DjVuImage\getMultiPageInfo(), InstallerOverrides\getOverrides(), DjVuImage\getPageInfo(), SpecialFilepath\getRedirect(), ExifBitmapHandler\getRotation(), ResourceLoaderFileModule\getScriptURLsForDebug(), ImageHandler\getShortDesc(), MediaHandler\getShortDesc(), SpecialPageAliasTest\getSpecialPageAliases(), ResourceLoaderFileModule\getStyleURLsForDebug(), ImageHistoryList\getThumbForLine(), ForeignAPIFile\getThumbnails(), LocalFile\getThumbnails(), TransformationalImageHandler\getThumbnailSource(), WebRequest\getUploadError(), MimeAnalyzer\guessMimeType(), MWExceptionHandler\handleError(), ConvertExtensionToRegistration\handleExtensionMessagesFiles(), MWExceptionHandler\handleFatalError(), ForeignResourceManager\handleTypeMultiFile(), ForeignResourceManager\handleTypeTar(), RemexDriverTest\html5libProvider(), ImageBuilder\imageCallback(), ImagePage\imageDupes(), ImageHistoryList\imageHistoryLine(), ImportableUploadRevisionImporter\import(), SiteImporter\importFromFile(), BackupReader\importFromFile(), BackupReader\importFromStdin(), UploadStash\initFile(), MediaWiki\initializeArticle(), AutoloadGenerator\initMediaWikiDefault(), SvgHandler\isAnimatedImage(), DjVuHandler\isExpensiveToThumbnail(), TiffHandler\isExpensiveToThumbnail(), TransformationalImageHandler\isImageAreaOkForThumbnaling(), MovePage\isValidFileMove(), MovePage\isValidMoveTarget(), Title\isValidMoveTarget(), JobRunner\loadBackoffs(), Benchmarker\loadFile(), BackupDumper\loadPlugin(), Wikimedia\Services\ServiceContainer\loadWiringFiles(), RecompressTracked\logToFile(), Linker\makeBrokenImageLinkObj(), Parser\makeImage(), DummyLinker\makeImageLink(), Linker\makeImageLink(), DummyLinker\makeMediaLinkFile(), Linker\makeMediaLinkFile(), ResourceLoader\makeModuleResponse(), SqliteInstaller\makeStubDBFile(), DummyLinker\makeThumbLink2(), Linker\makeThumbLink2(), DummyLinker\makeThumbLinkObj(), Linker\makeThumbLinkObj(), MovePage\moveFile(), TransformationalImageHandler\mustRender(), ImportStreamSource\newFromFile(), ForeignDBFile\newFromRow(), OldLocalFile\newFromRow(), LocalFile\newFromRow(), ArchivedFile\newFromRow(), ImportStreamSource\newFromURL(), ImageBuilder\oldimageCallback(), DumpUploads\outputItem(), SpecialUploadStash\outputLocallyScaledThumb(), SpecialUploadStash\outputRemoteScaledThumb(), SpecialUploadStash\outputThumbFromStash(), SpecialUploadStash\parseKey(), ApiUpload\performUpload(), ExtensionRegistry\processAutoLoader(), BackupDumper\processOptions(), DummyLinker\processResponsiveImages(), Linker\processResponsiveImages(), ResourcesTest\provideMediaStylesheets(), AutoLoaderStructureTest\providePSR4Completeness(), ResourcesTest\provideResourceFiles(), FileContentsHasherTest\provideSingleFile(), PruneFileCache\prune_directory(), FileRepo\publishBatch(), PurgeChangedFiles\purgeFromLogType(), LocalFile\purgeOldThumbnails(), LocalFile\purgeThumbList(), ForeignAPIFile\purgeThumbnails(), LocalFile\purgeThumbnails(), DjVuImage\readChunk(), AutoloadGenerator\readDir(), ResourceLoaderFileModule\readStyleFile(), ResourceLoaderFileModule\readStyleFiles(), CSSMin\remap(), CSSMin\remapOne(), MediaWiki\Widget\Search\FullSearchResultWidget\render(), Parser\renderImageGallery(), Parser\replaceInternalLinks2(), CheckStorage\restoreText(), JpegHandler\rotate(), BitmapHandler\rotate(), ThumbnailRenderJob\run(), ApiQueryDuplicateFiles\run(), ApiQueryAllImages\run(), WikiFilePage\setFile(), ImagePage\setFile(), OutputPage\setFileVersion(), ImportLinkCacheIntegrationTest\setUp(), Dump7ZipOutput\setup7zCommand(), MediaWiki\Tests\Maintenance\DumpTestCase\setUpBeforeClass(), ParserEditTests\setupFileData(), SpecialUndelete\showFileConfirmationForm(), EditPage\showIntro(), SpecialUploadStash\showUploads(), SpecialUpload\showUploadWarning(), DjVuImage\skipChunk(), TextSuppressor\suppress(), CheckStyleSuppressor\suppress(), JobRunner\syncBackoffDeltas(), FileTest\testCanAnimateThumbIfAppropriate(), SvgHandlerTest\testGetAvailableLanguages(), PNGHandlerTest\testGetImageArea(), GIFHandlerTest\testGetImageArea(), XCFHandlerTest\testGetImageSize(), SvgHandlerTest\testGetIndependentMetaArray(), JpegTest\testGetIndependentMetaArray(), GIFHandlerTest\testGetIndependentMetaArray(), PNGHandlerTest\testGetIndependentMetaArray(), PNGHandlerTest\testGetLength(), GIFHandlerTest\testGetLength(), XCFHandlerTest\testGetMetadata(), GIFHandlerTest\testGetMetadata(), PNGHandlerTest\testGetMetadata(), CSSMinTest\testGetMimeType(), DjVuTest\testGetPageDimensions(), DjVuTest\testGetPageText(), BitmapScalingTest\testImageArea(), SiteImporterTest\testImportFromFile(), FormatMetadataTest\testInvalidDate(), JpegTest\testInvalidFile(), PNGHandlerTest\testIsAnimanted(), GIFHandlerTest\testIsAnimanted(), JpegTest\testJpegMetadataExtraction(), ExifRotationTest\testMetadata(), ExifRotationTest\testMetadataAutoRotate(), ExifRotationTest\testMetadataAutoRotateUnsupported(), ExifRotationTest\testMetadataNoAutoRotate(), MimeAnalyzerTest\testMP3AsAudio(), MimeAnalyzerTest\testMP3NoID3RecognizeMPEG1(), MimeAnalyzerTest\testMP3NoID3RecognizeMPEG2(), MimeAnalyzerTest\testMP3NoID3RecognizeMPEG2_5(), MimeAnalyzerTest\testMP3WithID3Recognize(), BitmapScalingTest\testNormaliseParams(), SvgHandlerTest\testNormaliseParamsInternal(), DjVuTest\testPageCount(), JpegPixelFormatTest\testPixelFormatRendering(), AutoLoaderStructureTest\testPSR4Completeness(), ExifRotationTest\testRotationRendering(), ExifRotationTest\testRotationRenderingNoAutoRotate(), JpegTest\testSwappingICCProfile(), UploadStashTest\testT31408(), BitmapScalingTest\testTooBigImage(), BitmapScalingTest\testTooBigMustRenderImage(), JpegMetadataExtractorTest\testUtf8Comment(), ExtensionJsonValidatorTest\testValidate(), LocalFileTest\testWfLocalFile(), MimeAnalyzerTest\testZipInDoc(), Language\transformUsingPairFile(), ApiUpload\transformWarnings(), UploadBase\tryStashFile(), wfBacktrace(), wfExtractThumbParams(), wfGetPrecompiledData(), wfIsBadImage(), and XmlDumpWriter\writeUpload().

◆ $lines

$lines = explode( "\n", file_get_contents( "includes/libs/mime/mime.types" ) )

Definition at line 61 of file router.php.

Referenced by DiffOpAdd\__construct(), DiffOpDelete\__construct(), UnifiedDiffFormatter\added(), TableDiffFormatter\added(), DiffFormatter\added(), Skin\addToSidebarPlain(), WordLevelDiff\closing(), Diff\closing(), TableDiffFormatter\context(), DiffFormatter\context(), UnifiedDiffFormatter\deleted(), TableDiffFormatter\deleted(), DiffFormatter\deleted(), Parser\doAllQuotes(), Parser\doTableStuff(), Installer\envCheckShellLocale(), MediaWiki\Shell\Command\execute(), MediaWiki\Tests\Maintenance\DumpTestCase\expectETAOutput(), HTMLFormField\formatErrors(), UploadBase\getFilenamePrefixBlacklist(), WikiTextStructure\getIgnoredHeadings(), RandomImageGenerator\getRandomLines(), RandomImageGenerator\getRandomWordPairs(), MediaWiki\Rest\HeaderContainer\getRawHeaderLines(), FormatMetadata\getVisibleFields(), SearchHighlighter\highlightSimple(), MediaWiki\Block\DatabaseBlock\isWhitelistedFromAutoblocks(), UnifiedDiffFormatter\lines(), DiffFormatter\lines(), MimeAnalyzer\loadFiles(), WordLevelDiff\orig(), Diff\orig(), ForeignResourceManager\parseBasicYaml(), WikiTextStructure\parseSettingsInMessage(), SquidPurgeClient\processReadBuffer(), EnhancedChangesList\recentChangesBlockGroup(), Parser\renderImageGallery(), WordLevelDiff\split(), MediaWiki\Tests\Rest\HeaderContainerTest\testAddHeader(), HashRingTest\testHashRingKetamaMode(), MediaWiki\Tests\Rest\HeaderContainerTest\testRemoveHeader(), MediaWiki\Tests\Rest\HeaderContainerTest\testSetHeader(), wfIsBadImage(), and MediaWiki\Logger\Monolog\MwlogHandler\write().

◆ else

foreach ($lines as $line) if (preg_match('#^text/#', $mime) else)
Initial value:
{
$mime = 'text/plain'

Definition at line 52 of file router.php.

◆ true

return true

Definition at line 82 of file router.php.