Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3324
ifexist.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 9:27 PM
2014-11-21 21:27:09 (UTC+0)
Size
768 B
Referenced Files
None
Subscribers
None
ifexist.patch
View Options
Index: extensions/ParserFunctions/ParserFunctions.php
===================================================================
--- extensions/ParserFunctions/ParserFunctions.php (revision 17981)
+++ extensions/ParserFunctions/ParserFunctions.php (arbetskopia)
@@ -163,6 +163,17 @@
function ifexist( &$parser, $title = '', $then = '', $else = '' ) {
$title = Title::newFromText( $title );
+
+ /* If namespace is specified as NS_MEDIA, then we want to check the physical file,
+ * not the "description" page.
+ */
+ if( $title->getNamespace() == NS_MEDIA ) {
+
+ $image = new Image( $title );
+ return is_object( $image ) && $image->exists() ? $then : $else;
+
+ }
+
return is_object( $title ) && $title->exists() ? $then : $else;
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2893
Default Alt Text
ifexist.patch (768 B)
Attached To
Mode
T9985: #ifexist parser function returns false for image pages from shared repository (Commons)
Attached
Detach File
Event Timeline
Log In to Comment