r49733 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49732‎ | r49733 | r49734 >
Date:10:45, 22 April 2009
Author:jojo
Status:ok
Tags:
Comment:
check if Skin::getTitle() is available before using it (fixes 49665 for older MediaWikis)
Modified paths:
  • /trunk/extensions/Collection/Collection.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.hooks.php
@@ -38,10 +38,15 @@
3939 wfLoadExtensionMessages( 'CollectionCore' );
4040
4141 $action = $wgRequest->getVal('action');
 42+ if ( method_exists( $skinTemplate, 'getTitle' ) ) {
 43+ $title = $skinTemplate->getTitle();
 44+ } else {
 45+ $title = $skinTemplate->mTitle;
 46+ }
4247
4348 if ( $skinTemplate->iscontent && ( $action == '' || $action == 'view' || $action == 'purge' ) ) {
44 - if ( self::_isCollectionPage( $skinTemplate->getTitle(), $wgArticle ) ) {
45 - $params = 'colltitle=' . wfUrlencode( $skinTemplate->getTitle()->getPrefixedDBKey() );
 49+ if ( self::_isCollectionPage( $title, $wgArticle ) ) {
 50+ $params = 'colltitle=' . wfUrlencode( $title->getPrefixedDBKey() );
4651 if ( isset( $wgCollectionFormats['rl'] ) ) {
4752 $nav_urls['printable_version_pdf'] = array(
4853 'href' => SkinTemplate::makeSpecialUrlSubpage(
@@ -54,7 +59,7 @@
5560 foreach ( $wgCollectionFormats as $writer => $name ) {
5661 }
5762 } else {
58 - $params = 'arttitle=' . $skinTemplate->getTitle()->getPrefixedURL();
 63+ $params = 'arttitle=' . $title->getPrefixedURL();
5964 if( $wgArticle ) {
6065 $oldid = $wgArticle->getOldID();
6166 if ( $oldid ) {
@@ -309,11 +314,11 @@
310315 <script type="text/javascript">
311316 /* <![CDATA[ */
312317 wgCollectionNavPopupJSURL = '$wgCollectionNavPopupJSURL';
313 - wgCollectionNavPopupCSSURL = '$wgCollectionNavPopupCSSURL';
314 - wgCollectionAddPageText = '$addPageText';
315 - wgCollectionAddCategoryText = '$addCategoryText';
316 - wgCollectionRemovePageText = '$removePageText';
317 - wgCollectionPopupHelpText = '$popupHelpText';
 318+ wgCollectionNavPopupCSSURL = '$wgCollectionNavPopupCSSURL';
 319+ wgCollectionAddPageText = '$addPageText';
 320+ wgCollectionAddCategoryText = '$addCategoryText';
 321+ wgCollectionRemovePageText = '$removePageText';
 322+ wgCollectionPopupHelpText = '$popupHelpText';
318323 wgCollectionArticleNamespaces = [
319324 EOS
320325 ;

Status & tagging log