Go to the documentation of this file.
34 global $wgDjvuRenderer, $wgDjvuDump, $wgDjvuToXML;
35 if ( !$wgDjvuRenderer || ( !$wgDjvuDump && !$wgDjvuToXML ) ) {
36 wfDebug(
"DjVu is disabled, please set \$wgDjvuRenderer and \$wgDjvuDump\n" );
65 'img_width' =>
'width',
76 if ( in_array(
$name,
array(
'width',
'height',
'page' ) ) ) {
93 if ( !isset(
$params[
'width'] ) ) {
97 return "page{$page}-{$params['width']}px";
106 if ( preg_match(
'/^page(\d+)-(\d+)px$/', $str, $m ) ) {
107 return array(
'width' => $m[2],
'page' => $m[1] );
133 global $wgDjvuRenderer, $wgDjvuPostProcessor;
137 $xml = $image->getMetadata();
152 if ( $page > $this->
pageCount( $image ) ) {
161 if (
$flags & self::TRANSFORM_LATER ) {
183 if ( $image->getSize() >= 1e7 ) {
186 'doWork' =>
function() use ( $image ) {
187 return $image->getLocalRefPath();
191 $srcPath = $work->execute();
193 $srcPath = $image->getLocalRefPath();
196 if ( $srcPath ===
false ) {
198 sprintf(
'Thumbnail failed on %s: could not get local copy of "%s"',
207 # Use a subshell (brackets) to aggregate stderr from both pipeline commands
208 # before redirecting it to the overall stdout. This works in both Linux and Windows XP.
213 "-size={$params['physicalWidth']}x{$params['physicalHeight']}",
215 if ( $wgDjvuPostProcessor ) {
216 $cmd .=
" | {$wgDjvuPostProcessor}";
220 wfDebug( __METHOD__ .
": $cmd\n" );
226 if (
$retval != 0 || $removed ) {
249 $deja =
new DjVuImage(
$path );
250 } elseif ( !isset( $image->dejaImage ) ) {
251 $deja = $image->dejaImage =
new DjVuImage(
$path );
253 $deja = $image->dejaImage;
266 $metadata =
$file->getMetadata();
267 if ( substr( $metadata, 0, 3 ) ===
'<?xml' ) {
273 $unser = unserialize( $metadata );
275 if ( is_array( $unser ) ) {
276 return $unser[
'xml'];
290 if ( $gettext && isset( $image->djvuTextTree ) ) {
291 return $image->djvuTextTree;
293 if ( !$gettext && isset( $image->dejaMetaTree ) ) {
294 return $image->dejaMetaTree;
299 wfDebug(
"DjVu XML metadata is invalid or missing, should have been fixed in upgradeRow\n" );
308 $image->dejaMetaTree =
false;
309 $image->djvuTextTree =
false;
310 $tree =
new SimpleXMLElement( $metadata );
311 if ( $tree->getName() ==
'mw-djvu' ) {
313 foreach ( $tree->children()
as $b ) {
314 if ( $b->getName() ==
'DjVuTxt' ) {
317 $image->djvuTextTree = $b;
318 } elseif ( $b->getName() ==
'DjVuXML' ) {
319 $image->dejaMetaTree = $b;
323 $image->dejaMetaTree = $tree;
325 }
catch ( Exception
$e ) {
326 wfDebug(
"Bogus multipage XML metadata on '{$image->getName()}'\n" );
331 return $image->djvuTextTree;
333 return $image->dejaMetaTree;
347 global $wgDjvuOutputExtension;
349 if ( !isset(
$mime ) ) {
350 $magic = MimeMagic::singleton();
351 $mime = $magic->guessTypesForExtension( $wgDjvuOutputExtension );
354 return array( $wgDjvuOutputExtension,
$mime );
358 wfDebug(
"Getting DjVu metadata for $path\n" );
361 if ( $xml ===
false ) {
364 return serialize(
array(
'xml' => $xml ) );
373 return !empty( $metadata ) && $metadata != serialize(
array() );
382 return count( $tree->xpath(
'//OBJECT' ) );
391 $o = $tree->BODY[0]->OBJECT[$page - 1];
394 'width' => intval( $o[
'width'] ),
395 'height' => intval( $o[
'height'] )
413 $o = $tree->BODY[0]->PAGE[$page - 1];
isMetadataValid( $image, $metadata)
Check if the metadata string is valid for this handler.
Media transform output for images.
wfShellExec( $cmd, &$retval=null, $environ=array(), $limits=array(), $options=array())
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string $mime
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
pageCount( $image)
Page count for a multi-page document, false if unsupported or unknown.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
getUnserializedMetadata(File $file)
Get metadata, unserializing it if neccessary.
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfProfileIn( $functionname)
Begin profiling of a function.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
wfHostname()
Fetch server name for use in error reporting etc.
Convenience class for dealing with PoolCounters using callbacks.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
makeParamString( $params)
getMetadata( $image, $path)
Get handler-specific metadata which will be saved in the img_metadata field.
getDjVuImage( $image, $path)
Cache an instance of DjVuImage in an Image object, return that instance.
Implements some public methods and some protected utility functions which are required by multiple ch...
wfRestoreWarnings()
Restore error level to previous value.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Media handler abstract base class for images.
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 after in associative array form externallinks including delete and has completed for all link tables 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 "<
validateParam( $name, $value)
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
normaliseParams( $image, &$params)
getImageSize( $image, $path)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Allows to change the fields on the form that will be generated $name
getPageText( $image, $page)
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell,...
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
getScriptParams( $params)
if(PHP_SAPI !='cli') $file
getThumbType( $ext, $mime, $params=null)
Get the thumbnail extension and MIME type for a given source MIME type.
doTransform( $image, $dstPath, $dstUrl, $params, $flags=0)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getMetaTree( $image, $gettext=false)
Cache a document tree for the DjVu XML metadata.
getPageDimensions( $image, $page)
Get an associative array of page dimensions Currently "width" and "height" are understood,...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval