r46028 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46027‎ | r46028 | r46029 >
Date:17:12, 22 January 2009
Author:ialex
Status:deferred
Tags:
Comment:
Fix E_STRICT: Creating default object from empty value dans includes/parser/Parser.php on line 4498
This is caused by the call of Parser::disableCache()
Modified paths:
  • /trunk/extensions/SocialProfile/UserProfile/UserProfile.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserProfile/UserProfile.php
@@ -5,6 +5,8 @@
66
77 // Default setup for displaying sections
88 $wgUserPageChoice = true;
 9+
 10+
911 $wgUserProfileDisplay['friends'] = false;
1012 $wgUserProfileDisplay['foes'] = false;
1113 $wgUserProfileDisplay['gifts'] = true;
@@ -38,11 +40,17 @@
3941
4042 $wgHooks['ArticleFromTitle'][] = 'wfUserProfileFromTitle';
4143
42 -// ArticleFromTitle
43 -// Calls UserProfilePage instead of standard article
 44+/**
 45+ * called by ArticleFromTitle hook
 46+ * Calls UserProfilePage instead of standard article
 47+ *
 48+ * @param &$title Title object
 49+ * @param &$article Article object
 50+ * @return true
 51+ */
4452 function wfUserProfileFromTitle( &$title, &$article ){
45 - global $wgUser, $wgRequest, $IP, $wgOut, $wgTitle, $wgSupressPageTitle, $wgSupressSubTitle, $wgMemc,
46 - $wgUserPageChoice, $wgParser, $wgUserProfileDirectory, $wgUserProfileScripts, $wgStyleVersion;
 53+ global $IP, $wgUser, $wgRequest, $wgOut, $wgTitle, $wgMemc, $wgStyleVersion, $wgHooks,
 54+ $wgUserPageChoice, $wgUserProfileScripts;
4755
4856 if ( strpos( $title->getText(), "/" ) === false && ( NS_USER == $title->getNamespace() || NS_USER_PROFILE == $title->getNamespace() ) ) {
4957
@@ -59,21 +67,33 @@
6068
6169 if( !$show_user_page ){
6270 // Prevents editing of userpage
63 - if( $wgRequest->getVal('action') == 'edit' ){
 71+ if( $wgRequest->getVal( 'action' ) == 'edit' ){
6472 $wgOut->redirect( $title->getFullURL() );
6573 }
6674 } else {
67 - $wgOut->enableClientCache(false);
68 - $wgParser->disableCache();
 75+ $wgOut->enableClientCache( false );
 76+ $wgHooks['ParserLimitReport'][] = 'wfUserProfileMarkUncacheable';
6977 }
7078
71 - $wgOut->addScript("<link rel='stylesheet' type='text/css' href=\"{$wgUserProfileScripts}/UserProfile.css?{$wgStyleVersion}\"/>\n");
 79+ $wgOut->addScript( "<link rel='stylesheet' type='text/css' href=\"{$wgUserProfileScripts}/UserProfile.css?{$wgStyleVersion}\"/>\n" );
7280
7381 $article = new UserProfilePage( $title );
7482 }
7583 return true;
7684 }
7785
 86+/**
 87+ * Mark page as uncacheable
 88+ *
 89+ * @param $parser Parser object
 90+ * @param &$limitReport String: unused
 91+ * @return true
 92+ */
 93+function wfUserProfileMarkUncacheable( $parser, &$limitReport ) {
 94+ $parser->disableCache();
 95+ return true;
 96+}
 97+
7898 /*
7999 //testing new hooks
80100 $wgHooks['UserProfileBeginLeft'][] = 'wfUserProfileBeginTest';

Status & tagging log