r86808 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86807‎ | r86808 | r86809 >
Date:07:11, 24 April 2011
Author:nad
Status:deferred
Tags:
Comment:
Bail if page inappropriate for attachments
Modified paths:
  • /trunk/extensions/FileAttach/FileAttach.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FileAttach/FileAttach.php
@@ -9,7 +9,7 @@
1010 *
1111 */
1212 if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' );
13 -define( 'FILEATTCH_VERSION', '1.0.1, 2010-04-16' );
 13+define( 'FILEATTCH_VERSION', '1.0.2, 2010-04-24' );
1414
1515 $wgAttachmentHeading = 'Attachments';
1616
@@ -45,6 +45,9 @@
4646 function onBeforePageDisplay( &$out, &$skin ) {
4747 global $wgParser, $wgAttachmentHeading;
4848
 49+ # Bail if page inappropriate for attachments
 50+ if( !is_object( $wgParser ) || !is_object( $wgParser->mOutput )|| !isset( $wgParser->mOutput->mSections ) ) return true;
 51+
4952 # If the last section in the article is level 2 and "Attachments" then convert to file icons
5053 $sections = $wgParser->mOutput->mSections;
5154 if( is_array( $sections ) && count( $sections ) > 0 ) {

Status & tagging log