function wfSpecialAllmessages()
{
global $wgOut, $wgAllMessagesEn, $wgRequest, $wgMessageCache, $wgTitle;
- $ot = $wgRequest->getText('ot');
+
+ $fname = "wfSpecialAllMessages";
+ wfProfileIn( $fname );
+
+ wfProfileIn( "$fname-setup");
+ $ot = $wgRequest->getText( 'ot' );
$mwMsg =& MagicWord::get( MAG_MSG );
- set_time_limit(0);
+
$navText = wfMsg( 'allmessagestext', $mwMsg->getSynonym( 0 ) );
$first = true;
$sortedArray = $wgAllMessagesEn;
$messages[$key]['statmsg'] = wfMsgNoDb( $key );
$messages[$key]['msg'] = wfMsg ( $key );
}
+ wfProfileOut( "$fname-setup" );
+
+ wfProfileIn( "$fname-output" );
if ($ot == 'html') {
$wgOut->addHTML( '<a href="'.$wgTitle->escapeLocalUrl('ot=php').'">PHP</a> | HTML' );
$wgOut->addWikiText( $navText );
$navText .= makePhp($messages);
$wgOut->addHTML('PHP | <a href="'.$wgTitle->escapeLocalUrl('ot=html').'">HTML</a><pre>'.htmlspecialchars($navText).'</pre>');
}
- return;
+ wfProfileOut( "$fname-output" );
+
+ wfProfileOut( $fname );
}
+
function makePhp($messages) {
global $wgLanguageCode;
$txt = "\n\n".'$wgAllMessages'.ucfirst($wgLanguageCode).' = array('."\n";
function makeHTMLText( $messages ) {
global $wgLang, $wgUser;
+ $fname = "makeHTMLText";
+ wfProfileIn( $fname );
+
$sk =& $wgUser->getSkin();
$talk = $wgLang->getNsText( NS_TALK );
$mwnspace = $wgLang->getNsText( NS_MEDIAWIKI );
<th>Current text</th>
</tr>";
+ wfProfileIn( "$fname-check" );
# This is a nasty hack to avoid doing independent existence checks
# without sending the links and table through the slow wiki parser.
$pageExists = array(
$pageExists[$s->cur_namespace][$s->cur_title] = true;
}
$dbr->freeResult( $res );
+ wfProfileOut( "$fname-check" );
+ wfProfileIn( "$fname-output" );
foreach( $messages as $key => $m ) {
- $titleObj = Title::makeTitle( NS_MEDIAWIKI, $key );
- $talkPage = Title::makeTitle( NS_MEDIAWIKI_TALK, $key );
- $title = $titleObj->getDBkey();
+ $title = $wgLang->ucfirst( $key );
+ $titleObj =& Title::makeTitle( NS_MEDIAWIKI, $title );
+ $talkPage =& Title::makeTitle( NS_MEDIAWIKI_TALK, $title );
$colorIt = ($m['statmsg'] == $m['msg']) ? " bgcolor=\"#f0f0ff\"" : " bgcolor=\"#ffe2e2\"";
$message = htmlspecialchars( $m['statmsg'] );
</td></tr>";
}
$txt .= "</table>";
+ wfProfileOut( "$fname-output" );
+ wfProfileOut( $fname );
return $txt;
}
return $title;
}
- # From a namespace index and a DB key
- /* static */ function makeTitle( $ns, $title ) {
- $t = new Title();
- $t->mDbkeyform = Title::makeName( $ns, $title );
- if( $t->secureAndSplit() ) {
- return $t;
- } else {
- return NULL;
- }
+ # From a namespace index and a DB key.
+ # It's assumed that $ns and $title are *valid*, for instance
+ # when they came directly from the database.
+ /* static */ function &makeTitle( $ns, $title ) {
+ $t =& new Title();
+ $t->mInterwiki = '';
+ $t->mFragment = '';
+ $t->mNamespace = $ns;
+ $t->mDbkeyform = $title;
+ $t->mArticleID = ( $ns >= 0 ) ? 0 : -1;
+ $t->mUrlform = wfUrlencode( $title );
+ $t->mTextform = str_replace( '_', ' ', $title );
+ return $t;
}
/* static */ function newMainPage() {