summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialFilepath.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/specials/SpecialFilepath.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/specials/SpecialFilepath.php')
-rw-r--r--includes/specials/SpecialFilepath.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/includes/specials/SpecialFilepath.php b/includes/specials/SpecialFilepath.php
index 8bb0890c..08f90fd2 100644
--- a/includes/specials/SpecialFilepath.php
+++ b/includes/specials/SpecialFilepath.php
@@ -40,19 +40,25 @@ class SpecialFilepath extends SpecialPage {
$file = !is_null( $par ) ? $par : $wgRequest->getText( 'file' );
- $title = Title::makeTitleSafe( NS_FILE, $file );
+ $title = Title::newFromText( $file, NS_FILE );
if ( ! $title instanceof Title || $title->getNamespace() != NS_FILE ) {
$this->showForm( $title );
} else {
$file = wfFindFile( $title );
+
if ( $file && $file->exists() ) {
+ // Default behaviour: Use the direct link to the file.
$url = $file->getURL();
$width = $wgRequest->getInt( 'width', -1 );
$height = $wgRequest->getInt( 'height', -1 );
+
+ // If a width is requested...
if ( $width != -1 ) {
$mto = $file->transform( array( 'width' => $width, 'height' => $height ) );
+ // ... and we can
if ( $mto && !$mto->isError() ) {
+ // ... change the URL to point to a thumbnail.
$url = $mto->getURL();
}
}
@@ -64,6 +70,9 @@ class SpecialFilepath extends SpecialPage {
}
}
+ /**
+ * @param $title Title
+ */
function showForm( $title ) {
global $wgOut, $wgScript;