MediaWiki master
MediaWiki\FileRepo\ThumbnailEntryPoint Class Reference

Inherits MediaWiki\MediaWikiEntryPoint.

Inherited by MediaWiki\FileRepo\Thumbnail404EntryPoint.

Collaboration diagram for MediaWiki\FileRepo\ThumbnailEntryPoint:

Public Member Functions

 execute ()
 Main entry point.
 
- Public Member Functions inherited from MediaWiki\MediaWikiEntryPoint
 __construct (IContextSource $context, EntryPointEnvironment $environment, MediaWikiServices $mediaWikiServices)
 
 enableOutputCapture ()
 Enable capturing of the current output buffer.
 
 getCapturedOutput ()
 Stop capturing and return all output.
 
 getRequestPathSuffix ( $basePath)
 If the request URL matches a given base path, extract the path part of the request URL after that base, and decode escape sequences in it.
 
 run ()
 Main app life cycle: Calls doSetup(), execute(), prepareForOutput(), and postOutputShutdown().
 

Protected Member Functions

 doPrepareForOutput ()
 Prepare for sending the output.
 
 generateThumbnail (File $file, array $params, $thumbName, $thumbPath)
 Actually try to generate a new thumbnail.
 
 handleRequest ()
 
 streamThumb (array $params)
 Stream a thumbnail specified by parameters.
 
 thumbError ( $status, $msgHtml, $msgText=null, $context=[])
 Output a thumbnail generation error message.
 
 thumbErrorText ( $status, $msgText)
 Output a thumbnail generation error message.
 
- Protected Member Functions inherited from MediaWiki\MediaWikiEntryPoint
 commitMainTransaction ()
 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.
 
 commitOutputBuffer ()
 Ends the current output buffer, appending its content to the parent buffer.
 
 disableModDeflate ()
 
 discardAllOutput ()
 Discards all buffered output, down to the capture buffer level.
 
 discardOutputBuffer ()
 
 doPostOutputShutdown ()
 Forces the response to be sent to the client and then does work that can be done after the user gets the HTTP response, so they don't block on it.
 
 doSetup ()
 Perform any setup needed before execute() is called.
 
 drainOutputBuffer ()
 Returns the content of the current output buffer and clears it.
 
 enterPostSendMode ()
 Disables all output to the client.
 
 exit (int $code=0)
 
 fastCgiFinishRequest ()
 Calls fastcgi_finish_request if possible.
 
 flushOutputBuffer ()
 Flush buffered output to the client.
 
 getBlockManager ()
 
 getConfig (string $key)
 
 getContext ()
 
 getDBLoadBalancerFactory ()
 
 getEnv (string $name)
 Returns the value of an environment variable.
 
 getIni (string $name)
 Returns the value of an ini option.
 
 getJobQueueGroupFactory ()
 
 getJobRunner ()
 
 getMessageCache ()
 
 getOutputBufferLength ()
 
 getOutputBufferLevel ()
 Returns the output buffer level.
 
 getOutputBufferStatus ()
 
 getReadOnlyMode ()
 
 getRequest ()
 
 getRequestURL ()
 Returns the current request's path and query string (not a full URL), like PHP's built-in $_SERVER['REQUEST_URI'].
 
 getResponse ()
 
 getServerInfo (string $key, $default=null)
 
 getServiceContainer ()
 Returns the main service container.
 
 getSpecialPageFactory ()
 
 getStatsdDataFactory ()
 
 getStatsFactory ()
 
 getStatusCode ()
 
 getUrlUtils ()
 
 handleTopLevelError (Throwable $e)
 Report a top level error.
 
 hasFastCgi ()
 
 header (string $header, bool $replace=true, int $status=0)
 
 inPostSendMode ()
 Whether enterPostSendMode() has been called.
 
 isCli ()
 
 outputResponsePayload ( $content)
 Print a response body to the current buffer (if there is one) or the server (otherwise)
 
 postOutputShutdown ()
 Forces the response to be sent to the client and then does work that can be done after the user gets the HTTP response, so they don't block on it.
 
 prepareForOutput ()
 Prepare for sending the output.
 
 print ( $data)
 
 restInPeace ()
 Ends this task peacefully.
 
 schedulePostSendJobs ()
 If enabled, after everything specific to this request is done, occasionally run jobs.
 
 setIniOption (string $name, $value)
 
 setup ()
 Perform any setup needed before execute() is called.
 
 shouldDoHttpRedirect ()
 Check if an HTTP->HTTPS redirect should be done.
 
 startOutputBuffer (?callable $callback=null)
 Adds a new output buffer level.
 
 status (int $code)
 
 triggerAsyncJobs ( $n, LoggerInterface $runJobsLogger)
 
 triggerError (string $message, int $level=E_USER_NOTICE)
 Triggers a PHP runtime error.
 
 triggerSyncJobs ( $n)
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\MediaWikiEntryPoint
static emitBufferedStatsdData (IBufferingStatsdDataFactory $stats, Config $config)
 Send out any buffered statsd data according to sampling rules.
 
- Protected Attributes inherited from MediaWiki\MediaWikiEntryPoint
EntryPointEnvironment $environment
 

Detailed Description

Definition at line 53 of file ThumbnailEntryPoint.php.

Member Function Documentation

◆ doPrepareForOutput()

MediaWiki\FileRepo\ThumbnailEntryPoint::doPrepareForOutput ( )
protected

