Revision: 46028
Author: ialex
Date: 2009-01-22 17:12:06 +0000 (Thu, 22 Jan 2009)
Log Message:
-----------
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: trunk/extensions/SocialProfile/UserProfile/UserProfile.php
===================================================================
--- trunk/extensions/SocialProfile/UserProfile/UserProfile.php 2009-01-22
16:48:32 UTC (rev 46027)
+++ trunk/extensions/SocialProfile/UserProfile/UserProfile.php 2009-01-22
17:12:06 UTC (rev 46028)
@@ -5,6 +5,8 @@
// Default setup for displaying sections
$wgUserPageChoice = true;
+
+
$wgUserProfileDisplay['friends'] = false;
$wgUserProfileDisplay['foes'] = false;
$wgUserProfileDisplay['gifts'] = true;
@@ -38,11 +40,17 @@
$wgHooks['ArticleFromTitle'][] = 'wfUserProfileFromTitle';
-// ArticleFromTitle
-// Calls UserProfilePage instead of standard article
+/**
+ * called by ArticleFromTitle hook
+ * Calls UserProfilePage instead of standard article
+ *
+ * @param &$title Title object
+ * @param &$article Article object
+ * @return true
+ */
function wfUserProfileFromTitle( &$title, &$article ){
- global $wgUser, $wgRequest, $IP, $wgOut, $wgTitle, $wgSupressPageTitle,
$wgSupressSubTitle, $wgMemc,
- $wgUserPageChoice, $wgParser, $wgUserProfileDirectory,
$wgUserProfileScripts, $wgStyleVersion;
+ global $IP, $wgUser, $wgRequest, $wgOut, $wgTitle, $wgMemc,
$wgStyleVersion, $wgHooks,
+ $wgUserPageChoice, $wgUserProfileScripts;
if ( strpos( $title->getText(), "/" ) === false && ( NS_USER ==
$title->getNamespace() || NS_USER_PROFILE == $title->getNamespace() ) ) {
@@ -59,21 +67,33 @@
if( !$show_user_page ){
// Prevents editing of userpage
- if( $wgRequest->getVal('action') == 'edit' ){
+ if( $wgRequest->getVal( 'action' ) == 'edit' ){
$wgOut->redirect( $title->getFullURL() );
}
} else {
- $wgOut->enableClientCache(false);
- $wgParser->disableCache();
+ $wgOut->enableClientCache( false );
+ $wgHooks['ParserLimitReport'][] =
'wfUserProfileMarkUncacheable';
}
- $wgOut->addScript("<link rel='stylesheet' type='text/css'
href=\"{$wgUserProfileScripts}/UserProfile.css?{$wgStyleVersion}\"/>\n");
+ $wgOut->addScript( "<link rel='stylesheet' type='text/css'
href=\"{$wgUserProfileScripts}/UserProfile.css?{$wgStyleVersion}\"/>\n" );
$article = new UserProfilePage( $title );
}
return true;
}
+/**
+ * Mark page as uncacheable
+ *
+ * @param $parser Parser object
+ * @param &$limitReport String: unused
+ * @return true
+ */
+function wfUserProfileMarkUncacheable( $parser, &$limitReport ) {
+ $parser->disableCache();
+ return true;
+}
+
/*
//testing new hooks
$wgHooks['UserProfileBeginLeft'][] = 'wfUserProfileBeginTest';
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs