r61391 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61390‎ | r61391 | r61392 >
Date:20:39, 22 January 2010
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1725,10 +1725,14 @@
17261726 $this->addInlineScript( $wgRequest->getText( 'wpTextbox1' ) );
17271727 } else {
17281728 $userpage = $wgUser->getUserPage();
1729 - $userjs = Skin::makeUrl(
1730 - $userpage->getPrefixedText() . '/' . $sk->getSkinName() . '.js',
1731 - 'action=raw&ctype=' . $wgJsMimeType );
1732 - $this->addScriptFile( $userjs );
 1729+ $scriptpage = Title::newFromText(
 1730+ $userpage->getNamespace(),
 1731+ $userpage->getPrefixedText() . '/' . $sk->getSkinName() . '.js'
 1732+ );
 1733+ if ( $scriptpage && $scriptpage->exists() ) {
 1734+ $userjs = Skin::makeUrl( $scriptpage->getPrefixedText(), 'action=raw&ctype=' . $wgJsMimeType );
 1735+ $this->addScriptFile( $userjs );
 1736+ }
17331737 }
17341738 }
17351739

Follow-up revisions

RevisionCommit summaryAuthorDate
r61406Fix for r61391, which broke user JS. Use makeTitleSafe() instead of...mrzman02:00, 23 January 2010

Comments

#Comment by Simetrical (talk | contribs)   21:06, 22 January 2010

Did you really mean newFromText() there? Your input looks wrong. Maybe you meant makeTitleSafe()?

#Comment by Nikerabbit (talk | contribs)   07:54, 23 January 2010

Yep. Too little testing :<

Status & tagging log