Prepare for sending the output.

Should be called by entry points before sending the response. Will be called automatically by run() via prepareForOutput(). Subclasses may override this method, but should not call it directly.

Note
arc-lamp profiling relies on the name of this method, it's hard coded in the arclamp-generate-svgs script!

Reimplemented from MediaWiki\MediaWikiEntryPoint.

Definition at line 75 of file ThumbnailEntryPoint.php.

◆ execute()

MediaWiki\FileRepo\ThumbnailEntryPoint::execute ( )

◆ generateThumbnail()

MediaWiki\FileRepo\ThumbnailEntryPoint::generateThumbnail ( File $file,
array $params,
$thumbName,
$thumbPath )
protected

Actually try to generate a new thumbnail.

Parameters
File$file
array$params
string$thumbName
string$thumbPath
Returns
array (MediaTransformOutput|bool, string|bool error message HTML)

Definition at line 470 of file ThumbnailEntryPoint.php.

References $params, MediaWiki\MainConfigNames\AttemptFailureEpoch, MediaWiki\PoolCounter\PoolCounterWork\execute(), MediaWiki\MediaWikiEntryPoint\getConfig(), MediaWiki\MediaWikiEntryPoint\getContext(), File\getName(), File\getRepo(), File\getSha1(), File\isExpensiveToThumbnail(), and File\transform().

Referenced by MediaWiki\FileRepo\ThumbnailEntryPoint\streamThumb().

◆ handleRequest()

MediaWiki\FileRepo\ThumbnailEntryPoint::handleRequest ( )
protected

◆ streamThumb()

MediaWiki\FileRepo\ThumbnailEntryPoint::streamThumb ( array $params)
protected

Stream a thumbnail specified by parameters.

Parameters
array$paramsList of thumbnailing parameters. In addition to parameters passed to the MediaHandler, this may also includes the keys: f (for filename), archived (if archived file), temp (if temp file), w (alias for width), p (alias for page), r (ignored; historical), rel404 (path for render on 404 to verify hash path correct), thumbName (thumbnail name to potentially extract more parameters from e.g. 'lossy-page1-120px-Foo.tiff' would add page, lossy and width to the parameters)
Returns
void

Definition at line 98 of file ThumbnailEntryPoint.php.

References $params, MediaWiki\FileRepo\ThumbnailEntryPoint\generateThumbnail(), MediaWiki\MediaWikiEntryPoint\getConfig(), MediaWiki\MediaWikiEntryPoint\getContext(), MediaWiki\MediaWikiServices\getInstance(), MessageSpecifier\getKey(), MediaWiki\MediaWikiEntryPoint\getResponse(), MediaWiki\MediaWikiEntryPoint\getServerInfo(), MediaWiki\MediaWikiEntryPoint\header(), NS_FILE, MediaWiki\MediaWikiEntryPoint\prepareForOutput(), PROTO_CURRENT, MediaWiki\MediaWikiEntryPoint\status(), MediaWiki\FileRepo\ThumbnailEntryPoint\thumbError(), MediaWiki\FileRepo\ThumbnailEntryPoint\thumbErrorText(), MediaWiki\MainConfigNames\VaryOnXFP, wfExpandUrl(), wfThumbIsStandard(), and wfTimestamp().

Referenced by MediaWiki\FileRepo\Thumbnail404EntryPoint\handleRequest(), and MediaWiki\FileRepo\ThumbnailEntryPoint\handleRequest().

◆ thumbError()

MediaWiki\FileRepo\ThumbnailEntryPoint::thumbError ( $status,
$msgHtml,
$msgText = null,
$context = [] )
protected

Output a thumbnail generation error message.

Parameters
int$status
string$msgHtmlHTML
string | null$msgTextShort error description, for internal logging. Defaults to $msgHtml. Only used for HTTP 500 errors.
array$contextError context, for internal logging. Only used for HTTP 500 errors.
Returns
void

Definition at line 619 of file ThumbnailEntryPoint.php.

References MediaWiki\MediaWikiEntryPoint\getConfig(), MediaWiki\MediaWikiEntryPoint\getResponse(), MediaWiki\MediaWikiEntryPoint\getServerInfo(), MediaWiki\MediaWikiEntryPoint\header(), MediaWiki\MediaWikiEntryPoint\print(), MediaWiki\MainConfigNames\ShowHostnames, MediaWiki\MediaWikiEntryPoint\status(), MediaWiki\Request\HeaderCallback\warnIfHeadersSent(), and wfHostname().

Referenced by MediaWiki\FileRepo\Thumbnail404EntryPoint\handleRequest(), MediaWiki\FileRepo\ThumbnailEntryPoint\streamThumb(), and MediaWiki\FileRepo\ThumbnailEntryPoint\thumbErrorText().

◆ thumbErrorText()

MediaWiki\FileRepo\ThumbnailEntryPoint::thumbErrorText ( $status,
$msgText )
protected

Output a thumbnail generation error message.

Parameters
int$status
string$msgTextPlain text (will be html escaped)
Returns
void

Definition at line 605 of file ThumbnailEntryPoint.php.

References MediaWiki\FileRepo\ThumbnailEntryPoint\thumbError().

Referenced by MediaWiki\FileRepo\ThumbnailEntryPoint\streamThumb().


The documentation for this class was generated from the following file: