From: Niklas Laxström Date: Fri, 22 Jan 2010 20:39:03 +0000 (+0000) Subject: Wrap skin specific user js addition inside Title::exists X-Git-Tag: 1.31.0-rc.0~38155 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=3b686fcf71b3f34d2ff82833b070cd5e17083a82;p=lhc%2Fweb%2Fwiklou.git Wrap skin specific user js addition inside Title::exists This should help to reduce unnecessary requests, especially where action=raw is serving uncached 404 responses in some uncommon configurations. --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a4cbeccfd6..04f1f0480f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1725,10 +1725,14 @@ class OutputPage { $this->addInlineScript( $wgRequest->getText( 'wpTextbox1' ) ); } else { $userpage = $wgUser->getUserPage(); - $userjs = Skin::makeUrl( - $userpage->getPrefixedText() . '/' . $sk->getSkinName() . '.js', - 'action=raw&ctype=' . $wgJsMimeType ); - $this->addScriptFile( $userjs ); + $scriptpage = Title::newFromText( + $userpage->getNamespace(), + $userpage->getPrefixedText() . '/' . $sk->getSkinName() . '.js' + ); + if ( $scriptpage && $scriptpage->exists() ) { + $userjs = Skin::makeUrl( $scriptpage->getPrefixedText(), 'action=raw&ctype=' . $wgJsMimeType ); + $this->addScriptFile( $userjs ); + } } }