From 3b686fcf71b3f34d2ff82833b070cd5e17083a82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Fri, 22 Jan 2010 20:39:03 +0000 Subject: [PATCH] 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. --- includes/OutputPage.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 ); + } } } -- 2.20.1