109 if ( $this->path ===
false ) {
158 return ( !$this->
isError() && ( $this->path || $this->path ===
null ) );
168 return ( !$this->
isError() && $this->path ===
null );
180 } elseif ( $this->path ===
null ) {
181 return $this->
file->getLocalRefPath();
183 $be = $this->
file->getRepo()->getBackend();
185 $fsFile = $be->getLocalReference( [
'src' => $this->path ] );
187 return $fsFile ? $fsFile->getPath() :
false;
201 if ( !$this->path ) {
202 return Status::newFatal(
'backend-fail-stream',
'<no path>' );
204 $be = $this->
file->getRepo()->getBackend();
205 return $be->streamFile( [
'src' => $this->path,
'headers' => $headers ] );
208 return $success ? Status::newGood() : Status::newFatal(
'backend-fail-stream', $this->path );
230 protected function linkWrap( $linkAttribs, $contents ) {
231 if ( $linkAttribs ) {
232 return Xml::tags(
'a', $linkAttribs, $contents );
249 if ( $this->
page && $this->
page !== 1 ) {
261 'href' => $this->
file->getTitle()->getLocalURL(
$query ),
291 # Previous parameters:
292 # $file, $url, $width, $height, $path = false, $page = false
299 if ( is_array( $parameters ) ) {
300 $actualParams = $parameters + $defaults;
302 # Using old format, should convert. Later a warning could be added here.
303 $numArgs = func_num_args();
306 'height' => $parameters,
307 'page' => ( $numArgs > 5 ) ? func_get_arg( 5 ) :
false
309 $path = ( $numArgs > 4 ) ? func_get_arg( 4 ) :
false;
316 # These should be integers when they get here.
317 # If not, there's a bug somewhere. But let's at
318 # least produce valid HTML code regardless.
319 $this->
width = round( $actualParams[
'width'] );
320 $this->height = round( $actualParams[
'height'] );
322 $this->
page = $actualParams[
'page'];
323 $this->lang = $actualParams[
'lang'];
359 if ( count( func_get_args() ) == 2 ) {
360 throw new MWException( __METHOD__ .
' called in the old style' );
372 if ( !empty(
$options[
'custom-url-link'] ) ) {
373 $linkAttribs = [
'href' =>
$options[
'custom-url-link'] ];
374 if ( !empty(
$options[
'title'] ) ) {
375 $linkAttribs[
'title'] =
$options[
'title'];
377 if ( !empty(
$options[
'custom-target-link'] ) ) {
378 $linkAttribs[
'target'] =
$options[
'custom-target-link'];
379 } elseif ( !empty(
$options[
'parser-extlink-target'] ) ) {
380 $linkAttribs[
'target'] =
$options[
'parser-extlink-target'];
382 if ( !empty(
$options[
'parser-extlink-rel'] ) ) {
383 $linkAttribs[
'rel'] =
$options[
'parser-extlink-rel'];
385 } elseif ( !empty(
$options[
'custom-title-link'] ) ) {
389 'href' =>
$title->getLinkURL(),
392 } elseif ( !empty(
$options[
'desc-link'] ) ) {
397 } elseif ( !empty(
$options[
'file-link'] ) ) {
398 $linkAttribs = [
'href' => $this->
file->getUrl() ];
400 $linkAttribs =
false;
401 if ( !empty(
$options[
'title'] ) ) {
406 if ( empty(
$options[
'no-dimensions'] ) ) {
410 if ( !empty(
$options[
'valign'] ) ) {
411 $attribs[
'style'] =
"vertical-align: {$options['valign']}";
413 if ( !empty(
$options[
'img-class'] ) ) {
416 if ( isset(
$options[
'override-height'] ) ) {
419 if ( isset(
$options[
'override-width'] ) ) {
430 Hooks::run(
'ThumbnailBeforeProduceHTML', [ $this, &
$attribs, &$linkAttribs ] );
446 $args = array_slice( func_get_args(), 3 );
449 $this->height = intval(
$height );
455 return "<div class=\"MediaTransformError\" style=\"" .
456 "width: {$this->width}px; height: {$this->height}px; display:inline-block;\">" .
462 return $this->msg->text();
466 return $this->msg->escaped();
489 parent::__construct(
'thumbnail_error',
490 max(
$params[
'width'] ?? 0, 120 ),
491 max(
$params[
'height'] ?? 0, 120 ),
511 $msg->
getLanguage()->formatComputingNumbers( $maxImageArea, 1000,
"size-$1pixel" )
514 parent::__construct(
'thumbnail_error',
515 max(
$params[
'width'] ?? 0, 120 ),
516 max(
$params[
'height'] ?? 0, 120 ),
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
static extensionFromPath( $path, $case='lowercase')
Get the final extension from a storage or FS path.
Implements some public methods and some protected utility functions which are required by multiple ch...
The Message class provides methods which fulfil two basic services:
params()
Adds parameters to the parameter list of this message.
getLanguage()
Returns the Language of the Message.
static stream( $fname, $headers=[], $sendErrors=true, $optHeaders=[], $flags=0)
Stream a file to the browser, adding all the headings and fun stuff.
Media transform output for images.
__construct( $file, $url, $path=false, $parameters=[])
Get a thumbnail object from a file and parameters.
toHtml( $options=[])
Return HTML.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
namespace and then decline to actually register it file or subcat img or subcat $title
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
processing should stop and the error should be shown to the user * false
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))