function getContent( $noredir = false )
{
global $action,$section,$count; # From query string
- wfProfileIn( "Article::getContent" );
+ $fname = "Article::getContent";
+ wfProfileIn( $fname );
if ( 0 == $this->getID() ) {
if ( "edit" == $action ) {
+ wfProfileOut( $fname );
return ""; # was "newarticletext", now moved above the box)
}
- wfProfileOut();
+ wfProfileOut( $fname );
return wfMsg( "noarticletext" );
} else {
$this->loadContent( $noredir );
- wfProfileOut();
if(
# check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
$action=="view"
)
{
+ wfProfileOut( $fname );
return $this->mContent . "\n" .wfMsg("anontalkpagetext"); }
else {
if($action=="edit") {
if($section!="") {
- if($section=="new") { return ""; }
+ if($section=="new") {
+ wfProfileOut( $fname );
+ return "";
+ }
$secs=preg_split("/(^=+.*?=+|^<h[1-6].*?>.*?<\/h[1-6].*?>)/mi",
$this->mContent, -1,
PREG_SPLIT_DELIM_CAPTURE);
if($section==0) {
+ wfProfileOut( $fname );
return trim($secs[0]);
} else {
+ wfProfileOut( $fname );
return trim($secs[$section*2-1] . $secs[$section*2]);
}
}
}
+ wfProfileOut( $fname );
return $this->mContent;
}
}
global $wgUser, $wgOut, $wgLang;
global $oldid, $diff; # From query
global $wgLinkCache;
- wfProfileIn( "Article::view" );
+ $fname = "Article::view";
+ wfProfileIn( $fname );
$wgOut->setArticleFlag( true );
$wgOut->setRobotpolicy( "index,follow" );
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
$de = new DifferenceEngine( $oldid, $diff );
$de->showDiffPage();
- wfProfileOut();
+ wfProfileOut( $fname );
return;
}
$text = $this->getContent(); # May change wgTitle!
$wgOut->addWikiText( $text );
$this->viewUpdates();
- wfProfileOut();
+ wfProfileOut( $fname );
}
# Theoretically we could defer these whole insert and update
# If page hasn't changed, client can cache this
$wgOut->checkLastModified( $this->getTimestamp() );
- wfProfileIn( "Article::history" );
+ $fname = "Article::history";
+ wfProfileIn( $fname );
$wgOut->setPageTitle( $this->mTitle->getPRefixedText() );
$wgOut->setSubtitle( wfMsg( "revhistory" ) );
if( $this->mTitle->getArticleID() == 0 ) {
$wgOut->addHTML( wfMsg( "nohistory" ) );
- wfProfileOut();
+ wfProfileOut( $fname );
return;
}
$revs = wfNumRows( $res );
if( $this->mTitle->getArticleID() == 0 ) {
$wgOut->addHTML( wfMsg( "nohistory" ) );
- wfProfileOut();
+ wfProfileOut( $fname );
return;
}
$s .= $sk->endHistoryList();
$s .= $numbar;
$wgOut->addHTML( $s );
- wfProfileOut();
+ wfProfileOut( $fname );
}
function protect( $limit = "sysop" )
}
}
-if( !isset( $wgProfiling ) )
- $wgProfiling = false;
-$wgProfileStack = array();
-$wgProfileWorkStack = array();
-
-if( $wgProfiling ) {
- function wfProfileIn( $functionname )
- {
- global $wgProfileStack, $wgProfileWorkStack;
- array_push( $wgProfileWorkStack, "$functionname " .
- count( $wgProfileWorkStack ) . " " . microtime() );
- }
-
- function wfProfileOut() {
- global $wgProfileStack, $wgProfileWorkStack;
- $bit = array_pop( $wgProfileWorkStack );
- $bit .= " " . microtime();
- array_push( $wgProfileStack, $bit );
- }
-} else {
- function wfProfileIn( $functionname ) { }
- function wfProfileOut( ) { }
-}
-
function wfReadOnly()
{
global $wgReadOnlyFile;
if ( 0 != $id ) { return $id; }
global $wgMemc, $wgDBname;
- wfProfileIn( "LinkCache::addLink-checkdatabase" );
+ $fname = "LinkCache::addLink-checkdatabase";
+ wfProfileIn( $fname );
$nt = Title::newFromDBkey( $title );
$ns = $nt->getNamespace();
$t = $nt->getDBkey();
- if ( "" == $t ) { return 0; }
+ if ( "" == $t ) {
+ wfProfileOut( $fname);
+ return 0;
+ }
$id = $wgMemc->get( $key = "$wgDBname:lc:title:$title" );
if( $id === FALSE ) {
}
if ( 0 == $id ) { $this->addBadLink( $title ); }
else { $this->addGoodLink( $id, $title ); }
- wfProfileOut();
+ wfProfileOut( $fname );
return $id;
}
function preFill( $fromtitle )
{
- wfProfileIn( "LinkCache::preFill" );
+ $fname = "LinkCache::preFill";
+ wfProfileIn( $fname );
# Note -- $fromtitle is a Title *object*
$dbkeyfrom = wfStrencode( $fromtitle->getPrefixedDBKey() );
$sql = "SELECT HIGH_PRIORITY cur_id,cur_namespace,cur_title
$this->mOldGoodLinks = $this->mGoodLinks;
$this->mPreFilled = true;
- wfProfileOut();
+ wfProfileOut( $fname );
}
function getGoodAdditions()
$sql = "COMMIT";
wfQuery( $sql, DB_WRITE, $fname );
}
- wfProfileOut();
+ wfProfileOut( $fname );
}
function doDumbUpdate()
$sql = "COMMIT";
wfQuery( $sql, DB_WRITE, $fname );
}
- wfProfileOut();
+ wfProfileOut( $fname );
}
function fixBrokenLinks() {
$this->mRegex = "/{$this->mBaseRegex}/{$case}";
$this->mRegexStart = "/^{$this->mBaseRegex}/{$case}";
$this->mVariableRegex = str_replace( "\\$1", "([A-Za-z0-9]*)", $this->mRegex );
- wfDebug( "{$this->mVariableRegex}\n" );
}
function getRegex()
function addWikiText( $text, $linestart = true )
{
global $wgUseTeX;
- wfProfileIn( "OutputPage::addWikiText" );
+ $fname = "OutputPage::addWikiText";
+ wfProfileIn( $fname );
$unique = "3iyZiyA7iMwg5rhxP0Dcc9oTnj8qD1jm1Sfv4";
$unique2 = "4LIQ9nXtiYFPCSfitVwDw7EYwQlL4GeeQ7qSO";
$unique3 = "fPaA8gDfdLBqzj68Yjg9Hil3qEF8JGO0uszIp";
$escapedChars, $nwlist[$i] ), $text, 1 );
}
$this->addHTML( $text );
- wfProfileOut();
+ wfProfileOut( $fname );
}
function sendCacheControl() {
$elapsed = $now - $start;
if ( "" != $wgDebugLogFile ) {
- $prof = "";
- if( $wgProfiling and count( $wgProfileStack ) ) {
- $lasttime = $start;
- foreach( $wgProfileStack as $ile ) {
- # "foo::bar 99 0.12345 1 0.23456 2"
- if( preg_match( '/^(\S+)\s+([0-9]+)\s+([0-9\.]+)\s+([0-9\.]+)\s+([0-9\.]+)\s+([0-9\.]+)/', $ile, $m ) ) {
- $thisstart = (float)$m[3] + (float)$m[4] - $start;
- $thisend = (float)$m[5] + (float)$m[6] - $start;
- $thiselapsed = $thisend - $thisstart;
- $thispercent = $thiselapsed / $elapsed * 100.0;
-
- $prof .= sprintf( "\tat %04.3f in %04.3f (%2.1f%%) - %s %s\n",
- $thisstart, $thiselapsed, $thispercent,
- str_repeat( "*", $m[2] ), $m[1] );
- $lasttime = $thistime;
- #$prof .= "\t(^ $ile)\n";
- } else {
- $prof .= "\t?broken? $ile\n";
- }
- }
- }
+ $prof = wfGetProfilingOutput( $start, $elapsed );
if( $forward = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] )
$forward = " forwarded for $forward";
function doWikiPass2( $text, $linestart )
{
global $wgUser, $wgLang, $wgUseDynamicDates;
- wfProfileIn( "OutputPage::doWikiPass2" );
+ $fname = "OutputPage::doWikiPass2";
+ wfProfileIn( $fname );
$text = $this->removeHTMLtags( $text );
$text = $this->replaceVariables( $text );
$text = $sk->transformContent( $text );
$text .= $this->categoryMagic () ;
- wfProfileOut();
+ wfProfileOut( $fname );
return $text;
}
/* private */ function replaceExternalLinks( $text )
{
- wfProfileIn( "OutputPage::replaceExternalLinks" );
+ $fname = "OutputPage::replaceExternalLinks";
+ wfProfileIn( $fname );
$text = $this->subReplaceExternalLinks( $text, "http", true );
$text = $this->subReplaceExternalLinks( $text, "https", true );
$text = $this->subReplaceExternalLinks( $text, "ftp", false );
$text = $this->subReplaceExternalLinks( $text, "gopher", false );
$text = $this->subReplaceExternalLinks( $text, "news", false );
$text = $this->subReplaceExternalLinks( $text, "mailto", false );
- wfProfileOut();
+ wfProfileOut( $fname );
return $text;
}
$e1 = "/^([{$tc}]+)\\|([^]]+)]](.*)\$/sD";
$e2 = "/^([{$tc}]+)]](.*)\$/sD";
- wfProfileOut();
+ wfProfileOut( "$fname-setup" );
foreach ( $a as $line ) {
wfProfileIn( "$fname-loop" );
else { # Invalid form; output directly
$s .= "[[" . $line ;
- wfProfileOut();
+ wfProfileOut( "$fname-loop" );
continue;
}
if(substr($m[1],0,1)=="/") { # subpage
if ( "" == $text ) { $text = $link; }
$s .= $sk->makeLink( $link, $text, "", $trail );
}
- wfProfileOut();
+ wfProfileOut( "$fname-loop" );
}
- wfProfileOut();
+ wfProfileOut( $fname );
return $s;
}
/* private */ function doBlockLevels( $text, $linestart )
{
- wfProfileIn( "OutputPage::doBlockLevels" );
+ $fname = "OutputPage::doBlockLevels";
+ wfProfileIn( $fname );
# Parsing through the text line by line. The main thing
# happening here is handling of block-level elements p, pre,
# and making lists from lines starting with * # : etc.
}
$this->mLastSection = "";
}
- wfProfileOut();
+ wfProfileOut( $fname );
return $text;
}
/* private */ function replaceVariables( $text )
{
global $wgLang;
- wfProfileIn( "OutputPage:replaceVariables" );
+ $fname = "OutputPage:replaceVariables";
+ wfProfileIn( $fname );
/* As with sigs, use server's local time --
ensure this is appropriate for your audience! */
$mw =& MagicWord::get( MAG_MSGNW );
$text = $mw->substituteCallback( $text, "replaceMsgVarNw" );
- wfProfileOut();
+ wfProfileOut( $fname );
return $text;
}
/* private */ function removeHTMLtags( $text )
{
- wfProfileIn( "OutputPage::removeHTMLtags" );
+ $fname = "OutputPage::removeHTMLtags";
+ wfProfileIn( $fname );
$htmlpairs = array( # Tags that must be closed
"b", "i", "u", "font", "big", "small", "sub", "sup", "h1",
"h2", "h3", "h4", "h5", "h6", "cite", "code", "em", "s",
$text .= "</$t>\n";
if ( $t == "table" ) { $tagstack = array_pop( $tablestack ); }
}
- wfProfileOut();
+ wfProfileOut( $fname );
return $text;
}
--- /dev/null
+<?
+# This file is only included if profiling is enabled
+$wgDebugProfiling = true;
+
+function wfProfileIn( $functionname )
+{
+ global $wgProfiler;
+ $wgProfiler->profileIn( $functionname );
+}
+
+function wfProfileOut( $functionname = "missing" )
+{
+ global $wgProfiler;
+ $wgProfiler->profileOut( $functionname );
+}
+
+function wfGetProfilingOutput( $start, $elapsed ) {
+ global $wgProfiler;
+ return $wgProfiler->getOutput( $start, $elapsed );
+}
+
+function wfProfileClose()
+{
+ global $wgProfiler;
+ $wgProfiler->close();
+}
+
+class Profiler
+{
+ var $mStack = array(), $mWorkStack = array(), $mCollated = array();
+ var $mCalls = array(), $mTotals = array();
+ /*
+ function Profiler()
+ {
+ $this->mProfileStack = array();
+ $this->mWorkStack = array();
+ $this->mCollated = array();
+ }
+ */
+
+ function profileIn( $functionname )
+ {
+ array_push( $this->mWorkStack, array($functionname, count( $this->mWorkStack ), microtime() ) );
+ }
+
+ function profileOut( $functionname)
+ {
+ global $wgDebugProfiling;
+ $bit = array_pop( $this->mWorkStack );
+
+ if ( $wgDebugProfiling ) {
+ if ( $functionname == "close" ) {
+ wfDebug( "Profile section ended by close(): {$bit[0]}\n" );
+ } elseif ( $bit[0] != $functionname ) {
+ wfDebug( "Profiling error: in({$bit[0]}), out($functionname)\n" );
+ }
+ }
+ array_push( $bit, microtime() );
+ array_push( $this->mStack, $bit );
+ }
+
+ function close()
+ {
+ while ( count( $this->mWorkStack ) ) {
+ $this->profileOut( "close" );
+ }
+ }
+
+
+ function getOutput( $scriptStart, $scriptElapsed )
+ {
+ set_time_limit( 0 );
+ $width = 80;
+ $format = "%-39s %6.2f / %6.2f = %6.2f %6.2f%%\n";
+ $prof = "";
+ if( !count( $this->mStack ) ) {
+ return "No profiling output\n";
+ }
+ $this->mCollated = array();
+
+ $top = $this->doLevel( 0, true );
+ $this->merge( "WIKI.PHTML", $top, $scriptElapsed );
+ $this->mCollated = array_reverse( $this->mCollated, true );
+/*
+ # Calculate totals
+ foreach ( $this->mCollated as $f1 => $f1data ) {
+ $total = 0;
+ foreach ( $f1data as $f2 => $t ) {
+ $total += $t;
+ }
+ $this->mCollated[$f1][0] = $total;
+ }
+*/
+ # Output
+ foreach ( $this->mCollated as $f1 => $f1data ) {
+ $prof .= "\n" . str_repeat( "-", $width ) . "\n";
+ $t = $this->mTotals[$f1] * 1000;
+ $calls = $this->mCalls[$f1];
+ if ( $calls == 0 ) {
+ $calls = 1;
+ }
+ $each = $t / $calls;
+ $percent = $this->mTotals[$f1] / $scriptElapsed * 100;
+ $prof .= sprintf( $format, "| $f1", $t, $calls, $each, $percent );
+ $prof .= str_repeat( "-", $width ) . "\n";
+ foreach ( $f1data as $f2 => $t ) {
+ $percent = $t / $this->mTotals[$f1] * 100;
+ $t *= 1000;
+ $calls = $this->mCalls[$f1];
+ if ( $calls == 0 ) {
+ $calls = 1;
+ }
+ $each = $t / $calls;
+ $percent = $this->mTotals[$f1] / $scriptElapsed * 100;
+ $prof .= sprintf( $format, $f2, $t, $calls, $each, $percent );
+ }
+ }
+ $prof .= str_repeat( "-", $width ) . "\n";
+ return $prof;
+ }
+
+
+ function doLevel( $p, $fTop )
+ {
+ $level = false;
+ $getOut = false;
+ $hotArray = false;
+ $tempArray = array();
+ do {
+ $fname = $this->mStack[$p][0];
+ $thislevel = $this->mStack[$p][1];
+ $start = (float)$this->mStack[$p][2] + (float)$this->mStack[$p][3];
+ $end = (float)$this->mStack[$p][4] + (float)$this->mStack[$p][5];
+ $elapsed = $end - $start;
+ if ( $hotArray !== false ) {
+ # Just dropped down a level
+ # Therefore this entry is the parent of $hotArray
+ $this->merge( $fname, $hotArray, $elapsed );
+ $hotArray = false;
+ }
+
+ if ( $level === false ) {
+ $level = $thislevel;
+ }
+
+ if ( $thislevel == $level ) {
+ $tempArray[$fname] += $elapsed;
+ #$this->mTotals[$fname] += elapsed;
+ $this->mCalls[$fname] ++;
+ } elseif ($thislevel > $level ) {
+ $hotArray = $this->doLevel( $p, false );
+ } else {
+ $getOut = true;
+ }
+
+ # Special case: top of hierarchy
+ # File starts with lvl 1 entry, then drops back to lvl 0
+ if ( $fTop && $getOut ) {
+ $hotArray = $tempArray;
+ $getOut = false;
+ }
+
+ $p++;
+ } while ( !$getOut && $p < count( $this->mStack ) );
+ return $tempArray;
+ }
+
+ function merge( $f1, $a, $parentTime )
+ {
+ foreach ( $a as $f2 => $elapsed ) {
+ $this->mCollated[$f1][$f2] += $elapsed;
+ }
+ $this->mTotals[$f1] += $parentTime;
+ }
+}
+
+$wgProfiler = new Profiler();
+
+?>
}
$wgLang = new $wgLangClass();
+if( !isset( $wgProfiling ) )
+ $wgProfiling = false;
+
+if ( $wgProfiling ) {
+ include_once( "$IP/Profiling.php" );
+} else {
+ function wfProfileIn( $fn ) {}
+ function wfProfileOut( $fn = "" ) {}
+ function wfGetProfilingOutput( $s, $e ) {}
+ function wfProfileClose() {}
+}
+
$wgUser = User::loadFromSession();
$wgDeferredUpdateList = array();
$wgLinkCache = new LinkCache();
function initPage()
{
global $wgOut, $wgStyleSheetPath;
- wfProfileIn( "Skin::initPage" );
+ $fname = "Skin::initPage";
+ wfProfileIn( $fname );
$wgOut->addLink( "shortcut icon", "", "/favicon.ico" );
if ( $wgOut->isPrintable() ) { $ss = "wikiprintable.css"; }
else { $ss = $this->getStylesheet(); }
$wgOut->addLink( "stylesheet", "", "{$wgStyleSheetPath}/{$ss}" );
- wfProfileOut();
+ wfProfileOut( $fname );
}
function outputPage( &$out ) {
+ wfProfileIn( "Skin::outputPage" );
$this->initPage();
$out->out( $out->headElement() );
$out->out( $out->mBodytext );
$out->out( $this->afterContent() );
- wfProfileOut();
-
- wfProfileOut(); # A hack - we can't report after here
+
+ wfProfileClose();
$out->out( $out->reportTime() );
$out->out( "\n</body></html>" );
function doBeforeContent()
{
global $wgUser, $wgOut, $wgTitle, $wgLang;
- wfProfileIn( "Skin::doBeforeContent" );
+ $fname = "Skin::doBeforeContent";
+ wfProfileIn( $fname );
$s = "";
$qb = $this->qbSetting();
$s .= $this->pageSubtitle() ;
$s .= getCategories(); // For some odd reason, zhis can't be a function of the object
$s .= "\n<p>";
- wfProfileOut();
+ wfProfileOut( $fname );
return $s;
}
function doAfterContent()
{
global $wgUser, $wgOut, $wgLang;
- wfProfileIn( "Skin::doAfterContent" );
+ $fname = "Skin::doAfterContent";
+ wfProfileIn( $fname );
$s = "\n</div><br clear=all>\n";
$s .= "</tr></table>\n</div>\n</div>\n";
if ( 0 != $qb ) { $s .= $this->quickBar(); }
- wfProfileOut();
+ wfProfileOut( $fname );
return $s;
}
if( $wgShowIPinHeader ) {
$n = getenv( "REMOTE_ADDR" );
- $tl = $this->makeKnownLink( $wgLang->getNsText(
+ $tl = $this->makeKnownLink( $wgLang->getNsText(
Namespace::getTalk( Namespace::getUser() ) ) . ":{$n}",
$wgLang->getNsText( Namespace::getTalk( 0 ) ) );
{
global $wgOut, $wgTitle, $wgUser, $action, $wgLang;
global $wpPreview;
- wfProfileIn( "Skin::quickBar" );
+ $fname = "Skin::quickBar";
+ wfProfileIn( $fname );
+
$tns=$wgTitle->getNamespace();
$s = "\n<div id='quickbar'>";
}
// only show watchlist link if logged in
- if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
- $s .= "\n<br><hr class='sep'>";
+ if ( wfMsg ( "currentevents" ) != "-" ) $s .= $sep . $this->makeKnownLink( wfMsg( "currentevents" ), "" ) ;
+ $s .= "\n<br><hr class='sep'>";
$articleExists = $wgTitle->getArticleId();
- if ( $wgOut->isArticle() || $action =="edit" || $action =="history" || $wpPreview) {
-
+ if ( $wgOut->isArticle() || $action =="edit" || $action =="history" || $wpPreview) {
if($wgOut->isArticle()) {
$s .= "<strong>" . $this->editThisPage() . "</strong>";
} else { # backlink to the article in edit or history mode
. $sep . $this->bugReportsLink();
$s .= "\n<br></div>\n";
- wfProfileOut();
+ wfProfileOut( $fname );
return $s;
}
if ( !$wgUseNewInterlanguage ) return "";
$ns = $wgLang->getNsIndex ( $wgTitle->getNamespace () ) ;
if ( $ns != 0 AND $ns != 1 ) return "" ;
- $pn = "Intl" ;
+ $pn = "Intl" ;
$x = "mode=addlink&xt=".$wgTitle->getDBkey() ;
return $this->makeKnownLink( $wgLang->specialPage( $pn ),
wfMsg( "intl" ) , $x );
# a final pass through here for things like table backgrounds.
#
function transformContent( $text )
- {
+ {
return $text;
}
"diff={$oldid}&oldid={$diffid}" ); # Finagle's law
}
if ( 0 == $u ) {
- $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
+ $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
$ut, "target=" . $ut );
} else { $ul = $this->makeLink( $wgLang->getNsText(
Namespace::getUser() ) . ":{$ut}", $ut ); }
}
if ( 0 == $u ) {
- $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
+ $ul = $this->makeKnownLink( $wgLang->specialPage( "Contributions" ),
$ut, "target=" . $ut );
} else { $ul = $this->makeLink( $wgLang->getNsText(
Namespace::getUser() ) . ":{$ut}", $ut ); }
return;
}
+ # Create block
# Note: for a user block, ipb_address is only for display purposes
$ban = new Block( $wpBlockAddress, $userId, $wgUser->getID(),
wfStrencode( $wpBlockReason ), wfTimestampNow(), 0 );
$ban->insert();
+ # Make log entry
+ $log = new LogPage( wfMsg( "blocklogpage" ), wfMsg( "blocklogtext" ) );
+ $action = str_replace( "$1", $wpBlockAddress, wfMsg( "blocklogentry" ) );
+ $log->addEntry( $action, $wpBlockReason );
+
+ # Report to the user
$success = wfLocalUrl( $wgLang->specialPage( "Blockip" ),
"action=success&ip={$wpBlockAddress}" );
$wgOut->redirect( $success );
if ( ! $wpUnblockAddress ) { $wpUnblockAddress = $ip; }
$ipa = wfMsg( "ipaddress" );
+ $ipr = wfMsg( "ipbreason" );
$ipus = wfMsg( "ipusubmit" );
$action = wfLocalUrlE( $wgLang->specialPage( "Ipblocklist" ),
"action=submit" );
<td align=left>
<input tabindex=1 type=text size=20 name=\"wpUnblockAddress\" value=\"{$wpUnblockAddress}\">
</td></tr><tr>
+<td align=right>{$ipr}:</td>
+<td align=left>
+<input tabindex=1 type=text size=40 name=\"wpUnblockReason\" value=\"{$wpUnblockReason}\">
+</td></tr><tr>
<td> </td><td align=left>
<input tabindex=2 type=submit name=\"wpBlock\" value=\"{$ipus}\">
</td></tr></table>
function doSubmit()
{
global $wgOut, $wgUser, $wgLang;
- global $wpUnblockAddress;
+ global $wpUnblockAddress, $wpUnblockReason;
$block = new Block();
$wpUnblockAddress = trim( $wpUnblockAddress );
$block->mAddress = $wpUnblockAddress;
}
+ # Delete block (if it exists)
+ # We should probably check for errors rather than just declaring success
$block->delete();
+ # Make log entry
+ $log = new LogPage( wfMsg( "blocklogpage" ), wfMsg( "blocklogtext" ) );
+ $action = str_replace( "$1", $wpUnblockAddress, wfMsg( "unblocklogentry" ) );
+ $log->addEntry( $action, $wpUnblockReason );
+
+ # Report to the user
$success = wfLocalUrl( $wgLang->specialPage( "Ipblocklist" ),
"action=success&ip=" . urlencode($wpUnblockAddress) );
$wgOut->redirect( $success );
function newFromText( $text )
{
- wfProfileIn( "Title::newFromText" );
+ $fname = "Title::newFromText";
+ wfProfileIn( $fname );
# Note - mixing latin1 named entities and unicode numbered
# ones will result in a bad link.
$t = new Title();
$t->mDbkeyform = str_replace( " ", "_", $text );
+ wfProfileOut( $fname );
if( $t->secureAndSplit() ) {
- wfProfileOut();
return $t;
} else {
return NULL;
/* private */ function secureAndSplit()
{
global $wgLang, $wgLocalInterwiki;
- wfProfileIn( "Title::secureAndSplit" );
+ $fname = "Title::secureAndSplit";
+ wfProfileIn( $fname );
$validNamespaces = $wgLang->getNamespaces();
unset( $validNamespaces[0] );
$l = strlen( $t );
if ( $l && ( "_" == $t{$l-1} ) ) { $t = substr( $t, 0, $l-1 ); }
if ( "" == $t ) {
- wfProfileOut();
+ wfProfileOut( $fname );
return false;
}
$this->mUrlform = wfUrlencode( $t );
$this->mTextform = str_replace( "_", " ", $t );
- wfProfileOut();
+ wfProfileOut( $fname );
return true;
}
}
"unblocklink" => "unblock",
"contribslink" => "contribs",
"autoblocker" => "Autoblocked because you share an IP address with \"$1\". Reason \"$2\".",
+"blocklogpage" => "Block_log",
+"blocklogentry" => 'blocked "$1"',
+"blocklogtext" => "This is a log of user blocking and unblocking actions. Automatically
+blocked IP addresses are not be listed. See the [[Special:Ipblocklist|IP block list]] for
+the list of currently operational bans and blocks.",
+"unblocklogentry" => 'unblocked "$1"',
# Developer tools
#