* Load up our object with user supplied data
*/
function __construct( Config $config ) {
- wfProfileIn( __METHOD__ );
-
$this->config = $config;
$this->mode = "";
}
break;
default:
- wfProfileOut( __METHOD__ );
return;
# Or we could throw an exception:
# throw new MWException( __METHOD__ . ' called without any data (mode empty).' );
}
- wfProfileOut( __METHOD__ );
}
/**
return;
}
- wfProfileIn( __METHOD__ );
-
if ( !in_array( $this->func_name, $this->config->get( 'AjaxExportList' ) ) ) {
wfDebug( __METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n" );
-
wfHttpError(
400,
'Bad Request',
'You are not allowed to view pages.' );
} else {
wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" );
-
try {
$result = call_user_func_array( $this->func_name, $this->args );
}
}
- wfProfileOut( __METHOD__ );
}
}
* @return bool
*/
public function deleteIfExpired() {
- wfProfileIn( __METHOD__ );
if ( $this->isExpired() ) {
wfDebug( "Block::deleteIfExpired() -- deleting\n" );
$retVal = false;
}
- wfProfileOut( __METHOD__ );
return $retVal;
}
return array();
}
- wfProfileIn( __METHOD__ );
$conds = array();
foreach ( array_unique( $ipChain ) as $ipaddr ) {
# Discard invalid IP addresses. Since XFF can be spoofed and we do not
}
if ( !count( $conds ) ) {
- wfProfileOut( __METHOD__ );
return array();
}
}
}
- wfProfileOut( __METHOD__ );
return $blocks;
}
return $blocks[0];
}
- wfProfileIn( __METHOD__ );
-
// Sort hard blocks before soft ones and secondarily sort blocks
// that disable account creation before those that don't.
usort( $blocks, function ( Block $a, Block $b ) {
} elseif ( $blocksList['auto'] ) {
$chosenBlock = $blocksList['auto'];
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( "Proxy block found, but couldn't be classified." );
}
- wfProfileOut( __METHOD__ );
return $chosenBlock;
}
return true;
}
- wfProfileIn( __METHOD__ );
$dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow(
__METHOD__
);
- wfProfileOut( __METHOD__ );
if ( !$row ) {
# Okay, there were no contents. Nothing to initialize.
* @return TitleArray TitleArray object for category members.
*/
public function getMembers( $limit = false, $offset = '' ) {
- wfProfileIn( __METHOD__ );
$dbr = wfGetDB( DB_SLAVE );
)
);
- wfProfileOut( __METHOD__ );
return $result;
}
}
}
- wfProfileIn( __METHOD__ );
$dbw = wfGetDB( DB_MASTER );
$dbw->startAtomic( __METHOD__ );
);
$dbw->endAtomic( __METHOD__ );
- wfProfileOut( __METHOD__ );
# Now we should update our local counts.
$this->mPages = $result->pages;
* Scans a "parent layer" of the articles/categories in $this->next
*/
private function scanNextLayer() {
- $profiler = new ProfileSection( __METHOD__ );
# Find all parents of the article currently in $this->next
$layer = array();
* @return string HTML output
*/
public function getHTML() {
- wfProfileIn( __METHOD__ );
$this->showGallery = $this->getConfig()->get( 'CategoryMagicGallery' )
&& !$this->getOutput()->mNoGallery;
# put a div around the headings which are in the user language
$r = Html::openElement( 'div', $langAttribs ) . $r . '</div>';
- wfProfileOut( __METHOD__ );
return $r;
}
return;
}
- wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . ": enter\n" );
// If they used redlink=1 and the page exists, redirect to the main article
if ( $wgRequest->getBool( 'redlink' ) && $this->mTitle->exists() ) {
$wgOut->redirect( $this->mTitle->getFullURL() );
- wfProfileOut( __METHOD__ );
return;
}
if ( $this->live ) {
$this->livePreview();
- wfProfileOut( __METHOD__ );
return;
}
$this->displayPermissionsError( $permErrors );
- wfProfileOut( __METHOD__ );
return;
}
if ( 'save' == $this->formtype ) {
if ( !$this->attemptSave() ) {
wfProfileOut( __METHOD__ . "-business-end" );
- wfProfileOut( __METHOD__ );
return;
}
}
if ( $this->initialiseForm() === false ) {
$this->noSuchSectionPage();
wfProfileOut( __METHOD__ . "-business-end" );
- wfProfileOut( __METHOD__ );
return;
}
$this->showEditForm();
wfProfileOut( __METHOD__ . "-business-end" );
- wfProfileOut( __METHOD__ );
}
/**
function importFormData( &$request ) {
global $wgContLang, $wgUser;
- wfProfileIn( __METHOD__ );
# Section edit can come from either the form or a link
$this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
if ( $this->section !== null && $this->section !== '' && !$this->isSectionEditSupported() ) {
- wfProfileOut( __METHOD__ );
throw new ErrorPageError( 'sectioneditnotsupported-title', 'sectioneditnotsupported-text' );
}
// Allow extensions to modify form data
Hooks::run( 'EditPage::importFormData', array( $this, $request ) );
- wfProfileOut( __METHOD__ );
}
/**
protected function getContentObject( $def_content = null ) {
global $wgOut, $wgRequest, $wgUser, $wgContLang;
- wfProfileIn( __METHOD__ );
$content = false;
}
}
- wfProfileOut( __METHOD__ );
return $content;
}
$status = Status::newGood();
- wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ . '-checks' );
if ( !Hooks::run( 'EditPage::attemptSave', array( $this ) ) ) {
$status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
$status->fatal( 'spamprotectionmatch', false );
$status->value = self::AS_SPAM_ERROR;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
);
$status->value = self::AS_PARSE_ERROR;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
$status->setResult( false, $code );
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
$status->fatal( 'spamprotectionmatch', $match );
$status->value = self::AS_SPAM_ERROR;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( !Hooks::run(
$status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
} elseif ( $this->hookError != '' ) {
# ...or the hook could be expecting us to produce an error
$status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR_EXPECTED;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
# Check block state against master, thus 'false'.
$status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
$this->tooBig = true;
$status->setResult( false, self::AS_CONTENT_TOO_BIG );
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( $wgUser->isAnon() ) {
$status->setResult( false, self::AS_READ_ONLY_PAGE_ANON );
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
} else {
$status->fatal( 'readonlytext' );
$status->value = self::AS_READ_ONLY_PAGE_LOGGED;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
}
) {
$status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL );
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
$status->fatal( 'readonlytext' );
$status->value = self::AS_READ_ONLY_PAGE;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( $wgUser->pingLimiter() || $wgUser->pingLimiter( 'linkpurge', 0 ) ) {
$status->fatal( 'actionthrottledtext' );
$status->value = self::AS_RATE_LIMITED;
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( $this->wasDeletedSinceLastEdit() && !$this->recreate ) {
$status->setResult( false, self::AS_ARTICLE_WAS_DELETED );
wfProfileOut( __METHOD__ . '-checks' );
- wfProfileOut( __METHOD__ );
return $status;
}
$status->fatal( 'nocreatetext' );
$status->value = self::AS_NO_CREATE_PERMISSION;
wfDebug( __METHOD__ . ": no create permission\n" );
- wfProfileOut( __METHOD__ );
return $status;
}
$this->blankArticle = true;
$status->fatal( 'blankarticle' );
$status->setResult( false, self::AS_BLANK_ARTICLE );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( !$this->runPostMergeFilters( $textbox_content, $status, $wgUser ) ) {
- wfProfileOut( __METHOD__ );
return $status;
}
if ( $this->isConflict ) {
$status->setResult( false, self::AS_CONFLICT_DETECTED );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( !$this->runPostMergeFilters( $content, $status, $wgUser ) ) {
- wfProfileOut( __METHOD__ );
return $status;
}
$this->missingSummary = true;
$status->fatal( 'missingsummary' ); // or 'missingcommentheader' if $section == 'new'. Blegh
$status->value = self::AS_SUMMARY_NEEDED;
- wfProfileOut( __METHOD__ );
return $status;
}
$this->missingComment = true;
$status->fatal( 'missingcommenttext' );
$status->value = self::AS_TEXTBOX_EMPTY;
- wfProfileOut( __METHOD__ );
return $status;
}
} elseif ( !$this->allowBlankSummary
$this->missingSummary = true;
$status->fatal( 'missingsummary' );
$status->value = self::AS_SUMMARY_NEEDED;
- wfProfileOut( __METHOD__ );
return $status;
}
$this->selfRedirect = true;
$status->fatal( 'selfredirect' );
$status->value = self::AS_SELF_REDIRECT;
- wfProfileOut( __METHOD__ );
return $status;
}
}
if ( $this->kblength > $wgMaxArticleSize ) {
$this->tooBig = true;
$status->setResult( false, self::AS_MAX_ARTICLE_SIZE_EXCEEDED );
- wfProfileOut( __METHOD__ );
return $status;
}
// Destroys data doEdit() put in $status->value but who cares
$doEditStatus->value = self::AS_END;
}
- wfProfileOut( __METHOD__ );
return $doEditStatus;
}
}
$result['redirect'] = $content->isRedirect();
$this->updateWatchlist();
- wfProfileOut( __METHOD__ );
return $status;
}
* @return bool
*/
private function mergeChangesIntoContent( &$editContent ) {
- wfProfileIn( __METHOD__ );
$db = wfGetDB( DB_MASTER );
$baseContent = $baseRevision ? $baseRevision->getContent() : null;
if ( is_null( $baseContent ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
$currentContent = $currentRevision ? $currentRevision->getContent() : null;
if ( is_null( $currentContent ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
if ( $result ) {
$editContent = $result;
- wfProfileOut( __METHOD__ );
return true;
}
- wfProfileOut( __METHOD__ );
return false;
}
function showEditForm( $formCallback = null ) {
global $wgOut, $wgUser;
- wfProfileIn( __METHOD__ );
# need to parse the preview early so that we know which templates are used,
# otherwise users with "show preview after edit box" will get a blank list
$this->setHeaders();
if ( $this->showHeader() === false ) {
- wfProfileOut( __METHOD__ );
return;
}
$this->displayPreviewArea( $previewOutput, false );
}
- wfProfileOut( __METHOD__ );
}
/**
return '';
}
- wfProfileIn( __METHOD__ );
$limitReport = Html::rawElement( 'div', array( 'class' => 'mw-limitReportExplanation' ),
wfMessage( 'limitreport-title' )->parseAsBlock()
Html::closeElement( 'table' ) .
Html::closeElement( 'div' );
- wfProfileOut( __METHOD__ );
return $limitReport;
}
global $wgOut, $wgUser, $wgRawHtml, $wgLang;
global $wgAllowUserCss, $wgAllowUserJs;
- wfProfileIn( __METHOD__ );
if ( $wgRawHtml && !$this->mTokenOk ) {
// Could be an offsite preview attempt. This is very unsafe if
$parsedNote = $wgOut->parse( "<div class='previewnote'>" .
wfMessage( 'session_fail_preview_html' )->text() . "</div>", true, /* interface */true );
}
- wfProfileOut( __METHOD__ );
return $parsedNote;
}
'AlternateEditPreview',
array( $this, &$content, &$previewHTML, &$this->mParserOutput ) )
) {
- wfProfileOut( __METHOD__ );
return $previewHTML;
}
'class' => 'mw-content-' . $pageViewLang->getDir() );
$previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
- wfProfileOut( __METHOD__ );
return $previewhead . $previewHTML . $this->previewTextAfterContent;
}
* @param array $cond
*/
protected function do_list_authors( $cond ) {
- wfProfileIn( __METHOD__ );
$this->author_list = "<contributors>";
// rev_deleted
"</contributor>";
}
$this->author_list .= "</contributors>";
- wfProfileOut( __METHOD__ );
}
/**
* @throws Exception
*/
protected function dumpFrom( $cond = '' ) {
- wfProfileIn( __METHOD__ );
# For logging dumps...
if ( $this->history & self::LOGS ) {
$where = array( 'user_id = log_user' );
}
// Inform caller about problem
- wfProfileOut( __METHOD__ );
throw $e;
}
# For page dumps...
$join['revision'] = array( 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' );
# One, and only one hook should set this, and return false
if ( Hooks::run( 'WikiExporter::dumpStableQuery', array( &$tables, &$opts, &$join ) ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . " given invalid history dump type." );
}
} elseif ( $this->history & WikiExporter::RANGE ) {
$opts['ORDER BY'] = array( 'rev_page ASC', 'rev_id ASC' );
} else {
# Unknown history specification parameter?
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . " given invalid history dump type." );
}
# Query optimization hacks
throw $e;
}
}
- wfProfileOut( __METHOD__ );
}
/**
* @access private
*/
function writeRevision( $row ) {
- wfProfileIn( __METHOD__ );
$out = " <revision>\n";
$out .= " " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n";
$out .= " </revision>\n";
- wfProfileOut( __METHOD__ );
return $out;
}
* @access private
*/
function writeLogItem( $row ) {
- wfProfileIn( __METHOD__ );
$out = " <logitem>\n";
$out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n";
$out .= " </logitem>\n";
- wfProfileOut( __METHOD__ );
return $out;
}
$comment, $actiontext = ''
) {
global $wgFeedDiffCutoff, $wgLang;
- wfProfileIn( __METHOD__ );
// log entries
$completeText = '<p>' . implode( ' ',
// Can't diff special pages, unreadable pages or pages with no new revision
// to compare against: just return the text.
if ( $title->getNamespace() < 0 || $accErrors || !$newid ) {
- wfProfileOut( __METHOD__ );
return $completeText;
}
}
$completeText .= $diffText;
- wfProfileOut( __METHOD__ );
return $completeText;
}
function wfMsgReal( $key, $args, $useDB = true, $forContent = false, $transform = true ) {
wfDeprecated( __METHOD__, '1.21' );
- wfProfileIn( __METHOD__ );
$message = wfMsgGetKey( $key, $useDB, $forContent, $transform );
$message = wfMsgReplaceArgs( $message, $args );
- wfProfileOut( __METHOD__ );
return $message;
}
*/
function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) {
static $badImageCache = null; // based on bad_image_list msg
- wfProfileIn( __METHOD__ );
# Handle redirects
$redirectTitle = RepoGroup::singleton()->checkRedirect( Title::makeTitle( NS_FILE, $name ) );
# Run the extension hook
$bad = false;
if ( !Hooks::run( 'BadImage', array( $name, &$bad ) ) ) {
- wfProfileOut( __METHOD__ );
return $bad;
}
$contextKey = $contextTitle ? $contextTitle->getPrefixedDBkey() : false;
$bad = isset( $badImages[$name] ) && !isset( $badImages[$name][$contextKey] );
- wfProfileOut( __METHOD__ );
return $bad;
}
* @return array Array of removed DOMElements
*/
public function filterContent() {
- wfProfileIn( __METHOD__ );
$removals = $this->parseItemsToRemove();
// Bail out early if nothing to do
},
true
) ) {
- wfProfileOut( __METHOD__ );
return array();
}
$removed = array_merge( $removed, $this->removeElements( $elements ) );
}
- wfProfileOut( __METHOD__ );
return $removed;
}
* @return string
*/
private function fixLibXML( $html ) {
- wfProfileIn( __METHOD__ );
static $replacements;
if ( !$replacements ) {
// We don't include rules like '"' => '&quot;' because entities had already been
}
$html = $replacements->replace( $html );
$html = mb_convert_encoding( $html, 'UTF-8', 'HTML-ENTITIES' );
- wfProfileOut( __METHOD__ );
return $html;
}
* @return string Processed HTML
*/
public function getText( $element = null ) {
- wfProfileIn( __METHOD__ );
if ( $this->doc ) {
wfProfileIn( __METHOD__ . '-dom' );
}
wfProfileOut( __METHOD__ . '-flatten' );
- wfProfileOut( __METHOD__ );
return $html;
}
* @return array
*/
protected function parseItemsToRemove() {
- wfProfileIn( __METHOD__ );
$removals = array(
'ID' => array(),
'TAG' => array(),
$removals['TAG'][] = 'video';
}
- wfProfileOut( __METHOD__ );
return $removals;
}
}
* @return Status
*/
public function execute() {
- wfProfileIn( __METHOD__ );
$this->content = "";
$this->setUserAgent( Http::userAgent() );
}
- wfProfileOut( __METHOD__ );
}
/**
* found in an array in the member variable headerList.
*/
protected function parseHeader() {
- wfProfileIn( __METHOD__ );
$lastname = "";
$this->parseCookies();
- wfProfileOut( __METHOD__ );
}
/**
* Parse the cookies in the response headers and store them in the cookie jar.
*/
protected function parseCookies() {
- wfProfileIn( __METHOD__ );
if ( !$this->cookieJar ) {
$this->cookieJar = new CookieJar;
}
}
- wfProfileOut( __METHOD__ );
}
/**
}
public function execute() {
- wfProfileIn( __METHOD__ );
parent::execute();
if ( !$this->status->isOK() ) {
- wfProfileOut( __METHOD__ );
return $this->status;
}
$curlHandle = curl_init( $this->url );
if ( !curl_setopt_array( $curlHandle, $this->curlOptions ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Error setting curl options." );
}
$this->parseHeader();
$this->setStatus();
- wfProfileOut( __METHOD__ );
return $this->status;
}
}
public function execute() {
- wfProfileIn( __METHOD__ );
parent::execute();
if ( $fh === false ) {
$this->status->fatal( 'http-request-error' );
- wfProfileOut( __METHOD__ );
return $this->status;
}
if ( $result['timed_out'] ) {
$this->status->fatal( 'http-timed-out', $this->url );
- wfProfileOut( __METHOD__ );
return $this->status;
}
}
fclose( $fh );
- wfProfileOut( __METHOD__ );
return $this->status;
}
wfWarn( __METHOD__ . ': Requires $target to be a Title object.', 2 );
return "<!-- ERROR -->$html";
}
- wfProfileIn( __METHOD__ );
if ( is_string( $query ) ) {
// some functions withing core using this still hand over query strings
if ( !Hooks::run( 'LinkBegin',
array( $dummy, $target, &$html, &$customAttribs, &$query, &$options, &$ret ) )
) {
- wfProfileOut( __METHOD__ );
return $ret;
}
$ret = Html::rawElement( 'a', $attribs, $html );
}
- wfProfileOut( __METHOD__ );
return $ret;
}
* @return string
*/
private static function linkUrl( $target, $query, $options ) {
- wfProfileIn( __METHOD__ );
# We don't want to include fragments for broken links, because they
# generally make no sense.
if ( in_array( 'broken', $options ) && $target->hasFragment() ) {
}
$ret = $target->getLinkURL( $query, false, $proto );
- wfProfileOut( __METHOD__ );
return $ret;
}
* @return array
*/
private static function linkAttribs( $target, $attribs, $options ) {
- wfProfileIn( __METHOD__ );
global $wgUser;
$defaults = array();
$ret[$key] = $val;
}
}
- wfProfileOut( __METHOD__ );
return $ret;
}
}
global $wgEnableUploads, $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
- wfProfileIn( __METHOD__ );
if ( $label == '' ) {
$label = $title->getPrefixedText();
}
$redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
if ( $redir ) {
- wfProfileOut( __METHOD__ );
return self::linkKnown( $title, $encLabel, array(), wfCgiToArray( $query ) );
}
$href = self::getUploadUrl( $title, $query );
- wfProfileOut( __METHOD__ );
return '<a href="' . htmlspecialchars( $href ) . '" class="new" title="' .
htmlspecialchars( $title->getPrefixedText(), ENT_QUOTES ) . '">' .
$encLabel . '</a>';
}
- wfProfileOut( __METHOD__ );
return self::linkKnown( $title, $encLabel, array(), wfCgiToArray( $query ) );
}
* @return mixed|string
*/
public static function formatComment( $comment, $title = null, $local = false ) {
- wfProfileIn( __METHOD__ );
# Sanitize text a bit:
$comment = str_replace( "\n", " ", $comment );
$comment = self::formatAutocomments( $comment, $title, $local );
$comment = self::formatLinksInComment( $comment, $title, $local );
- wfProfileOut( __METHOD__ );
return $comment;
}
# ../Foobar/ -- convert to CurrentPage/Foobar, use 'Foobar' as text
# (from CurrentPage/CurrentSubPage)
- wfProfileIn( __METHOD__ );
$ret = $target; # default return value is no change
# Some namespaces don't allow subpages,
}
}
- wfProfileOut( __METHOD__ );
return $ret;
}
$section = false, $more = null
) {
global $wgLang;
- wfProfileIn( __METHOD__ );
$outText = '';
if ( count( $templates ) > 0 ) {
$outText .= '</ul>';
}
- wfProfileOut( __METHOD__ );
return $outText;
}
* @return string HTML output
*/
public static function formatHiddenCategories( $hiddencats ) {
- wfProfileIn( __METHOD__ );
$outText = '';
if ( count( $hiddencats ) > 0 ) {
}
$outText .= '</ul>';
}
- wfProfileOut( __METHOD__ );
return $outText;
}
* escape), or false for no title attribute
*/
public static function titleAttrib( $name, $options = null ) {
- wfProfileIn( __METHOD__ );
$message = wfMessage( "tooltip-$name" );
}
}
- wfProfileOut( __METHOD__ );
return $tooltip;
}
if ( isset( self::$accesskeycache[$name] ) ) {
return self::$accesskeycache[$name];
}
- wfProfileIn( __METHOD__ );
$message = wfMessage( "accesskey-$name" );
}
}
- wfProfileOut( __METHOD__ );
self::$accesskeycache[$name] = $accesskey;
return self::$accesskeycache[$name];
}
static function makeLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
wfDeprecated( __METHOD__, '1.21' );
- wfProfileIn( __METHOD__ );
$query = wfCgiToArray( $query );
list( $inside, $trail ) = self::splitTrail( $trail );
if ( $text === '' ) {
$ret = self::link( $nt, "$prefix$text$inside", array(), $query ) . $trail;
- wfProfileOut( __METHOD__ );
return $ret;
}
) {
wfDeprecated( __METHOD__, '1.21' );
- wfProfileIn( __METHOD__ );
if ( $text == '' ) {
$text = self::linkText( $title );
$ret = self::link( $title, "$prefix$text$inside", $attribs, $query,
array( 'known', 'noclasses' ) ) . $trail;
- wfProfileOut( __METHOD__ );
return $ret;
}
*/
function load( $id ) {
global $wgContLang;
- wfProfileIn( __METHOD__ );
$this->mId = $id;
$wgContLang->getMagic( $this );
if ( !$this->mSynonyms ) {
$this->mSynonyms = array( 'brionmademeputthishere' );
- wfProfileOut( __METHOD__ );
throw new MWException( "Error: invalid magic word '$id'" );
}
- wfProfileOut( __METHOD__ );
}
/**
private function performRequest() {
global $wgTitle;
- wfProfileIn( __METHOD__ );
$request = $this->context->getRequest();
$requestTitle = $title = $this->context->getTitle();
|| $title->isSpecial( 'Badtitle' )
) {
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
- wfProfileOut( __METHOD__ );
throw new BadTitleError();
}
$this->context->setTitle( $badTitle );
$wgTitle = $badTitle;
- wfProfileOut( __METHOD__ );
throw new PermissionsError( 'read', $permErrors );
}
$output->redirect( $url, 301 );
} else {
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
- wfProfileOut( __METHOD__ );
throw new BadTitleError();
}
// Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
} elseif ( is_string( $article ) ) {
$output->redirect( $article );
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle()"
. " returned neither an object nor a URL" );
}
$user->addAutopromoteOnceGroups( 'onView' );
}
- wfProfileOut( __METHOD__ );
}
/**
* @return mixed An Article, or a string to redirect to another URL
*/
private function initializeArticle() {
- wfProfileIn( __METHOD__ );
$title = $this->context->getTitle();
if ( $this->context->canUseWikiPage() ) {
// NS_MEDIAWIKI has no redirects.
// It is also used for CSS/JS, so performance matters here...
if ( $title->getNamespace() == NS_MEDIAWIKI ) {
- wfProfileOut( __METHOD__ );
return $article;
}
if ( is_string( $target ) ) {
if ( !$this->config->get( 'DisableHardRedirects' ) ) {
// we'll need to redirect
- wfProfileOut( __METHOD__ );
return $target;
}
}
}
}
- wfProfileOut( __METHOD__ );
return $article;
}
* @param Title $requestTitle The original title, before any redirects were applied
*/
private function performAction( Page $page, Title $requestTitle ) {
- wfProfileIn( __METHOD__ );
$request = $this->context->getRequest();
$output = $this->context->getOutput();
if ( !Hooks::run( 'MediaWikiPerformAction',
array( $output, $page, $title, $user, $request, $this ) )
) {
- wfProfileOut( __METHOD__ );
return;
}
}
$action->show();
- wfProfileOut( __METHOD__ );
return;
}
$output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
}
- wfProfileOut( __METHOD__ );
}
/**
* @return bool
*/
private function checkMaxLag() {
- wfProfileIn( __METHOD__ );
$maxLag = $this->context->getRequest()->getVal( 'maxlag' );
if ( !is_null( $maxLag ) ) {
list( $host, $lag ) = wfGetLB()->getMaxLag();
echo "Waiting for a database server: $lag seconds lagged\n";
}
- wfProfileOut( __METHOD__ );
exit;
}
}
- wfProfileOut( __METHOD__ );
return true;
}
private function main() {
global $wgTitle;
- wfProfileIn( __METHOD__ );
$request = $this->context->getRequest();
$dispatcher = new AjaxDispatcher( $this->config );
$dispatcher->performAction( $this->context->getUser() );
- wfProfileOut( __METHOD__ );
return;
}
$output->addVaryHeader( 'X-Forwarded-Proto' );
$output->redirect( $redirUrl );
$output->output();
- wfProfileOut( __METHOD__ );
return;
}
}
// Tell OutputPage that output is taken care of
$this->context->getOutput()->disable();
wfProfileOut( 'main-try-filecache' );
- wfProfileOut( __METHOD__ );
return;
}
}
// Output everything!
$this->context->getOutput()->output();
- wfProfileOut( __METHOD__ );
}
/**
return; // recursion guard
}
- $section = new ProfileSection( __METHOD__ );
if ( $jobRunRate < 1 ) {
$max = mt_getrandmax();
* @return array An array mapping module names to message blobs
*/
public function get( ResourceLoader $resourceLoader, $modules, $lang ) {
- wfProfileIn( __METHOD__ );
if ( !count( $modules ) ) {
- wfProfileOut( __METHOD__ );
return array();
}
// Try getting from the DB first
}
}
- wfProfileOut( __METHOD__ );
return $blobs;
}
) {
global $wgParser;
- wfProfileIn( __METHOD__ );
$popts = $this->parserOptions();
$oldTidy = $popts->setTidy( $tidy );
$this->addParserOutput( $parserOutput );
- wfProfileOut( __METHOD__ );
}
/**
return;
}
- wfProfileIn( __METHOD__ );
$response = $this->getRequest()->response();
$config = $this->getConfig();
}
}
- wfProfileOut( __METHOD__ );
return;
} elseif ( $this->mStatusCode ) {
$message = HttpStatus::getMessage( $this->mStatusCode );
// adding of CSS or Javascript by extensions.
Hooks::run( 'BeforePageDisplay', array( &$this, &$sk ) );
- wfProfileIn( 'Output-skin' );
$sk->outputPage();
- wfProfileOut( 'Output-skin' );
}
// This hook allows last minute changes to final overall output by modifying output buffer
ob_end_flush();
- wfProfileOut( __METHOD__ );
}
/**
public function headElement( Skin $sk, $includeStyle = true ) {
global $wgContLang;
- $section = new ProfileSection( __METHOD__ );
$userdir = $this->getLanguage()->getDir();
$sitedir = $wgContLang->getDir();
* @return array
*/
public function searchWithVariants( $search, $limit, array $namespaces, $offset = 0 ) {
- wfProfileIn( __METHOD__ );
$searches = $this->search( $search, $limit, $namespaces, $offset );
// if the content language has variants, try to retrieve fallback results
}
}
}
- wfProfileOut( __METHOD__ );
return $searches;
}
if ( !$revIds ) {
return $revLens; // empty
}
- wfProfileIn( __METHOD__ );
$res = $db->select( 'revision',
array( 'rev_id', 'rev_len' ),
array( 'rev_id' => $revIds ),
foreach ( $res as $row ) {
$revLens[$row->rev_id] = $row->rev_len;
}
- wfProfileOut( __METHOD__ );
return $revLens;
}
* @return string Text the text requested or false on failure
*/
public static function getRevisionText( $row, $prefix = 'old_', $wiki = false ) {
- wfProfileIn( __METHOD__ );
# Get data
$textField = $prefix . 'text';
if ( isset( $row->$textField ) ) {
$text = $row->$textField;
} else {
- wfProfileOut( __METHOD__ );
return false;
}
$url = $text;
$parts = explode( '://', $url, 2 );
if ( count( $parts ) == 1 || $parts[1] == '' ) {
- wfProfileOut( __METHOD__ );
return false;
}
$text = ExternalStore::fetchFromURL( $url, array( 'wiki' => $wiki ) );
if ( $text !== false ) {
$text = self::decompressRevisionText( $text, $flags );
}
- wfProfileOut( __METHOD__ );
return $text;
}
public function insertOn( $dbw ) {
global $wgDefaultExternalStore, $wgContentHandlerUseDB;
- wfProfileIn( __METHOD__ );
$this->checkContentModel();
// Store and get the URL
$data = ExternalStore::insertToDefault( $data );
if ( !$data ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Unable to store text to external storage" );
}
if ( $flags ) {
$title = $this->getTitle();
if ( $title === null ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Insufficient information to determine the title of the "
. "revision's page!" );
}
Hooks::run( 'RevisionInsertComplete', array( &$this, $data, $flags ) );
- wfProfileOut( __METHOD__ );
return $this->mId;
}
* @return string|bool The revision's text, or false on failure
*/
protected function loadText() {
- wfProfileIn( __METHOD__ );
// Caching may be beneficial for massive use of external storage
global $wgRevisionCacheExpiry, $wgMemc;
$text = $wgMemc->get( $key );
if ( is_string( $text ) ) {
wfDebug( __METHOD__ . ": got id $textId from cache\n" );
- wfProfileOut( __METHOD__ );
return $text;
}
}
$wgMemc->set( $key, $text, $wgRevisionCacheExpiry );
}
- wfProfileOut( __METHOD__ );
return $text;
}
public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
global $wgContentHandlerUseDB;
- wfProfileIn( __METHOD__ );
$fields = array( 'page_latest', 'page_namespace', 'page_title',
'rev_text_id', 'rev_len', 'rev_sha1' );
$revision = null;
}
- wfProfileOut( __METHOD__ );
return $revision;
}
static $htmlpairsStatic, $htmlsingle, $htmlsingleonly, $htmlnest, $tabletags,
$htmllist, $listtags, $htmlsingleallowed, $htmlelementsStatic, $staticInitialised;
- wfProfileIn( __METHOD__ );
// Base our staticInitialised variable off of the global config state so that if the globals
// are changed (like in the screwed up test system) we will re-initialise the settings.
$text .= '<' . str_replace( '>', '>', $x );
}
}
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string
*/
static function removeHTMLcomments( $text ) {
- wfProfileIn( __METHOD__ );
while ( ( $start = strpos( $text, '<!--' ) ) !== false ) {
$end = strpos( $text, '-->', $start + 4 );
if ( $end === false ) {
$text = substr_replace( $text, '', $start, $end - $start );
}
}
- wfProfileOut( __METHOD__ );
return $text;
}
* @return int
*/
static function pagesInNs( $ns ) {
- wfProfileIn( __METHOD__ );
if ( !isset( self::$pageCount[$ns] ) ) {
$dbr = wfGetDB( DB_SLAVE );
self::$pageCount[$ns] = (int)$dbr->selectField(
__METHOD__
);
}
- wfProfileOut( __METHOD__ );
return self::$pageCount[$ns];
}
* @return bool Success
*/
public static function stream( $fname, $headers = array(), $sendErrors = true ) {
- wfProfileIn( __METHOD__ );
if ( FileBackend::isStoragePath( $fname ) ) { // sanity
- wfProfileOut( __METHOD__ );
throw new MWException( __FUNCTION__ . " given storage path '$fname'." );
}
$ok = false; // failed
}
- wfProfileOut( __METHOD__ );
return $ok;
}
* @return string The URL
*/
public function getLinkURL( $query = '', $query2 = false, $proto = PROTO_RELATIVE ) {
- wfProfileIn( __METHOD__ );
if ( $this->isExternal() || $proto !== PROTO_RELATIVE ) {
$ret = $this->getFullURL( $query, $query2, $proto );
} elseif ( $this->getPrefixedText() === '' && $this->hasFragment() ) {
} else {
$ret = $this->getLocalURL( $query, $query2 ) . $this->getFragmentForURL();
}
- wfProfileOut( __METHOD__ );
return $ret;
}
protected function getUserPermissionsErrorsInternal( $action, $user,
$doExpensiveQueries = true, $short = false
) {
- wfProfileIn( __METHOD__ );
# Read has special handling
if ( $action == 'read' ) {
$errors = $this->$method( $action, $user, $errors, $doExpensiveQueries, $short );
}
- wfProfileOut( __METHOD__ );
return $errors;
}
return array( $this->mHasCascadingRestrictions, $pagerestrictions );
}
- wfProfileIn( __METHOD__ );
$dbr = wfGetDB( DB_SLAVE );
$this->mHasCascadingRestrictions = $sources;
}
- wfProfileOut( __METHOD__ );
return array( $sources, $pagerestrictions );
}
*/
public function getPageLanguage() {
global $wgLang, $wgLanguageCode;
- wfProfileIn( __METHOD__ );
if ( $this->isSpecialPage() ) {
// special pages are in the user language
- wfProfileOut( __METHOD__ );
return $wgLang;
}
// Checking if DB language is set
if ( $this->mDbPageLanguage ) {
- wfProfileOut( __METHOD__ );
return wfGetLangObj( $this->mDbPageLanguage );
}
$langObj = wfGetLangObj( $this->mPageLanguage[0] );
}
- wfProfileOut( __METHOD__ );
return $langObj;
}
if ( $this->mLoadedItems === true ) {
return;
}
- wfProfileIn( __METHOD__ );
// Set it now to avoid infinite recursion in accessors
$this->mLoadedItems = true;
Hooks::run( 'UserLoadAfterLoadFromSession', array( $this ) );
break;
default:
- wfProfileOut( __METHOD__ );
throw new MWException( "Unrecognised value for User->mFrom: \"{$this->mFrom}\"" );
}
- wfProfileOut( __METHOD__ );
}
/**
* @param string|bool $name
*/
public function loadDefaults( $name = false ) {
- wfProfileIn( __METHOD__ );
$passwordFactory = self::getPasswordFactory();
Hooks::run( 'UserLoadDefaults', array( $this, $name ) );
- wfProfileOut( __METHOD__ );
}
/**
return;
}
- wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . ": checking...\n" );
// Initialize data...
// Extensions
Hooks::run( 'GetBlockedStatus', array( &$this ) );
- wfProfileOut( __METHOD__ );
}
/**
* @return bool True if blacklisted.
*/
public function inDnsBlacklist( $ip, $bases ) {
- wfProfileIn( __METHOD__ );
$found = false;
// @todo FIXME: IPv6 ??? (http://bugs.php.net/bug.php?id=33170)
}
}
- wfProfileOut( __METHOD__ );
return $found;
}
if ( !$wgProxyList ) {
return false;
}
- wfProfileIn( __METHOD__ );
if ( !is_array( $wgProxyList ) ) {
// Load from the specified file
} else {
$ret = false;
}
- wfProfileOut( __METHOD__ );
return $ret;
}
}
global $wgMemc;
- wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ . '-' . $action );
$limits = $wgRateLimits[$action];
}
wfProfileOut( __METHOD__ . '-' . $action );
- wfProfileOut( __METHOD__ );
return $triggered;
}
*/
public function isBlockedFrom( $title, $bFromSlave = false ) {
global $wgBlockAllowsUTEdit;
- wfProfileIn( __METHOD__ );
$blocked = $this->isBlocked( $bFromSlave );
$allowUsertalk = ( $wgBlockAllowsUTEdit ? $this->mAllowUsertalk : false );
Hooks::run( 'UserIsBlockedFrom', array( $this, $title, &$blocked, &$allowUsertalk ) );
- wfProfileOut( __METHOD__ );
return $blocked;
}
*/
public function getEffectiveGroups( $recache = false ) {
if ( $recache || is_null( $this->mEffectiveGroups ) ) {
- wfProfileIn( __METHOD__ );
$this->mEffectiveGroups = array_unique( array_merge(
$this->getGroups(), // explicit groups
$this->getAutomaticGroups( $recache ) // implicit groups
Hooks::run( 'UserEffectiveGroups', array( &$this, &$this->mEffectiveGroups ) );
// Force reindexation of groups when a hook has unset one of them
$this->mEffectiveGroups = array_values( array_unique( $this->mEffectiveGroups ) );
- wfProfileOut( __METHOD__ );
}
return $this->mEffectiveGroups;
}
*/
public function getAutomaticGroups( $recache = false ) {
if ( $recache || is_null( $this->mImplicitGroups ) ) {
- wfProfileIn( __METHOD__ );
$this->mImplicitGroups = array( '*' );
if ( $this->getId() ) {
$this->mImplicitGroups[] = 'user';
// as getEffectiveGroups() depends on this function
$this->mEffectiveGroups = null;
}
- wfProfileOut( __METHOD__ );
}
return $this->mImplicitGroups;
}
if ( $this->mEditCount === null ) {
/* Populate the count, if it has not been populated yet */
- wfProfileIn( __METHOD__ );
$dbr = wfGetDB( DB_SLAVE );
// check if the user_editcount field has been initialized
$count = $dbr->selectField(
$count = $this->initEditCount();
}
$this->mEditCount = $count;
- wfProfileOut( __METHOD__ );
}
return (int)$this->mEditCount;
}
public function checkPassword( $password ) {
global $wgAuth, $wgLegacyEncoding;
- $section = new ProfileSection( __METHOD__ );
$this->loadPasswords();
* @return bool
*/
public static function batchAddWatch( array $items ) {
- $section = new ProfileSection( __METHOD__ );
if ( wfReadOnly() ) {
return false;
* @return bool
*/
public function removeWatch() {
- wfProfileIn( __METHOD__ );
// Only loggedin user can have a watchlist
if ( wfReadOnly() || $this->mUser->isAnon() || !$this->isAllowed( 'editmywatchlist' ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
$this->watched = false;
- wfProfileOut( __METHOD__ );
return $success;
}
* @return string HTML
*/
public function onView() {
- wfProfileIn( __METHOD__ );
if ( $this->page->getID() == 0 ) {
$s = $this->msg( 'nocredits' )->parse();
$s = $this->getCredits( -1 );
}
- wfProfileOut( __METHOD__ );
return Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $s );
}
* @return string Html
*/
public function getCredits( $cnt, $showIfMax = true ) {
- wfProfileIn( __METHOD__ );
$s = '';
if ( $cnt != 0 ) {
}
}
- wfProfileOut( __METHOD__ );
return $s;
}
return; // Client cache fresh and headers sent, nothing more to do.
}
- wfProfileIn( __METHOD__ );
$this->preCacheMessages();
$config = $this->context->getConfig();
$feedType = $request->getVal( 'feed' );
if ( $feedType ) {
$this->feed( $feedType );
- wfProfileOut( __METHOD__ );
return;
}
'msgKey' => array( 'moveddeleted-notice' )
)
);
- wfProfileOut( __METHOD__ );
return;
}
);
$out->preventClickjacking( $pager->getPreventClickjacking() );
- wfProfileOut( __METHOD__ );
}
/**
* @return array
*/
protected function pageCounts( Title $title ) {
- wfProfileIn( __METHOD__ );
$id = $title->getArticleID();
$config = $this->context->getConfig();
__METHOD__
);
- wfProfileOut( __METHOD__ );
return $result;
}
}
public function onSubmit( $data ) {
- wfProfileIn( __METHOD__ );
self::doUnwatch( $this->getTitle(), $this->getUser() );
- wfProfileOut( __METHOD__ );
return true;
}
}
public function onSubmit( $data ) {
- wfProfileIn( __METHOD__ );
self::doWatch( $this->getTitle(), $this->getUser() );
- wfProfileOut( __METHOD__ );
return true;
}
* @return ParserOptions
*/
protected function makeParserOptions( WikiPage $pageObj, array $params ) {
- wfProfileIn( __METHOD__ );
$popts = $pageObj->makeParserOptions( $this->getContext() );
$popts->enableLimitReport( !$params['disablepp'] );
$popts->setIsSectionPreview( $params['sectionpreview'] );
$popts->setEditSection( !$params['disableeditsection'] );
- wfProfileOut( __METHOD__ );
return $popts;
}
public static function getTokenTypeSalts() {
static $salts = null;
if ( !$salts ) {
- wfProfileIn( __METHOD__ );
$salts = array(
'csrf' => '',
'watch' => 'watch',
);
Hooks::run( 'ApiQueryTokensRegisterTypes', array( &$salts ) );
ksort( $salts );
- wfProfileOut( __METHOD__ );
}
return $salts;
if ( $types ) {
return $types;
}
- wfProfileIn( __METHOD__ );
$types = array( 'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' ) );
$names = array( 'edit', 'delete', 'protect', 'move', 'block', 'unblock',
'email', 'import', 'watch', 'options' );
}
Hooks::run( 'ApiTokensGetTokenTypes', array( &$types ) );
ksort( $types );
- wfProfileOut( __METHOD__ );
return $types;
}
* @return ResultWrapper
*/
protected function queryLinks( $table, $startId, $endId, $max, $select = 'all' ) {
- wfProfileIn( __METHOD__ );
$fromField = $this->getPrefix( $table ) . '_from';
}
}
- wfProfileOut( __METHOD__ );
return $res;
}
* @return array Remaining IDs
*/
protected function executeInto( &$cache ) {
- wfProfileIn( __METHOD__ );
$res = $this->doQuery();
$this->doGenderQuery();
$ids = $this->addResultToCache( $cache, $res );
- wfProfileOut( __METHOD__ );
return $ids;
}
if ( $this->isEmpty() ) {
return false;
}
- wfProfileIn( __METHOD__ );
// This is similar to LinkHolderArray::replaceInternal
$dbr = wfGetDB( DB_SLAVE );
$caller .= " (for {$this->caller})";
}
$res = $dbr->select( $table, $fields, $conds, $caller );
- wfProfileOut( __METHOD__ );
return $res;
}
public function addLinkObj( $nt ) {
global $wgContentHandlerUseDB;
- wfProfileIn( __METHOD__ );
$key = $nt->getPrefixedDBkey();
if ( $this->isBadLink( $key ) || $nt->isExternal() ) {
- wfProfileOut( __METHOD__ );
return 0;
}
$id = $this->getGoodLinkID( $key );
if ( $id != 0 ) {
- wfProfileOut( __METHOD__ );
return $id;
}
if ( $key === '' ) {
- wfProfileOut( __METHOD__ );
return 0;
}
$id = 0;
}
- wfProfileOut( __METHOD__ );
return $id;
}
* @return array
*/
protected function readPHPFile( $_fileName, $_fileType ) {
- wfProfileIn( __METHOD__ );
// Disable APC caching
wfSuppressWarnings();
$_apcEnabled = ini_set( 'apc.cache_by_default', '0' );
} elseif ( $_fileType == 'aliases' ) {
$data = compact( 'aliases' );
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ": Invalid file type: $_fileType" );
}
- wfProfileOut( __METHOD__ );
return $data;
}
* @return array Array with a 'messages' key, or empty array if the file doesn't exist
*/
public function readJSONFile( $fileName ) {
- wfProfileIn( __METHOD__ );
if ( !is_readable( $fileName ) ) {
- wfProfileOut( __METHOD__ );
return array();
}
$json = file_get_contents( $fileName );
if ( $json === false ) {
- wfProfileOut( __METHOD__ );
return array();
}
$data = FormatJson::decode( $json, true );
if ( $data === null ) {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ": Invalid JSON file: $fileName" );
}
}
}
- wfProfileOut( __METHOD__ );
// The JSON format only supports messages, none of the other variables, so wrap the data
return array( 'messages' => $data );
*/
protected function readSourceFilesAndRegisterDeps( $code, &$deps ) {
global $IP;
- wfProfileIn( __METHOD__ );
// This reads in the PHP i18n file with non-messages l10n data
$fileName = Language::getMessagesFileName( $code );
$deps['plurals'] = new FileDependency( "$IP/languages/data/plurals.xml" );
$deps['plurals-mw'] = new FileDependency( "$IP/languages/data/plurals-mediawiki.xml" );
- wfProfileOut( __METHOD__ );
return $data;
}
*/
public function recache( $code ) {
global $wgExtensionMessagesFiles;
- wfProfileIn( __METHOD__ );
if ( !$code ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Invalid language code requested" );
}
$this->recachedLangs[$code] = true;
Hooks::run( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) );
if ( is_null( $allData['namespaceNames'] ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': Localisation data failed sanity check! ' .
'Check that your languages/messages/MessagesEn.php file is intact.' );
}
MessageBlobStore::getInstance()->clear();
}
- wfProfileOut( __METHOD__ );
}
/**
}
# Loading code starts
- wfProfileIn( __METHOD__ );
$success = false; # Keep track of success
$staleCache = false; # a cache array with expired data, or false if none has been loaded
$where = array(); # Debug info, delayed to avoid spamming debug log too much
}
$info = implode( ', ', $where );
wfDebugLog( 'MessageCache', __METHOD__ . ": Loading $code... $info\n" );
- wfProfileOut( __METHOD__ );
return $success;
}
* @return array Loaded messages for storing in caches.
*/
function loadFromDB( $code ) {
- wfProfileIn( __METHOD__ );
global $wgMaxMsgCacheEntrySize, $wgLanguageCode, $wgAdaptiveMessageCache;
$dbr = wfGetDB( DB_SLAVE );
$cache = array();
$cache['VERSION'] = MSG_CACHE_VERSION;
$cache['EXPIRY'] = wfTimestamp( TS_MW, time() + $this->mExpiry );
- wfProfileOut( __METHOD__ );
return $cache;
}
*/
public function replace( $title, $text ) {
global $wgMaxMsgCacheEntrySize;
- wfProfileIn( __METHOD__ );
if ( $this->mDisable ) {
- wfProfileOut( __METHOD__ );
return;
}
Hooks::run( 'MessageCacheReplace', array( $title, $text ) );
- wfProfileOut( __METHOD__ );
}
/**
* @return bool
*/
protected function saveToCaches( $cache, $dest, $code = false ) {
- wfProfileIn( __METHOD__ );
global $wgUseLocalMessageCache;
$cacheKey = wfMemcKey( 'messages', $code );
$this->saveToLocal( $serialized, $hash, $code );
}
- wfProfileOut( __METHOD__ );
return $success;
}
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
global $wgContLang;
- $section = new ProfileSection( __METHOD__ );
if ( is_int( $key ) ) {
// Fix numerical strings that somehow become ints
$popts->setInterfaceMessage( $interface );
$popts->setTargetLanguage( $language );
- wfProfileIn( __METHOD__ );
if ( !$title || !$title instanceof Title ) {
global $wgTitle;
wfDebugLog( 'GlobalTitleFail', __METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.' );
$res = $parser->parse( $text, $title, $popts, $linestart );
$this->mInParser = false;
- wfProfileOut( __METHOD__ );
return $res;
}
* @param string $caller The calling method
*/
public function doQuery( array $userIds, $options = array(), $caller = '' ) {
- wfProfileIn( __METHOD__ );
$usersToCheck = array();
$usersToQuery = array();
}
$lb->execute();
- wfProfileOut( __METHOD__ );
}
/**
* @param Feed $feed
*/
public static function generateFeed( $rows, &$feed ) {
- wfProfileIn( __METHOD__ );
$items = self::buildItems( $rows );
$feed->outHeader();
foreach ( $items as $item ) {
$feed->outItem( $item );
}
$feed->outFooter();
- wfProfileOut( __METHOD__ );
}
/**
* @return array
*/
public static function buildItems( $rows ) {
- wfProfileIn( __METHOD__ );
$items = array();
# Merge adjacent edits by one user
);
}
- wfProfileOut( __METHOD__ );
return $items;
}
}
* @return string
*/
public function recentChangesLine( &$baseRC, $watched = false ) {
- wfProfileIn( __METHOD__ );
$date = $this->getLanguage()->userDate(
$baseRC->mAttribs['rc_timestamp'],
$cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $baseRC, $watched );
$this->addCacheEntry( $cacheEntry );
- wfProfileOut( __METHOD__ );
return $ret;
}
* @return string
*/
protected function recentChangesBlockGroup( $block ) {
- wfProfileIn( __METHOD__ );
# Add the namespace and title of the block as part of the class
$classes = array( 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc' );
$this->rcCacheIndex++;
- wfProfileOut( __METHOD__ );
return $r;
}
* @return string A HTML formatted line (generated using $r)
*/
protected function recentChangesBlockLine( $rcObj ) {
- wfProfileIn( __METHOD__ );
$query['curid'] = $rcObj->mAttribs['rc_cur_id'];
$type = $rcObj->mAttribs['rc_type'];
$r .= "</td></tr></table>\n";
- wfProfileOut( __METHOD__ );
return $r;
}
return '';
}
- wfProfileIn( __METHOD__ );
$blockOut = '';
foreach ( $this->rc_cache as $block ) {
}
}
- wfProfileOut( __METHOD__ );
return '<div>' . $blockOut . '</div>';
}
* @return string|bool
*/
public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
- wfProfileIn( __METHOD__ );
$classes = array();
// use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
}
if ( !Hooks::run( 'OldChangesListRecentChangesLine', array( &$this, &$html, $rc, &$classes ) ) ) {
- wfProfileOut( __METHOD__ );
-
return false;
}
- wfProfileOut( __METHOD__ );
$dateheader = ''; // $html now contains only <li>...</li>, for hooks' convenience.
$this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
* @see Content::replaceSection()
*/
public function replaceSection( $sectionId, Content $with, $sectionTitle = '' ) {
- wfProfileIn( __METHOD__ );
$myModelId = $this->getModel();
$sectionModelId = $with->getModel();
if ( $sectionModelId != $myModelId ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Incompatible content model for section: " .
"document uses $myModelId but " .
"section uses $sectionModelId." );
$text = $with->getNativeData();
if ( strval( $sectionId ) === '' ) {
- wfProfileOut( __METHOD__ );
return $with; # XXX: copy first?
}
$newContent = new static( $text );
- wfProfileOut( __METHOD__ );
return $newContent;
}
*/
function open( $server, $user, $password, $dbName ) {
global $wgAllDBsAreLocalhost, $wgSQLMode;
- wfProfileIn( __METHOD__ );
# Debugging hack -- fake cluster
if ( $wgAllDBsAreLocalhost ) {
$this->mConn = $this->mysqlConnect( $realServer );
} catch ( Exception $ex ) {
wfProfileOut( "dbconnect-$server" );
- wfProfileOut( __METHOD__ );
$this->restoreErrorHandler();
throw $ex;
}
"Server: $server, User: $user, Password: " .
substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
- wfProfileOut( __METHOD__ );
$this->reportConnectionError( $error );
}
wfDebug( "Error selecting database $dbName on server {$this->mServer} " .
"from client host " . wfHostname() . "\n" );
- wfProfileOut( __METHOD__ );
$this->reportConnectionError( "Error selecting database $dbName" );
}
'method' => __METHOD__,
) )
);
- wfProfileOut( __METHOD__ );
$this->reportConnectionError( "Error setting sql_mode to $mode" );
}
}
$this->mOpened = true;
- wfProfileOut( __METHOD__ );
return true;
}
return '0'; // http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html
}
- wfProfileIn( __METHOD__ );
# Commit any open transactions
$this->commit( __METHOD__, 'flush' );
if ( $wait > $timeout * 1e6 ) {
wfDebug( "Fake slave timed out waiting for $pos ($wait us)\n" );
- wfProfileOut( __METHOD__ );
return -1;
} elseif ( $wait > 0 ) {
wfDebug( "Fake slave waiting $wait us\n" );
usleep( $wait );
- wfProfileOut( __METHOD__ );
return 1;
} else {
wfDebug( "Fake slave up to date ($wait us)\n" );
- wfProfileOut( __METHOD__ );
return 0;
}
}
}
- wfProfileOut( __METHOD__ );
return $status;
}
* @param DBMasterPos $pos
*/
public function waitFor( $pos ) {
- wfProfileIn( __METHOD__ );
$this->mWaitForPos = $pos;
$i = $this->mReadIndex;
$this->mLaggedSlaveMode = true;
}
}
- wfProfileOut( __METHOD__ );
}
/**
* @return bool Success (able to connect and no timeouts reached)
*/
public function waitForAll( $pos, $timeout = null ) {
- wfProfileIn( __METHOD__ );
$this->mWaitForPos = $pos;
$serverCount = count( $this->mServers );
$ok = $this->doWait( $i, true, $timeout ) && $ok;
}
}
- wfProfileOut( __METHOD__ );
return $ok;
}
* @return DatabaseBase
*/
public function getConnection( $i, $groups = array(), $wiki = false ) {
- wfProfileIn( __METHOD__ );
-
if ( $i === null || $i === false ) {
- wfProfileOut( __METHOD__ );
throw new MWException( 'Attempt to call ' . __METHOD__ .
' with invalid server index' );
}
# Couldn't find a working server in getReaderIndex()?
if ( $i === false ) {
$this->mLastError = 'No working slave server: ' . $this->mLastError;
- wfProfileOut( __METHOD__ );
return $this->reportConnectionError();
}
# Now we have an explicit index into the servers array
$conn = $this->openConnection( $i, $wiki );
if ( !$conn ) {
- wfProfileOut( __METHOD__ );
return $this->reportConnectionError();
}
- wfProfileOut( __METHOD__ );
return $conn;
}
* @access private
*/
public function openConnection( $i, $wiki = false ) {
- wfProfileIn( __METHOD__ );
if ( $wiki !== false ) {
$conn = $this->openForeignConnection( $i, $wiki );
- wfProfileOut( __METHOD__ );
return $conn;
}
$conn = false;
}
}
- wfProfileOut( __METHOD__ );
return $conn;
}
* @return DatabaseBase
*/
private function openForeignConnection( $i, $wiki ) {
- wfProfileIn( __METHOD__ );
list( $dbName, $prefix ) = wfSplitWikiID( $wiki );
if ( isset( $this->mConns['foreignUsed'][$i][$wiki] ) ) {
// Reuse an already-used connection
$refCount = $conn->getLBInfo( 'foreignPoolRefCount' );
$conn->setLBInfo( 'foreignPoolRefCount', $refCount + 1 );
}
- wfProfileOut( __METHOD__ );
return $conn;
}
return array( 0 => 0 );
}
- $section = new ProfileSection( __METHOD__ );
$expiry = 5;
$requestRate = 10;
public static function doUpdates( $commit = '' ) {
global $wgDeferredUpdateList;
- wfProfileIn( __METHOD__ );
$updates = array_merge( $wgDeferredUpdateList, self::$updates );
// No need to get master connections in case of empty updates array
if ( !count( $updates ) ) {
- wfProfileOut( __METHOD__ );
return;
}
$updates = array_merge( $wgDeferredUpdateList, self::$updates );
}
- wfProfileOut( __METHOD__ );
}
/**
}
public function doUpdate() {
- wfProfileIn( __METHOD__ );
$job = new HTMLCacheUpdateJob(
$this->mTitle,
} );
}
- wfProfileOut( __METHOD__ );
}
}
}
protected function doIncrementalUpdate() {
- wfProfileIn( __METHOD__ );
# Page links
$existing = $this->getExistingLinks();
$this->queueRecursiveJobs();
}
- wfProfileOut( __METHOD__ );
}
/**
* @param string $table Table to use (e.g. 'templatelinks')
*/
public static function queueRecursiveJobsForTable( Title $title, $table ) {
- wfProfileIn( __METHOD__ );
if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
$job = new RefreshLinksJob(
$title,
JobQueueGroup::singleton()->push( $job );
JobQueueGroup::singleton()->deduplicateRootJob( $job );
}
- wfProfileOut( __METHOD__ );
}
/**
return;
}
- wfProfileIn( __METHOD__ );
$page = WikiPage::newFromID( $this->id, WikiPage::READ_LATEST );
$search->update( $this->id, $normalTitle, $search->normalizeText( $text ) );
}
- wfProfileOut( __METHOD__ );
}
/**
self::HTCPPurge( $urlArr );
}
- wfProfileIn( __METHOD__ );
// Remove duplicate URLs
$urlArr = array_unique( $urlArr );
}
$pool->run();
- wfProfileOut( __METHOD__ );
}
/**
*/
public static function HTCPPurge( $urlArr ) {
global $wgHTCPRouting, $wgHTCPMulticastTTL;
- wfProfileIn( __METHOD__ );
// HTCP CLR operation
$htcpOpCLR = 4;
$errstr = socket_strerror( socket_last_error() );
wfDebugLog( 'squid', __METHOD__ .
": Error opening UDP socket: $errstr" );
- wfProfileOut( __METHOD__ );
return;
}
foreach ( $urlArr as $url ) {
if ( !is_string( $url ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( 'Bad purge URL' );
}
$url = self::expand( $url );
}
foreach ( $conf as $subconf ) {
if ( !isset( $subconf['host'] ) || !isset( $subconf['port'] ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "Invalid HTCP rule for URL $url\n" );
}
}
$subconf['host'], $subconf['port'] );
}
}
- wfProfileOut( __METHOD__ );
}
/**
* @return DiffOp[]
*/
public function diff( $from_lines, $to_lines ) {
- wfProfileIn( __METHOD__ );
// Diff and store locally
$this->diffLocal( $from_lines, $to_lines );
$edits[] = new DiffOpAdd( $add );
}
}
- wfProfileOut( __METHOD__ );
return $edits;
}
*/
private function diffLocal( $from_lines, $to_lines ) {
global $wgExternalDiffEngine;
- wfProfileIn( __METHOD__ );
if ( $wgExternalDiffEngine == 'wikidiff3' ) {
// wikidiff3
// Find the LCS.
$this->compareSeq( 0, count( $this->xv ), 0, count( $this->yv ) );
}
- wfProfileOut( __METHOD__ );
}
/**
* This is extracted verbatim from analyze.c (GNU diffutils-2.7).
*/
private function shiftBoundaries( $lines, &$changed, $other_changed ) {
- wfProfileIn( __METHOD__ );
$i = 0;
$j = 0;
assert( '$j >= 0 && !$other_changed[$j]' );
}
}
- wfProfileOut( __METHOD__ );
}
}
*/
public function __construct( $from_lines, $to_lines,
$mapped_from_lines, $mapped_to_lines ) {
- wfProfileIn( __METHOD__ );
assert( 'count( $from_lines ) == count( $mapped_from_lines )' );
assert( 'count( $to_lines ) == count( $mapped_to_lines )' );
$yi += count( $closing );
}
}
- wfProfileOut( __METHOD__ );
}
}
* @param string[] $closing_lines
*/
public function __construct( $orig_lines, $closing_lines ) {
- wfProfileIn( __METHOD__ );
list( $orig_words, $orig_stripped ) = $this->split( $orig_lines );
list( $closing_words, $closing_stripped ) = $this->split( $closing_lines );
parent::__construct( $orig_words, $closing_words,
$orig_stripped, $closing_stripped );
- wfProfileOut( __METHOD__ );
}
/**
* @return array[]
*/
private function split( $lines ) {
- wfProfileIn( __METHOD__ );
$words = array();
$stripped = array();
}
}
}
- wfProfileOut( __METHOD__ );
return array( $words, $stripped );
}
* @return string[]
*/
public function orig() {
- wfProfileIn( __METHOD__ );
$orig = new HWLDFWordAccumulator;
foreach ( $this->edits as $edit ) {
}
}
$lines = $orig->getLines();
- wfProfileOut( __METHOD__ );
return $lines;
}
* @return string[]
*/
public function closing() {
- wfProfileIn( __METHOD__ );
$closing = new HWLDFWordAccumulator;
foreach ( $this->edits as $edit ) {
}
}
$lines = $closing->getLines();
- wfProfileOut( __METHOD__ );
return $lines;
}
* @return string The formatted output.
*/
public function format( $diff ) {
- wfProfileIn( __METHOD__ );
$xi = $yi = 1;
$block = false;
}
$end = $this->endDiff();
- wfProfileOut( __METHOD__ );
return $end;
}
* @throws MWException If the edit type is not known.
*/
protected function block( $xbeg, $xlen, $ybeg, $ylen, &$edits ) {
- wfProfileIn( __METHOD__ );
$this->startBlock( $this->blockHeader( $xbeg, $xlen, $ybeg, $ylen ) );
foreach ( $edits as $edit ) {
if ( $edit->type == 'copy' ) {
}
}
$this->endBlock();
- wfProfileOut( __METHOD__ );
}
protected function startDiff() {
}
public function showDiffPage( $diffOnly = false ) {
- wfProfileIn( __METHOD__ );
# Allow frames except in certain special cases
$out = $this->getOutput();
if ( !$this->loadRevisionData() ) {
$this->showMissingRevision();
- wfProfileOut( __METHOD__ );
return;
}
$this->mOldPage->getUserPermissionsErrors( 'read', $user ) );
}
if ( count( $permErrors ) ) {
- wfProfileOut( __METHOD__ );
throw new PermissionsError( 'read', $permErrors );
}
$this->renderNewRevision();
}
}
- wfProfileOut( __METHOD__ );
}
/**
* Show the new revision of the page.
*/
public function renderNewRevision() {
- wfProfileIn( __METHOD__ );
$out = $this->getOutput();
$revHeader = $this->getRevisionHeader( $this->mNewRev );
# Add "current version as of X" title
# Add redundant patrol link on bottom...
$out->addHTML( $this->markPatrolledLink() );
- wfProfileOut( __METHOD__ );
}
protected function getParserOutput( WikiPage $page, Revision $rev ) {
*/
public function getDiffBody() {
global $wgMemc;
- wfProfileIn( __METHOD__ );
$this->mCacheHit = true;
// Check if the diff should be hidden from this user
if ( !$this->loadRevisionData() ) {
- wfProfileOut( __METHOD__ );
return false;
} elseif ( $this->mOldRev &&
!$this->mOldRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
- wfProfileOut( __METHOD__ );
return false;
} elseif ( $this->mNewRev &&
!$this->mNewRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
- wfProfileOut( __METHOD__ );
return false;
}
if ( $this->mOldRev === false || ( $this->mOldRev && $this->mNewRev
&& $this->mOldRev->getID() == $this->mNewRev->getID() )
) {
- wfProfileOut( __METHOD__ );
return '';
}
wfIncrStats( 'diff_cache_hit' );
$difftext = $this->localiseLineNumbers( $difftext );
$difftext .= "\n<!-- diff cache key $key -->\n";
- wfProfileOut( __METHOD__ );
return $difftext;
}
// Loadtext is permission safe, this just clears out the diff
if ( !$this->loadText() ) {
- wfProfileOut( __METHOD__ );
return false;
}
if ( $difftext !== false ) {
$difftext = $this->localiseLineNumbers( $difftext );
}
- wfProfileOut( __METHOD__ );
return $difftext;
}
public function generateTextDiffBody( $otext, $ntext ) {
global $wgExternalDiffEngine, $wgContLang;
- wfProfileIn( __METHOD__ );
-
$otext = str_replace( "\r\n", "\n", $otext );
$ntext = str_replace( "\r\n", "\n", $ntext );
# input text to be HTML-escaped already
$otext = htmlspecialchars( $wgContLang->segmentForDiff( $otext ) );
$ntext = htmlspecialchars( $wgContLang->segmentForDiff( $ntext ) );
- wfProfileOut( __METHOD__ );
return $wgContLang->unsegmentForDiff( wikidiff_do_diff( $otext, $ntext, 2 ) ) .
$this->debug( 'wikidiff1' );
$text = wikidiff2_do_diff( $otext, $ntext, 2 );
$text .= $this->debug( 'wikidiff2' );
wfProfileOut( 'wikidiff2_do_diff' );
- wfProfileOut( __METHOD__ );
return $text;
}
$tempFile1 = fopen( $tempName1, "w" );
if ( !$tempFile1 ) {
- wfProfileOut( __METHOD__ );
return false;
}
$tempFile2 = fopen( $tempName2, "w" );
if ( !$tempFile2 ) {
- wfProfileOut( __METHOD__ );
return false;
}
wfProfileOut( __METHOD__ . "-shellexec" );
unlink( $tempName1 );
unlink( $tempName2 );
- wfProfileOut( __METHOD__ );
return $difftext;
}
$nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
$diffs = new Diff( $ota, $nta );
$formatter = new TableDiffFormatter();
- $difftext = $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) ) .
- wfProfileOut( __METHOD__ );
+ $difftext = $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) );
return $difftext;
}
* @param string[] $closing
*/
protected function changed( $orig, $closing ) {
- wfProfileIn( __METHOD__ );
$diff = new WordLevelDiff( $orig, $closing );
$del = $diff->orig();
echo '<tr>' . $this->emptyLine() .
$this->addedLine( $line ) . "</tr>\n";
}
- wfProfileOut( __METHOD__ );
}
}
* @return array
*/
public function getProps( $ext = true ) {
- wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . ": Getting file info for $this->path\n" );
$info = self::placeholderProps();
wfDebug( __METHOD__ . ": $this->path NOT FOUND!\n" );
}
- wfProfileOut( __METHOD__ );
return $info;
}
* @return bool|string False on failure
*/
public function getSha1Base36( $recache = false ) {
- wfProfileIn( __METHOD__ );
if ( $this->sha1Base36 !== null && !$recache ) {
- wfProfileOut( __METHOD__ );
return $this->sha1Base36;
}
$this->sha1Base36 = wfBaseConvert( $this->sha1Base36, 16, 36, 31 );
}
- wfProfileOut( __METHOD__ );
return $this->sha1Base36;
}
* @return Status
*/
public static function attempt( array $performOps, array $opts, FileJournal $journal ) {
- $section = new ProfileSection( __METHOD__ );
$status = Status::newGood();
$n = count( $performOps );
* @return TempFSFile|null
*/
public static function factory( $prefix, $extension = '' ) {
- wfProfileIn( __METHOD__ );
$base = wfTempDir() . '/' . $prefix . wfRandomString( 12 );
$ext = ( $extension != '' ) ? ".{$extension}" : "";
for ( $attempt = 1; true; $attempt++ ) {
break; // got it
}
if ( $attempt >= 5 ) {
- wfProfileOut( __METHOD__ );
return null; // give up
}
}
$tmpFile = new self( $path );
$tmpFile->autocollect(); // safely instantiated
- wfProfileOut( __METHOD__ );
return $tmpFile;
}
* @since 1.22
*/
final public function lockByType( array $pathsByType, $timeout = 0 ) {
- wfProfileIn( __METHOD__ );
$status = Status::newGood();
$pathsByType = $this->normalizePathsByType( $pathsByType );
$msleep = array( 0, 50, 100, 300, 500 ); // retry backoff times
usleep( 1e3 * ( next( $msleep ) ?: 1000 ) ); // use 1 sec after enough times
$elapsed = microtime( true ) - $start;
} while ( $elapsed < $timeout && $elapsed >= 0 );
- wfProfileOut( __METHOD__ );
return $status;
}
* @since 1.22
*/
final public function unlockByType( array $pathsByType ) {
- wfProfileIn( __METHOD__ );
$pathsByType = $this->normalizePathsByType( $pathsByType );
$status = $this->doUnlockByType( $pathsByType );
- wfProfileOut( __METHOD__ );
return $status;
}
function transform( $params, $flags = 0 ) {
global $wgThumbnailEpoch;
- wfProfileIn( __METHOD__ );
do {
if ( !$this->canRender() ) {
$thumb = $this->iconThumb();
}
} while ( false );
- wfProfileOut( __METHOD__ );
return is_object( $thumb ) ? $thumb : false;
}
function loadFromCache() {
global $wgMemc;
- wfProfileIn( __METHOD__ );
$this->dataLoaded = false;
$this->extraDataLoaded = false;
$key = $this->getCacheKey();
if ( !$key ) {
- wfProfileOut( __METHOD__ );
return false;
}
wfIncrStats( 'image_cache_miss' );
}
- wfProfileOut( __METHOD__ );
return $this->dataLoaded;
}
* @param int $flags
*/
function loadFromDB( $flags = 0 ) {
- # Polymorphic function name to distinguish foreign and local fetches
$fname = get_class( $this ) . '::' . __FUNCTION__;
- wfProfileIn( $fname );
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->dataLoaded = true;
} else {
$this->fileExists = false;
}
-
- wfProfileOut( $fname );
}
/**
* This covers fields that are sometimes not cached.
*/
protected function loadExtraFromDB() {
- # Polymorphic function name to distinguish foreign and local fetches
$fname = get_class( $this ) . '::' . __FUNCTION__;
- wfProfileIn( $fname );
# Unconditionally set loaded=true, we don't want the accessors constantly rechecking
$this->extraDataLoaded = true;
$this->$name = $value;
}
} else {
- wfProfileOut( $fname );
throw new MWException( "Could not find data for image '{$this->getName()}'." );
}
-
- wfProfileOut( $fname );
}
/**
* Fix assorted version-related problems with the image row by reloading it from the file
*/
function upgradeRow() {
- wfProfileIn( __METHOD__ );
$this->lock(); // begin
if ( !$this->fileExists ) {
$this->unlock();
wfDebug( __METHOD__ . ": file does not exist, aborting\n" );
- wfProfileOut( __METHOD__ );
return;
}
if ( wfReadOnly() ) {
$this->unlock();
- wfProfileOut( __METHOD__ );
return;
}
$this->unlock(); // done
- wfProfileOut( __METHOD__ );
}
/**
* @note This used to purge old thumbnails by default as well, but doesn't anymore.
*/
function purgeCache( $options = array() ) {
- wfProfileIn( __METHOD__ );
// Refresh metadata cache
$this->purgeMetadataCache();
// Purge squid cache for this file
SquidUpdate::purge( array( $this->getURL() ) );
- wfProfileOut( __METHOD__ );
}
/**
*/
function purgeOldThumbnails( $archiveName ) {
global $wgUseSquid;
- wfProfileIn( __METHOD__ );
// Get a list of old thumbnails and URLs
$files = $this->getThumbnails( $archiveName );
SquidUpdate::purge( $urls );
}
- wfProfileOut( __METHOD__ );
}
/**
*/
function purgeThumbnails( $options = array() ) {
global $wgUseSquid;
- wfProfileIn( __METHOD__ );
// Delete thumbnails
$files = $this->getThumbnails();
SquidUpdate::purge( $urls );
}
- wfProfileOut( __METHOD__ );
}
/**
function recordUpload2( $oldver, $comment, $pageText, $props = false, $timestamp = false,
$user = null
) {
- wfProfileIn( __METHOD__ );
if ( is_null( $user ) ) {
global $wgUser;
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": File " . $this->getRel() . " went missing!\n" );
$dbw->rollback( __METHOD__ );
- wfProfileOut( __METHOD__ );
return false;
}
LinksUpdate::queueRecursiveJobsForTable( $this->getTitle(), 'imagelinks' );
}
- wfProfileOut( __METHOD__ );
return true;
}
* @return FileRepoStatus
*/
function execute() {
- wfProfileIn( __METHOD__ );
$this->file->lock();
// Roll back inserts, release lock and abort
// TODO: delete the defunct filearchive rows if we are using a non-transactional DB
$this->file->unlockAndRollback();
- wfProfileOut( __METHOD__ );
return $this->status;
}
// Commit and return
$this->file->unlock();
- wfProfileOut( __METHOD__ );
return $this->status;
}
}
function loadFromDB( $flags = 0 ) {
- wfProfileIn( __METHOD__ );
$this->dataLoaded = true;
$this->fileExists = false;
}
- wfProfileOut( __METHOD__ );
}
/**
* Load lazy file metadata from the DB
*/
protected function loadExtraFromDB() {
- wfProfileIn( __METHOD__ );
$this->extraDataLoaded = true;
$dbr = $this->repo->getSlaveDB();
$this->$name = $value;
}
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( "Could not find data for image '{$this->archive_name}'." );
}
- wfProfileOut( __METHOD__ );
}
/**
}
function upgradeRow() {
- wfProfileIn( __METHOD__ );
$this->loadFromFile();
# Don't destroy file info of missing files
if ( !$this->fileExists ) {
wfDebug( __METHOD__ . ": file does not exist, aborting\n" );
- wfProfileOut( __METHOD__ );
return;
}
'oi_archive_name' => $this->archive_name ),
__METHOD__
);
- wfProfileOut( __METHOD__ );
}
/**
* @throws JobQueueError
*/
final public function isEmpty() {
- wfProfileIn( __METHOD__ );
$res = $this->doIsEmpty();
- wfProfileOut( __METHOD__ );
return $res;
}
* @throws JobQueueError
*/
final public function getSize() {
- wfProfileIn( __METHOD__ );
$res = $this->doGetSize();
- wfProfileOut( __METHOD__ );
return $res;
}
* @throws JobQueueError
*/
final public function getAcquiredCount() {
- wfProfileIn( __METHOD__ );
$res = $this->doGetAcquiredCount();
- wfProfileOut( __METHOD__ );
return $res;
}
* @since 1.22
*/
final public function getDelayedCount() {
- wfProfileIn( __METHOD__ );
$res = $this->doGetDelayedCount();
- wfProfileOut( __METHOD__ );
return $res;
}
* @throws JobQueueError
*/
final public function getAbandonedCount() {
- wfProfileIn( __METHOD__ );
$res = $this->doGetAbandonedCount();
- wfProfileOut( __METHOD__ );
return $res;
}
}
}
- wfProfileIn( __METHOD__ );
$this->doBatchPush( $jobs, $flags );
- wfProfileOut( __METHOD__ );
}
/**
throw new MWException( "Unrecognized job type '{$this->type}'." );
}
- wfProfileIn( __METHOD__ );
$job = $this->doPop();
- wfProfileOut( __METHOD__ );
// Flag this job as an old duplicate based on its "root" job...
try {
if ( $job->getType() !== $this->type ) {
throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
}
- wfProfileIn( __METHOD__ );
$this->doAck( $job );
- wfProfileOut( __METHOD__ );
}
/**
if ( $job->getType() !== $this->type ) {
throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
}
- wfProfileIn( __METHOD__ );
$ok = $this->doDeduplicateRootJob( $job );
- wfProfileOut( __METHOD__ );
return $ok;
}
if ( $job->getType() !== $this->type ) {
throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
}
- wfProfileIn( __METHOD__ );
$isDuplicate = $this->doIsRootJobOldDuplicate( $job );
- wfProfileOut( __METHOD__ );
return $isDuplicate;
}
* @return void
*/
final public function delete() {
- wfProfileIn( __METHOD__ );
$this->doDelete();
- wfProfileOut( __METHOD__ );
}
/**
* @throws JobQueueError
*/
final public function waitForBackups() {
- wfProfileIn( __METHOD__ );
$this->doWaitForBackups();
- wfProfileOut( __METHOD__ );
}
/**
* @return void
*/
final public function flushCaches() {
- wfProfileIn( __METHOD__ );
$this->doFlushCaches();
- wfProfileOut( __METHOD__ );
}
/**
* @since 1.22
*/
final public function getSiblingQueuesWithJobs( array $types ) {
- $section = new ProfileSection( __METHOD__ );
return $this->doGetSiblingQueuesWithJobs( $types );
}
* @since 1.22
*/
final public function getSiblingQueueSizes( array $types ) {
- $section = new ProfileSection( __METHOD__ );
return $this->doGetSiblingQueueSizes( $types );
}
public function waitForBackups() {
global $wgJobTypeConf;
- wfProfileIn( __METHOD__ );
// Try to avoid doing this more than once per queue storage medium
foreach ( $wgJobTypeConf as $type => $conf ) {
$this->get( $type )->waitForBackups();
}
- wfProfileOut( __METHOD__ );
}
/**
* @return array Map of (job type => backoff expiry timestamp)
*/
private function loadBackoffs( array $backoffs, $mode = 'wait' ) {
- $section = new ProfileSection( __METHOD__ );
$file = wfTempDir() . '/mw-runJobs-backoffs.json';
if ( is_file( $file ) ) {
* @return array The new backoffs account for $backoffs and the latest file data
*/
private function syncBackoffDeltas( array $backoffs, array &$deltas, $mode = 'wait' ) {
- $section = new ProfileSection( __METHOD__ );
if ( !$deltas ) {
return $this->loadBackoffs( $backoffs, $mode );
* @return bool Success
*/
final public function notifyQueueEmpty( $wiki, $type ) {
- wfProfileIn( __METHOD__ );
$ok = $this->doNotifyQueueEmpty( $wiki, $type );
- wfProfileOut( __METHOD__ );
return $ok;
}
* @return bool Success
*/
final public function notifyQueueNonEmpty( $wiki, $type ) {
- wfProfileIn( __METHOD__ );
$ok = $this->doNotifyQueueNonEmpty( $wiki, $type );
- wfProfileOut( __METHOD__ );
return $ok;
}
* @return array (job type => (list of wiki IDs))
*/
final public function getAllReadyWikiQueues() {
- wfProfileIn( __METHOD__ );
$res = $this->doGetAllReadyWikiQueues();
- wfProfileOut( __METHOD__ );
return $res;
}
* @return bool Success
*/
final public function purge() {
- wfProfileIn( __METHOD__ );
$res = $this->doPurge();
- wfProfileOut( __METHOD__ );
return $res;
}
}
public function getStartBody() {
- wfProfileIn( __METHOD__ );
# Do a link batch query
if ( $this->getNumRows() > 0 ) {
$lb = new LinkBatch;
$lb->execute();
$this->mResult->seek( 0 );
}
- wfProfileOut( __METHOD__ );
return '';
}
global $wgEnotifWatchlist;
global $wgEnotifMinorEdits, $wgEnotifUserTalk;
- wfProfileIn( __METHOD__ );
# The following code is only run, if several conditions are met:
# 1. EmailNotification for pages (other than user_talk pages) must be enabled
Hooks::run( 'UpdateUserMailerFormattedPageStatus', array( &$formattedPageStatus ) );
if ( !in_array( $this->pageStatus, $formattedPageStatus ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( 'Not a valid page status!' );
}
}
$this->sendMails();
- wfProfileOut( __METHOD__ );
}
/**
return false;
}
- wfProfileIn( __METHOD__ );
wfSuppressWarnings();
try {
wfDebug( "Bogus multipage XML metadata on '{$image->getName()}'\n" );
}
wfRestoreWarnings();
- wfProfileOut( __METHOD__ );
if ( $gettext ) {
return $image->djvuTextTree;
} else {
*/
function retrieveMetaData() {
global $wgDjvuToXML, $wgDjvuDump, $wgDjvuTxt;
- wfProfileIn( __METHOD__ );
if ( !$this->isValid() ) {
return false;
$xml = $xml . $txt . '</mw-djvu>';
}
}
- wfProfileOut( __METHOD__ );
return $xml;
}
public function fetchExtendedMetadata( File $file ) {
global $wgMemc;
- wfProfileIn( __METHOD__ );
// If revision deleted, exit immediately
if ( $file->isDeleted( File::DELETED_FILE ) ) {
- wfProfileOut( __METHOD__ );
return array();
}
$wgMemc->set( $cacheKey, $valueToCache, $maxCacheTime );
}
- wfProfileOut( __METHOD__ );
return $extendedMetadata;
}
return $file->getExtendedMetadata() ?: array();
}
- wfProfileIn( __METHOD__ );
$uploadDate = wfTimestamp( TS_ISO_8601, $file->getTimestamp() );
}
}
- wfProfileOut( __METHOD__ );
return $fileMetadata;
}
protected function getExtendedMetadataFromHook( File $file, array $extendedMetadata,
&$maxCacheTime
) {
- wfProfileIn( __METHOD__ );
Hooks::run( 'GetExtendedMetadata', array(
&$extendedMetadata,
}
}
- wfProfileOut( __METHOD__ );
return $extendedMetadata;
}
* @return mixed
*/
public function get( $key, &$casToken = null ) {
- wfProfileIn( __METHOD__ );
if ( $this->_debug ) {
$this->_debugprint( "get($key)\n" );
if ( !is_array( $key ) && strval( $key ) === '' ) {
$this->_debugprint( "Skipping key which equals to an empty string" );
- wfProfileOut( __METHOD__ );
return false;
}
if ( !$this->_active ) {
- wfProfileOut( __METHOD__ );
return false;
}
$sock = $this->get_sock( $key );
if ( !is_resource( $sock ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
$cmd = "gets $key\r\n";
if ( !$this->_fwrite( $sock, $cmd ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
if ( isset( $val[$key] ) ) {
$value = $val[$key];
}
- wfProfileOut( __METHOD__ );
return $value;
}
* @return mixed
*/
public function get( $key, &$casToken = null ) {
- wfProfileIn( __METHOD__ );
$this->debugLog( "get($key)" );
$result = $this->client->get( $this->encodeKey( $key ), null, $casToken );
$result = $this->checkResult( $key, $result );
- wfProfileOut( __METHOD__ );
return $result;
}
* @return array
*/
public function getMulti( array $keys ) {
- wfProfileIn( __METHOD__ );
$this->debugLog( 'getMulti(' . implode( ', ', $keys ) . ')' );
$callback = array( $this, 'encodeKey' );
$result = $this->client->getMulti( array_map( $callback, $keys ) );
- wfProfileOut( __METHOD__ );
$result = $result ?: array(); // must be an array
return $this->checkResult( false, $result );
}
* @return bool
*/
public function setMulti( array $data, $exptime = 0 ) {
- wfProfileIn( __METHOD__ );
foreach ( $data as $key => $value ) {
$encKey = $this->encodeKey( $key );
if ( $encKey !== $key ) {
}
$this->debugLog( 'setMulti(' . implode( ', ', array_keys( $data ) ) . ')' );
$result = $this->client->setMulti( $data, $this->fixExpiry( $exptime ) );
- wfProfileOut( __METHOD__ );
return $this->checkResult( false, $result );
}
}
}
public function get( $key, &$casToken = null ) {
- $section = new ProfileSection( __METHOD__ );
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
}
public function set( $key, $value, $expiry = 0 ) {
- $section = new ProfileSection( __METHOD__ );
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
}
public function cas( $casToken, $key, $value, $expiry = 0 ) {
- $section = new ProfileSection( __METHOD__ );
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
}
public function delete( $key, $time = 0 ) {
- $section = new ProfileSection( __METHOD__ );
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
}
public function getMulti( array $keys ) {
- $section = new ProfileSection( __METHOD__ );
$batches = array();
$conns = array();
* @return bool
*/
public function setMulti( array $data, $expiry = 0 ) {
- $section = new ProfileSection( __METHOD__ );
$batches = array();
$conns = array();
public function add( $key, $value, $expiry = 0 ) {
- $section = new ProfileSection( __METHOD__ );
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
* @return int|bool New value or false on failure
*/
public function incr( $key, $value = 1 ) {
- $section = new ProfileSection( __METHOD__ );
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
* @since 1.21
*/
protected function getContentObject() {
- wfProfileIn( __METHOD__ );
if ( $this->mPage->getID() === 0 ) {
# If this is a MediaWiki:x message, then load the messages
$content = $this->mContentObject;
}
- wfProfileOut( __METHOD__ );
return $content;
}
return $this->mContent;
}
- wfProfileIn( __METHOD__ );
$content = $this->fetchContentObject();
if ( !$content ) {
- wfProfileOut( __METHOD__ );
return false;
}
$this->mContent = ContentHandler::getContentText( $content );
ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) );
- wfProfileOut( __METHOD__ );
return $this->mContent;
}
return $this->mContentObject;
}
- wfProfileIn( __METHOD__ );
$this->mContentLoaded = true;
$this->mContent = null;
$this->mRevision = Revision::newFromId( $oldid );
if ( !$this->mRevision ) {
wfDebug( __METHOD__ . " failed to retrieve specified revision, id $oldid\n" );
- wfProfileOut( __METHOD__ );
return false;
}
}
if ( !$this->mPage->getLatest() ) {
wfDebug( __METHOD__ . " failed to find page data for title " .
$this->getTitle()->getPrefixedText() . "\n" );
- wfProfileOut( __METHOD__ );
return false;
}
if ( !$this->mRevision ) {
wfDebug( __METHOD__ . " failed to retrieve current page, rev_id " .
$this->mPage->getLatest() . "\n" );
- wfProfileOut( __METHOD__ );
return false;
}
}
Hooks::run( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) );
- wfProfileOut( __METHOD__ );
return $this->mContentObject;
}
public function view() {
global $wgUseFileCache, $wgUseETag, $wgDebugToolbar, $wgMaxRedirects;
- wfProfileIn( __METHOD__ );
# Get variables from query string
# As side effect this will load the revision and update the title
$permErrors = $this->getTitle()->getUserPermissionsErrors( 'read', $user );
if ( count( $permErrors ) ) {
wfDebug( __METHOD__ . ": denied on secondary read check\n" );
- wfProfileOut( __METHOD__ );
throw new PermissionsError( 'read', $permErrors );
}
if ( $this->mRedirectUrl ) {
$outputPage->redirect( $this->mRedirectUrl );
wfDebug( __METHOD__ . ": redirecting due to oldid\n" );
- wfProfileOut( __METHOD__ );
return;
}
if ( $this->getContext()->getRequest()->getCheck( 'diff' ) ) {
wfDebug( __METHOD__ . ": showing diff page\n" );
$this->showDiffPage();
- wfProfileOut( __METHOD__ );
return;
}
# Is it client cached?
if ( $outputPage->checkLastModified( $timestamp ) ) {
wfDebug( __METHOD__ . ": done 304\n" );
- wfProfileOut( __METHOD__ );
return;
# Try file cache
# tell wgOut that output is taken care of
$outputPage->disable();
$this->mPage->doViewUpdates( $user, $oldid );
- wfProfileOut( __METHOD__ );
return;
}
wfDebug( __METHOD__ . ": showing missing article\n" );
$this->showMissingArticle();
$this->mPage->doViewUpdates( $user );
- wfProfileOut( __METHOD__ );
return;
}
if ( !$this->showDeletedRevisionHeader() ) {
wfDebug( __METHOD__ . ": cannot view deleted revision\n" );
- wfProfileOut( __METHOD__ );
return;
}
}
$outputPage->addWikiText( '<div class="errorbox">' . $errortext . '</div>' );
}
# Connection or timeout error
- wfProfileOut( __METHOD__ );
return;
}
$outputPage->addModules( 'mediawiki.action.view.postEdit' );
- wfProfileOut( __METHOD__ );
}
/**
return false;
}
- wfProfileIn( __METHOD__ );
// New page patrol: Get the timestamp of the oldest revison which
// the revision table holds for the given page. Then we look
// Check for cached results
if ( $cache->get( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ) ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
) {
// The current revision is already older than what could be in the RC table
// 6h tolerance because the RC might not be cleaned out regularly
- wfProfileOut( __METHOD__ );
return false;
}
// Don't cache in case we can patrol as this could change
$cache->set( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ), '1' );
- wfProfileOut( __METHOD__ );
return false;
}
if ( $rc->getPerformer()->getName() == $user->getName() ) {
// Don't show a patrol link for own creations. If the user could
// patrol them, they already would be patrolled
- wfProfileOut( __METHOD__ );
return false;
}
'</div>'
);
- wfProfileOut( __METHOD__ );
return true;
}
* @return Revision|null
*/
public function getOldestRevision() {
- wfProfileIn( __METHOD__ );
// Try using the slave database first, then try the master
$continue = 2;
}
}
- wfProfileOut( __METHOD__ );
return $row ? Revision::newFromRow( $row ) : null;
}
* @return array Array of authors, duplicates not removed
*/
public function getLastNAuthors( $num, $revLatest = 0 ) {
- wfProfileIn( __METHOD__ );
// First try the slave
// If that doesn't have the latest revision, try the master
$continue = 2;
);
if ( !$res ) {
- wfProfileOut( __METHOD__ );
return array();
}
$authors[] = $row->rev_user_text;
}
- wfProfileOut( __METHOD__ );
return $authors;
}
* @return ParserOutput|bool ParserOutput or false if the revision was not found
*/
public function getParserOutput( ParserOptions $parserOptions, $oldid = null ) {
- wfProfileIn( __METHOD__ );
$useParserCache = $this->isParserCacheUsed( $parserOptions, $oldid );
wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
if ( $useParserCache ) {
$parserOutput = ParserCache::singleton()->get( $this, $parserOptions );
if ( $parserOutput !== false ) {
- wfProfileOut( __METHOD__ );
return $parserOutput;
}
}
$pool = new PoolWorkArticleView( $this, $parserOptions, $oldid, $useParserCache );
$pool->execute();
- wfProfileOut( __METHOD__ );
return $pool->getParserOutput();
}
* @return int The newly created page_id key, or false if the title already existed
*/
public function insertOn( $dbw ) {
- wfProfileIn( __METHOD__ );
$page_id = $dbw->nextSequenceValue( 'page_page_id_seq' );
$dbw->insert( 'page', array(
$this->mId = $newid;
$this->mTitle->resetArticleID( $newid );
}
- wfProfileOut( __METHOD__ );
return $affected ? $newid : false;
}
) {
global $wgContentHandlerUseDB;
- wfProfileIn( __METHOD__ );
$content = $revision->getContent();
$len = $content ? $content->getSize() : 0;
$this->mLatest, $revision->getContentModel() );
}
- wfProfileOut( __METHOD__ );
return $result;
}
return true;
}
- wfProfileIn( __METHOD__ );
if ( $isRedirect ) {
$this->insertRedirectEntry( $redirectTitle );
} else {
if ( $this->getTitle()->getNamespace() == NS_FILE ) {
RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() );
}
- wfProfileOut( __METHOD__ );
return ( $dbw->affectedRows() != 0 );
}
* @return bool
*/
public function updateIfNewerOn( $dbw, $revision ) {
- wfProfileIn( __METHOD__ );
$row = $dbw->selectRow(
array( 'revision', 'page' ),
if ( $row ) {
if ( wfTimestamp( TS_MW, $row->rev_timestamp ) >= $revision->getTimestamp() ) {
- wfProfileOut( __METHOD__ );
return false;
}
$prev = $row->rev_id;
$ret = $this->updateRevisionOn( $dbw, $revision, $prev, $lastRevIsRedirect );
- wfProfileOut( __METHOD__ );
return $ret;
}
*/
public function replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle = '',
$edittime = null ) {
- wfProfileIn( __METHOD__ );
$baseRevId = null;
if ( $edittime && $sectionId !== 'new' ) {
}
}
- wfProfileOut( __METHOD__ );
return $this->replaceSectionAtRev( $sectionId, $sectionContent, $sectionTitle, $baseRevId );
}
public function replaceSectionAtRev( $sectionId, Content $sectionContent,
$sectionTitle = '', $baseRevId = null
) {
- wfProfileIn( __METHOD__ );
if ( strval( $sectionId ) === '' ) {
// Whole-page edit; let the whole text through
$newContent = $sectionContent;
} else {
if ( !$this->supportsSections() ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "sections not supported for content model " .
$this->getContentHandler()->getModelID() );
}
if ( !$rev ) {
wfDebug( __METHOD__ . " asked for bogus section (page: " .
$this->getId() . "; section: $sectionId)\n" );
- wfProfileOut( __METHOD__ );
return null;
}
if ( !$oldContent ) {
wfDebug( __METHOD__ . ": no page text\n" );
- wfProfileOut( __METHOD__ );
return null;
}
$newContent = $oldContent->replaceSection( $sectionId, $sectionContent, $sectionTitle );
}
- wfProfileOut( __METHOD__ );
return $newContent;
}
throw new MWException( 'Something is trying to edit an article with an empty title' );
}
- wfProfileIn( __METHOD__ );
if ( !$content->getContentHandler()->canBeUsedOn( $this->getTitle() ) ) {
- wfProfileOut( __METHOD__ );
return Status::newFatal( 'content-not-allowed-here',
ContentHandler::getLocalizedName( $content->getModel() ),
$this->getTitle()->getPrefixedText() );
$status->fatal( 'edit-hook-aborted' );
}
- wfProfileOut( __METHOD__ );
return $status;
}
wfDebug( __METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n" );
$status->fatal( 'edit-gone-missing' );
- wfProfileOut( __METHOD__ );
return $status;
} elseif ( !$old_content ) {
// Sanity check for bug 37225
- wfProfileOut( __METHOD__ );
throw new MWException( "Could not find text for current revision {$oldid}." );
}
if ( !$status->isOK() ) {
$dbw->rollback( __METHOD__ );
- wfProfileOut( __METHOD__ );
return $status;
}
$revisionId = $revision->insertOn( $dbw );
$dbw->rollback( __METHOD__ );
- wfProfileOut( __METHOD__ );
return $status;
}
if ( !$status->isOK() ) {
$dbw->rollback( __METHOD__ );
- wfProfileOut( __METHOD__ );
return $status;
}
$dbw->rollback( __METHOD__ );
$status->fatal( 'edit-already-exists' );
- wfProfileOut( __METHOD__ );
return $status;
}
$user->addAutopromoteOnceGroups( 'onEdit' );
} );
- wfProfileOut( __METHOD__ );
return $status;
}
public function doEditUpdates( Revision $revision, User $user, array $options = array() ) {
global $wgEnableParserCache;
- wfProfileIn( __METHOD__ );
$options += array(
'changed' => true,
}
if ( !$this->exists() ) {
- wfProfileOut( __METHOD__ );
return;
}
self::onArticleEdit( $this->mTitle );
}
- wfProfileOut( __METHOD__ );
}
/**
public function doQuickEditContent( Content $content, User $user, $comment = '', $minor = false,
$serialFormat = null
) {
- wfProfileIn( __METHOD__ );
$serialized = $content->serialize( $serialFormat );
Hooks::run( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) );
- wfProfileOut( __METHOD__ );
}
/**
* @return string
*/
public static function gender( $parser, $username ) {
- wfProfileIn( __METHOD__ );
$forms = array_slice( func_get_args(), 2 );
// Some shortcuts to avoid loading user data unnecessarily
if ( count( $forms ) === 0 ) {
- wfProfileOut( __METHOD__ );
return '';
} elseif ( count( $forms ) === 1 ) {
- wfProfileOut( __METHOD__ );
return $forms[0];
}
$gender = GenderCache::singleton()->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
}
$ret = $parser->getFunctionLang()->gender( $gender, $forms );
- wfProfileOut( __METHOD__ );
return $ret;
}
* @return string
*/
public function makeHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
- wfProfileIn( __METHOD__ );
if ( !is_object( $nt ) ) {
# Fail gracefully
$retVal = "<!-- ERROR -->{$prefix}{$text}{$trail}";
}
$this->size++;
}
- wfProfileOut( __METHOD__ );
return $retVal;
}
* @param string $text
*/
public function replace( &$text ) {
- wfProfileIn( __METHOD__ );
$this->replaceInternal( $text );
$this->replaceInterwiki( $text );
- wfProfileOut( __METHOD__ );
}
return;
}
- wfProfileIn( __METHOD__ );
global $wgContLang, $wgContentHandlerUseDB;
$colours = array();
);
wfProfileOut( __METHOD__ . '-replace' );
- wfProfileOut( __METHOD__ );
}
/**
return;
}
- wfProfileIn( __METHOD__ );
# Make interwiki link HTML
$output = $this->parent->getOutput();
$replacePairs = array();
'/<!--IWLINK (.*?)-->/',
$replacer->cb(),
$text );
- wfProfileOut( __METHOD__ );
}
/**
* @return string
*/
public function replaceText( $text ) {
- wfProfileIn( __METHOD__ );
$text = preg_replace_callback(
'/<!--(LINK|IWLINK) (.*?)-->/',
array( &$this, 'replaceTextCallback' ),
$text );
- wfProfileOut( __METHOD__ );
return $text;
}
*/
private static function externalClean( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
- wfProfileIn( __METHOD__ );
$cleansource = '';
$opts = ' -utf8';
$cleansource = null;
}
- wfProfileOut( __METHOD__ );
return $cleansource;
}
*/
private static function phpClean( $text, $stderr = false, &$retval = null ) {
global $wgTidyConf, $wgDebugTidy;
- wfProfileIn( __METHOD__ );
if ( ( !wfIsHHVM() && !class_exists( 'tidy' ) ) ||
( wfIsHHVM() && !function_exists( 'tidy_repair_string' ) )
wfWarn( "Unable to load internal tidy class." );
$retval = -1;
- wfProfileOut( __METHOD__ );
return null;
}
if ( $stderr ) {
$retval = $tidy->getStatus();
-
- wfProfileOut( __METHOD__ );
return $tidy->errorBuffer;
}
}
}
- wfProfileOut( __METHOD__ );
return $cleansource;
}
*/
private static function hhvmClean( $text, &$retval ) {
global $wgTidyConf;
- wfProfileIn( __METHOD__ );
+
$cleansource = tidy_repair_string( $text, $wgTidyConf, 'utf8' );
if ( $cleansource === false ) {
$cleansource = null;
} else {
$retval = 0;
}
- wfProfileOut( __METHOD__ );
+
return $cleansource;
}
}
}
$this->mFirstCall = false;
- wfProfileIn( __METHOD__ );
CoreParserFunctions::register( $this );
CoreTagHooks::register( $this );
$this->initialiseVariables();
Hooks::run( 'ParserFirstCallInit', array( &$this ) );
- wfProfileOut( __METHOD__ );
}
/**
* @private
*/
public function clearState() {
- wfProfileIn( __METHOD__ );
if ( $this->mFirstCall ) {
$this->firstCallInit();
}
$this->mProfiler = new SectionProfiler();
Hooks::run( 'ParserClearState', array( &$this ) );
- wfProfileOut( __METHOD__ );
}
/**
global $wgShowHostnames;
$fname = __METHOD__ . '-' . wfGetCaller();
- wfProfileIn( __METHOD__ );
wfProfileIn( $fname );
if ( $clearState ) {
$this->mInputSize = false;
$this->currentRevisionCache = null;
wfProfileOut( $fname );
- wfProfileOut( __METHOD__ );
return $this->mOutput;
}
* @return string UNSAFE half-parsed HTML
*/
public function recursiveTagParse( $text, $frame = false ) {
- wfProfileIn( __METHOD__ );
Hooks::run( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) );
Hooks::run( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
$text = $this->internalParse( $text, false, $frame );
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string Fully parsed HTML
*/
public function recursiveTagParseFully( $text, $frame = false ) {
- wfProfileIn( __METHOD__ );
$text = $this->recursiveTagParse( $text, $frame );
$text = $this->internalParseHalfParsed( $text, false );
- wfProfileOut( __METHOD__ );
return $text;
}
public function preprocess( $text, Title $title = null,
ParserOptions $options, $revid = null, $frame = false
) {
- wfProfileIn( __METHOD__ );
$magicScopeVariable = $this->lock();
$this->startParse( $title, $options, self::OT_PREPROCESS, true );
if ( $revid !== null ) {
Hooks::run( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
$text = $this->replaceVariables( $text, $frame );
$text = $this->mStripState->unstripBoth( $text );
- wfProfileOut( __METHOD__ );
return $text;
}
* @since 1.19
*/
public function recursivePreprocess( $text, $frame = false ) {
- wfProfileIn( __METHOD__ );
$text = $this->replaceVariables( $text, $frame );
$text = $this->mStripState->unstripBoth( $text );
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string
*/
public function doTableStuff( $text ) {
- wfProfileIn( __METHOD__ );
$lines = StringUtils::explode( "\n", $text );
$out = '';
$out = '';
}
- wfProfileOut( __METHOD__ );
return $out;
}
* @return string
*/
public function internalParse( $text, $isMain = true, $frame = false ) {
- wfProfileIn( __METHOD__ );
$origText = $text;
# Hook to suspend the parser in this state
if ( !Hooks::run( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) {
- wfProfileOut( __METHOD__ );
return $text;
}
$text = $this->doMagicLinks( $text );
$text = $this->formatHeadings( $text, $origText, $isMain );
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string
*/
public function doMagicLinks( $text ) {
- wfProfileIn( __METHOD__ );
$prots = wfUrlProtocolsWithoutProtRel();
$urlChar = self::EXT_LINK_URL_CLASS;
$space = self::SPACE_NOT_NL; # non-newline space
[0-9Xx] # check digit
)\b
)!xu", array( &$this, 'magicLinkCallback' ), $text );
- wfProfileOut( __METHOD__ );
return $text;
}
* @private
*/
public function makeFreeExternalLink( $url ) {
- wfProfileIn( __METHOD__ );
$trail = '';
$pasteurized = self::normalizeLinkUrl( $url );
$this->mOutput->addExternalLink( $pasteurized );
}
- wfProfileOut( __METHOD__ );
return $text . $trail;
}
* @return string
*/
public function doHeadings( $text ) {
- wfProfileIn( __METHOD__ );
for ( $i = 6; $i >= 1; --$i ) {
$h = str_repeat( '=', $i );
$text = preg_replace( "/^$h(.+)$h\\s*$/m", "<h$i>\\1</h$i>", $text );
}
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string The altered text
*/
public function doAllQuotes( $text ) {
- wfProfileIn( __METHOD__ );
$outtext = '';
$lines = StringUtils::explode( "\n", $text );
foreach ( $lines as $line ) {
$outtext .= $this->doQuotes( $line ) . "\n";
}
$outtext = substr( $outtext, 0, -1 );
- wfProfileOut( __METHOD__ );
return $outtext;
}
* @return string
*/
public function replaceExternalLinks( $text ) {
- wfProfileIn( __METHOD__ );
$bits = preg_split( $this->mExtLinkBracketedRegex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
if ( $bits === false ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "PCRE needs to be compiled with "
. "--enable-unicode-properties in order for MediaWiki to function" );
}
$this->mOutput->addExternalLink( $pasteurized );
}
- wfProfileOut( __METHOD__ );
return $s;
}
*/
public function replaceInternalLinks2( &$s ) {
global $wgExtraInterlanguageLinkPrefixes;
- wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ . '-setup' );
static $tc = false, $e1, $e1_img;
if ( is_null( $this->mTitle ) ) {
wfProfileOut( __METHOD__ . '-setup' );
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
}
$nottalk = !$this->mTitle->isTalkPage();
}
wfProfileOut( __METHOD__ . "-always_known" );
}
- wfProfileOut( __METHOD__ );
return $holders;
}
* @return string The lists rendered as HTML
*/
public function doBlockLevels( $text, $linestart ) {
- wfProfileIn( __METHOD__ );
# Parsing through the text line by line. The main thing
# happening here is handling of block-level elements p, pre,
$this->mLastSection = '';
}
- wfProfileOut( __METHOD__ );
return $output;
}
* @return string The position of the ':', or false if none found
*/
public function findColonNoLinks( $str, &$before, &$after ) {
- wfProfileIn( __METHOD__ );
$pos = strpos( $str, ':' );
if ( $pos === false ) {
# Nothing to find!
- wfProfileOut( __METHOD__ );
return false;
}
# Easy; no tag nesting to worry about
$before = substr( $str, 0, $pos );
$after = substr( $str, $pos + 1 );
- wfProfileOut( __METHOD__ );
return $pos;
}
# We found it!
$before = substr( $str, 0, $i );
$after = substr( $str, $i + 1 );
- wfProfileOut( __METHOD__ );
return $i;
}
# Embedded in a tag; don't break it.
$colon = strpos( $str, ':', $i );
if ( $colon === false ) {
# Nothing else interesting
- wfProfileOut( __METHOD__ );
return false;
}
$lt = strpos( $str, '<', $i );
# We found it!
$before = substr( $str, 0, $colon );
$after = substr( $str, $colon + 1 );
- wfProfileOut( __METHOD__ );
return $i;
}
}
$stack--;
if ( $stack < 0 ) {
wfDebug( __METHOD__ . ": Invalid input; too many close tags\n" );
- wfProfileOut( __METHOD__ );
return false;
}
$state = self::COLON_STATE_TEXT;
}
break;
default:
- wfProfileOut( __METHOD__ );
throw new MWException( "State machine error in " . __METHOD__ );
}
}
if ( $stack > 0 ) {
wfDebug( __METHOD__ . ": Invalid input; not enough close tags (stack $stack, state $state)\n" );
- wfProfileOut( __METHOD__ );
return false;
}
- wfProfileOut( __METHOD__ );
return false;
}
* @private
*/
public function initialiseVariables() {
- wfProfileIn( __METHOD__ );
$variableIDs = MagicWord::getVariableIDs();
$substIDs = MagicWord::getSubstIDs();
$this->mVariables = new MagicWordArray( $variableIDs );
$this->mSubstWords = new MagicWordArray( $substIDs );
- wfProfileOut( __METHOD__ );
}
/**
if ( strlen( $text ) < 1 || strlen( $text ) > $this->mOptions->getMaxIncludeSize() ) {
return $text;
}
- wfProfileIn( __METHOD__ );
if ( $frame === false ) {
$frame = $this->getPreprocessor()->newFrame();
$flags = $argsOnly ? PPFrame::NO_TEMPLATES : 0;
$text = $frame->expand( $dom, $flags );
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string The text of the template
*/
public function braceSubstitution( $piece, $frame ) {
- wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ . '-setup' );
// Flags
$result = $this->callParserFunction( $frame, $func, $funcArgs );
} catch ( Exception $ex ) {
wfProfileOut( __METHOD__ . '-pfunc' );
- wfProfileOut( __METHOD__ );
throw $ex;
}
if ( $profileSection ) {
$this->mProfiler->scopedProfileOut( $profileSection );
}
- wfProfileOut( __METHOD__ );
return array( 'object' => $text );
}
$ret = array( 'text' => $text );
}
- wfProfileOut( __METHOD__ );
return $ret;
}
public function callParserFunction( $frame, $function, array $args = array() ) {
global $wgContLang;
- wfProfileIn( __METHOD__ );
# Case sensitive functions
if ( isset( $this->mFunctionSynonyms[1][$function] ) ) {
if ( isset( $this->mFunctionSynonyms[0][$function] ) ) {
$function = $this->mFunctionSynonyms[0][$function];
} else {
- wfProfileOut( __METHOD__ );
return array( 'found' => false );
}
}
# Workaround for PHP bug 35229 and similar
if ( !is_callable( $callback ) ) {
wfProfileOut( __METHOD__ . '-pfunc-' . $function );
- wfProfileOut( __METHOD__ );
throw new MWException( "Tag hook for $function is not callable\n" );
}
$result['isChildObj'] = true;
}
wfProfileOut( __METHOD__ . '-pfunc-' . $function );
- wfProfileOut( __METHOD__ );
return $result;
}
* @return array
*/
public function argSubstitution( $piece, $frame ) {
- wfProfileIn( __METHOD__ );
$error = false;
$parts = $piece['parts'];
$ret = array( 'text' => $text );
}
- wfProfileOut( __METHOD__ );
return $ret;
}
* @return string
*/
public function doDoubleUnderscore( $text ) {
- wfProfileIn( __METHOD__ );
# The position of __TOC__ needs to be recorded
$mw = MagicWord::get( 'toc' );
$this->mOutput->setProperty( $key, '' );
}
- wfProfileOut( __METHOD__ );
return $text;
}
}
$executing = true;
- wfProfileIn( __METHOD__ );
if ( !$title ) {
global $wgTitle;
$title = $wgTitle;
$text = $this->preprocess( $text, $title, $options );
$executing = false;
- wfProfileOut( __METHOD__ );
return $text;
}
* @return string HTML
*/
public function renderImageGallery( $text, $params ) {
- wfProfileIn( __METHOD__ );
$mode = false;
if ( isset( $params['mode'] ) ) {
}
$html = $ig->toHTML();
Hooks::run( 'AfterParserFetchFileAndTitle', array( $this, $ig, &$html ) );
- wfProfileOut( __METHOD__ );
return $html;
}
*/
public function getRevisionTimestamp() {
if ( is_null( $this->mRevisionTimestamp ) ) {
- wfProfileIn( __METHOD__ );
global $wgContLang;
# it needs to be consistent for all visitors.
$this->mRevisionTimestamp = $wgContLang->userAdjust( $timestamp, '' );
- wfProfileOut( __METHOD__ );
}
return $this->mRevisionTimestamp;
}
* @return array
*/
public function serializeHalfParsedText( $text ) {
- wfProfileIn( __METHOD__ );
$data = array(
'text' => $text,
'version' => self::HALF_PARSED_VERSION,
'stripState' => $this->mStripState->getSubState( $text ),
'linkHolders' => $this->mLinkHolders->getSubArray( $text )
);
- wfProfileOut( __METHOD__ );
return $data;
}
*/
public function get( $article, $popts, $useOutdated = false ) {
global $wgCacheEpoch;
- wfProfileIn( __METHOD__ );
$canCache = $article->checkTouched();
if ( !$canCache ) {
// It's a redirect now
- wfProfileOut( __METHOD__ );
return false;
}
$parserOutputKey = $this->getKey( $article, $popts, $useOutdated );
if ( $parserOutputKey === false ) {
wfIncrStats( 'pcache_miss_absent' );
- wfProfileOut( __METHOD__ );
return false;
}
if ( !$value ) {
wfDebug( "ParserOutput cache miss.\n" );
wfIncrStats( "pcache_miss_absent" );
- wfProfileOut( __METHOD__ );
return false;
}
wfIncrStats( "pcache_hit" );
}
- wfProfileOut( __METHOD__ );
return $value;
}
$wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
$wgMaxGeneratedPPNodeCount, $wgDisableLangConversion, $wgDisableTitleConversion;
- wfProfileIn( __METHOD__ );
// *UPDATE* ParserOptions::matches() if any of this changes as needed
$this->mInterwikiMagic = $wgInterwikiMagic;
$this->mStubThreshold = $user->getStubThreshold();
$this->mUserLang = $lang;
- wfProfileOut( __METHOD__ );
}
/**
}
public function getText() {
- wfProfileIn( __METHOD__ );
$text = $this->mText;
if ( $this->mEditSectionTokens ) {
$text = preg_replace_callback(
$text
);
}
- wfProfileOut( __METHOD__ );
return $text;
}
* @return PPNode_DOM
*/
public function preprocessToObj( $text, $flags = 0 ) {
- wfProfileIn( __METHOD__ );
global $wgMemc, $wgPreprocessorCacheThreshold;
$xml = false;
if ( $cacheable ) {
wfProfileOut( __METHOD__ . '-cacheable' );
}
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': generated node count limit exceeded' );
}
wfProfileOut( __METHOD__ . '-cacheable' );
}
- wfProfileOut( __METHOD__ );
if ( !$result ) {
throw new MWException( __METHOD__ . ' generated invalid XML' );
* @return string
*/
public function preprocessToXml( $text, $flags = 0 ) {
- wfProfileIn( __METHOD__ );
$rules = array(
'{' => array(
'end' => '}',
$stack->rootAccum .= '</root>';
$xml = $stack->rootAccum;
- wfProfileOut( __METHOD__ );
return $xml;
}
);
return '<span class="error">Expansion depth limit exceeded</span>';
}
- wfProfileIn( __METHOD__ );
++$expansionDepth;
if ( $expansionDepth > $this->parser->mHighestExpansionDepth ) {
$this->parser->mHighestExpansionDepth = $expansionDepth;
$newIterator = $contextNode->childNodes;
}
} else {
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': Invalid parameter type' );
}
}
}
--$expansionDepth;
- wfProfileOut( __METHOD__ );
return $outStack[0];
}
* @return PPNode_Hash_Tree
*/
public function preprocessToObj( $text, $flags = 0 ) {
- wfProfileIn( __METHOD__ );
// Check cache.
global $wgMemc, $wgPreprocessorCacheThreshold;
wfDebugLog( "Preprocessor",
"Loaded preprocessor hash from memcached (key $cacheKey)" );
wfProfileOut( __METHOD__ . '-cacheable' );
- wfProfileOut( __METHOD__ );
return $hash;
}
}
wfProfileOut( __METHOD__ . '-cache-miss' );
wfProfileOut( __METHOD__ . '-cacheable' );
}
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': eqpos not found' );
}
if ( $node->name !== 'equals' ) {
wfProfileOut( __METHOD__ . '-cache-miss' );
wfProfileOut( __METHOD__ . '-cacheable' );
}
- wfProfileOut( __METHOD__ );
throw new MWException( __METHOD__ . ': eqpos is not equals' );
}
$equalsNode = $node;
wfDebugLog( "Preprocessor", "Saved preprocessor Hash to memcached (key $cacheKey)" );
}
- wfProfileOut( __METHOD__ );
return $rootNode;
}
}
return $text;
}
- wfProfileIn( __METHOD__ );
$oldType = $this->tempType;
$this->tempType = $type;
$text = preg_replace_callback( $this->regex, array( $this, 'unstripCallback' ), $text );
$this->tempType = $oldType;
- wfProfileOut( __METHOD__ );
return $text;
}
}
function acquireForMe() {
- $section = new ProfileSection( __METHOD__ );
$status = $this->precheckAcquire();
if ( !$status->isGood() ) {
}
function acquireForAnyone() {
- $section = new ProfileSection( __METHOD__ );
$status = $this->precheckAcquire();
if ( !$status->isGood() ) {
}
function release() {
- $section = new ProfileSection( __METHOD__ );
if ( $this->slot === null ) {
return Status::newGood( PoolCounter::NOT_LOCKED ); // not locked
* @return string Filtered data, or a comment containing an error message
*/
public function filter( $filter, $data, $cacheReport = true ) {
- wfProfileIn( __METHOD__ );
// For empty/whitespace-only data or for unknown filters, don't perform
// any caching or processing
if ( trim( $data ) === '' || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) {
- wfProfileOut( __METHOD__ );
return $data;
}
$cacheEntry = $cache->get( $key );
if ( is_string( $cacheEntry ) ) {
wfIncrStats( "rl-$filter-cache-hits" );
- wfProfileOut( __METHOD__ );
return $cacheEntry;
}
$this->errors[] = self::formatExceptionNoComment( $e );
}
- wfProfileOut( __METHOD__ );
return $result;
}
public function __construct( Config $config = null ) {
global $IP;
- wfProfileIn( __METHOD__ );
if ( $config === null ) {
wfDebug( __METHOD__ . ' was called without providing a Config instance' );
$this->registerTestModules();
}
- wfProfileOut( __METHOD__ );
}
/**
* not registered
*/
public function register( $name, $info = null ) {
- wfProfileIn( __METHOD__ );
// Allow multiple modules to be registered in one call
$registrations = is_array( $name ) ? $name : array( $name => $info );
foreach ( $registrations as $name => $info ) {
// Disallow duplicate registrations
if ( isset( $this->moduleInfos[$name] ) ) {
- wfProfileOut( __METHOD__ );
// A module has already been registered by this name
throw new MWException(
'ResourceLoader duplicate registration error. ' .
// Check $name for validity
if ( !self::isValidModuleName( $name ) ) {
- wfProfileOut( __METHOD__ );
throw new MWException( "ResourceLoader module name '$name' is invalid, "
. "see ResourceLoader::isValidModuleName()" );
}
// New calling convention
$this->moduleInfos[$name] = $info;
} else {
- wfProfileOut( __METHOD__ );
throw new MWException(
'ResourceLoader module info type error for module \'' . $name .
'\': expected ResourceLoaderModule or array (got: ' . gettype( $info ) . ')'
}
}
- wfProfileOut( __METHOD__ );
}
/**
. 'Edit your <code>LocalSettings.php</code> to enable it.' );
}
- wfProfileIn( __METHOD__ );
// Get core test suites
$testModules = array();
$this->testModuleNames[$id] = array_keys( $testModules[$id] );
}
- wfProfileOut( __METHOD__ );
}
/**
// See http://bugs.php.net/bug.php?id=36514
ob_start();
- wfProfileIn( __METHOD__ );
// Find out which modules are missing and instantiate the others
$modules = array();
// If there's an If-Modified-Since header, respond with a 304 appropriately
if ( $this->tryRespondLastModified( $context, $mtime ) ) {
- wfProfileOut( __METHOD__ );
return; // output handled (buffers cleared)
}
$this->errors = array();
echo $response;
- wfProfileOut( __METHOD__ );
}
/**
no modules were requested. Max made me put this here. */";
}
- wfProfileIn( __METHOD__ );
$image = $context->getImageObj();
if ( $image ) {
$data = '';
$this->errors[] = 'Image generation failed';
}
- wfProfileOut( __METHOD__ );
return $data;
}
}
}
- wfProfileOut( __METHOD__ );
return $out;
}
if ( isset( $this->modifiedTime[$context->getHash()] ) ) {
return $this->modifiedTime[$context->getHash()];
}
- wfProfileIn( __METHOD__ );
$files = array();
// giving max() an empty array
if ( count( $files ) === 0 ) {
$this->modifiedTime[$context->getHash()] = 1;
- wfProfileOut( __METHOD__ );
return $this->modifiedTime[$context->getHash()];
}
$this->getDefinitionMtime( $context )
);
- wfProfileOut( __METHOD__ );
return $this->modifiedTime[$context->getHash()];
}
* @return int UNIX timestamp
*/
public function getDefinitionMtime( ResourceLoaderContext $context ) {
- wfProfileIn( __METHOD__ );
$summary = $this->getDefinitionSummary( $context );
if ( $summary === null ) {
- wfProfileOut( __METHOD__ );
return 1;
}
$data = $cache->get( $key );
if ( is_int( $data ) && $data > 0 ) {
// We've seen this hash before, re-use the timestamp of when we first saw it.
- wfProfileOut( __METHOD__ );
return $data;
}
$timestamp = time();
$cache->set( $key, $timestamp );
- wfProfileOut( __METHOD__ );
return $timestamp;
}
* @return string JavaScript code for registering all modules with the client loader
*/
public function getModuleRegistrations( ResourceLoaderContext $context ) {
- wfProfileIn( __METHOD__ );
$resourceLoader = $context->getResourceLoader();
$target = $context->getRequest()->getVal( 'target', 'desktop' );
// Register modules
$out .= ResourceLoader::makeLoaderRegisterScript( $registrations );
- wfProfileOut( __METHOD__ );
return $out;
}
function normalizeText( $string ) {
global $wgContLang;
- wfProfileIn( __METHOD__ );
$out = parent::normalizeText( $string );
"$1u82e$2",
$out );
- wfProfileOut( __METHOD__ );
return $out;
}
* @return string The cache key.
*/
protected function getCacheKey() {
- wfProfileIn( __METHOD__ );
if ( $this->cacheKey === null ) {
$type = 'SiteList#' . SiteList::getSerialVersionId();
$this->cacheKey = wfMemcKey( "$source/$type" );
}
- wfProfileOut( __METHOD__ );
return $this->cacheKey;
}
* @return SiteList
*/
public function getSites( $source = 'cache' ) {
- wfProfileIn( __METHOD__ );
if ( $source === 'cache' ) {
if ( $this->sites === null ) {
$this->loadSites();
}
- wfProfileOut( __METHOD__ );
return $this->sites;
}
* @return Site
*/
protected function siteFromRow( ORMRow $siteRow ) {
- wfProfileIn( __METHOD__ );
$site = Site::newForType( $siteRow->getField( 'type', Site::TYPE_UNKNOWN ) );
$site->setExtraConfig( $siteRow->getField( 'config' ) );
}
- wfProfileOut( __METHOD__ );
return $site;
}
* @since 1.21
*/
protected function loadSites() {
- wfProfileIn( __METHOD__ );
$this->sites = new SiteList();
$this->cache->set( $this->getCacheKey(), $this->sites, $this->cacheTimeout );
- wfProfileOut( __METHOD__ );
}
/**
* @return Site|null
*/
public function getSite( $globalId, $source = 'cache' ) {
- wfProfileIn( __METHOD__ );
$sites = $this->getSites( $source );
- wfProfileOut( __METHOD__ );
return $sites->hasSite( $globalId ) ? $sites->getSite( $globalId ) : null;
}
* @return bool Success indicator
*/
public function saveSites( array $sites ) {
- wfProfileIn( __METHOD__ );
if ( empty( $sites ) ) {
- wfProfileOut( __METHOD__ );
return true;
}
// purge cache
$this->reset();
- wfProfileOut( __METHOD__ );
return $success;
}
* @since 1.21
*/
public function reset() {
- wfProfileIn( __METHOD__ );
// purge cache
$this->cache->delete( $this->getCacheKey() );
$this->sites = null;
- wfProfileOut( __METHOD__ );
}
/**
* @return bool Success
*/
public function clear() {
- wfProfileIn( __METHOD__ );
$dbw = $this->sitesTable->getWriteDbConnection();
$dbw->startAtomic( __METHOD__ );
$this->reset();
- wfProfileOut( __METHOD__ );
return $ok;
}
* @return array
*/
function getToolbox() {
- wfProfileIn( __METHOD__ );
$toolbox = array();
if ( isset( $this->data['nav_urls']['whatlinkshere'] )
}
Hooks::run( 'BaseTemplateToolbox', array( &$this, &$toolbox ) );
- wfProfileOut( __METHOD__ );
return $toolbox;
}
}
function translate( $value ) {
- wfProfileIn( __METHOD__ );
// Hack for i18n:attributes in PHPTAL 1.0.0 dev version as of 2004-10-23
$value = preg_replace( '/^string:/', '', $value );
wfRestoreWarnings();
$value = str_replace( $src, $varValue, $value );
}
- wfProfileOut( __METHOD__ );
return $value;
}
}
* @param OutputPage $out
*/
function initPage( OutputPage $out ) {
- wfProfileIn( __METHOD__ );
$this->preloadExistence();
- wfProfileOut( __METHOD__ );
}
/**
* @return string HTML anchor
*/
public function footerLink( $desc, $page ) {
- $section = new ProfileSection( __METHOD__ );
// if the link description has been set to "-" in the default language,
if ( $this->msg( $desc )->inContentLanguage()->isDisabled() ) {
// then it is disabled, for all languages.
*/
function buildSidebar() {
global $wgMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
- wfProfileIn( __METHOD__ );
$key = wfMemcKey( 'sidebar', $this->getLanguage()->getCode() );
if ( $cachedsidebar ) {
Hooks::run( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) );
- wfProfileOut( __METHOD__ );
return $cachedsidebar;
}
}
Hooks::run( 'SidebarBeforeOutput', array( $this, &$bar ) );
- wfProfileOut( __METHOD__ );
return $bar;
}
private function getCachedNotice( $name ) {
global $wgRenderHashAppend, $parserMemc, $wgContLang;
- wfProfileIn( __METHOD__ );
$needParse = false;
global $wgSiteNotice;
$notice = $wgSiteNotice;
if ( empty( $notice ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
} else {
$msg = $this->msg( $name )->inContentLanguage();
if ( $msg->isDisabled() ) {
- wfProfileOut( __METHOD__ );
return false;
}
$notice = $msg->plain();
$notice = Html::rawElement( 'div', array( 'id' => 'localNotice',
'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ), $notice );
- wfProfileOut( __METHOD__ );
return $notice;
}
* @return string HTML fragment
*/
function getNamespaceNotice() {
- wfProfileIn( __METHOD__ );
$key = 'namespacenotice-' . $this->getTitle()->getNsText();
$namespaceNotice = $this->getCachedNotice( $key );
$namespaceNotice = '';
}
- wfProfileOut( __METHOD__ );
return $namespaceNotice;
}
* @return string HTML fragment
*/
function getSiteNotice() {
- wfProfileIn( __METHOD__ );
$siteNotice = '';
if ( Hooks::run( 'SiteNoticeBefore', array( &$siteNotice, $this ) ) ) {
}
Hooks::run( 'SiteNoticeAfter', array( &$siteNotice, $this ) );
- wfProfileOut( __METHOD__ );
return $siteNotice;
}
}
protected function setupTemplateForOutput() {
- wfProfileIn( __METHOD__ );
$request = $this->getRequest();
$user = $this->getUser();
wfProfileOut( __METHOD__ . '-stuff' );
- wfProfileOut( __METHOD__ );
return $tpl;
}
* @param OutputPage $out
*/
function outputPage( OutputPage $out = null ) {
- wfProfileIn( __METHOD__ );
Profiler::instance()->setTemplated( true );
$oldContext = null;
$this->setContext( $oldContext );
}
- wfProfileOut( __METHOD__ );
}
/**
$wgShowCreditsIfMax, $wgArticlePath,
$wgScriptPath, $wgServer;
- wfProfileIn( __METHOD__ );
$title = $this->getTitle();
$request = $this->getRequest();
$tpl->set( 'dataAfterContent', $this->afterContentHook() );
wfProfileOut( __METHOD__ . '-stuff5' );
- wfProfileOut( __METHOD__ );
return $tpl;
}
$title = $this->getTitle();
$request = $this->getRequest();
$pageurl = $title->getLocalURL();
- wfProfileIn( __METHOD__ );
/* set up the default links for the personal toolbar */
$personal_urls = array();
}
Hooks::run( 'PersonalUrls', array( &$personal_urls, &$title, $this ) );
- wfProfileOut( __METHOD__ );
return $personal_urls;
}
protected function buildContentNavigationUrls() {
global $wgDisableLangConversion;
- wfProfileIn( __METHOD__ );
// Display tabs for the relevant title rather than always the title itself
$title = $this->getRelevantTitle();
}
}
- wfProfileOut( __METHOD__ );
return $content_navigation;
}
*/
private function buildContentActionUrls( $content_navigation ) {
- wfProfileIn( __METHOD__ );
// content_actions has been replaced with content_navigation for backwards
// compatibility and also for skins that just want simple tabs content_actions
}
}
- wfProfileOut( __METHOD__ );
return $content_actions;
}
protected function buildNavUrls() {
global $wgUploadNavigationUrl;
- wfProfileIn( __METHOD__ );
$out = $this->getOutput();
$request = $this->getRequest();
}
}
- wfProfileOut( __METHOD__ );
return $nav_urls;
}
global $wgPageLanguageUseDB;
if ( !is_array( self::$list ) ) {
- wfProfileIn( __METHOD__ );
self::$list = self::$coreList;
// This hook can be used to remove undesired built-in special pages
Hooks::run( 'SpecialPage_initList', array( &self::$list ) );
- wfProfileOut( __METHOD__ );
}
return self::$list;
* @return bool
*/
public static function executePath( Title &$title, IContextSource &$context, $including = false ) {
- wfProfileIn( __METHOD__ );
// @todo FIXME: Redirects broken due to this call
$bits = explode( '/', $title->getDBkey(), 2 );
}
$context->getOutput()->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
- wfProfileOut( __METHOD__ );
return false;
}
$title = $page->getPageTitle( $par );
$url = $title->getFullURL( $query );
$context->getOutput()->redirect( $url );
- wfProfileOut( __METHOD__ );
return $title;
} else {
$context->setTitle( $page->getPageTitle( $par ) );
}
} elseif ( !$page->isIncludable() ) {
- wfProfileOut( __METHOD__ );
return false;
}
$page->including( $including );
// Execute special page
- $profName = 'Special:' . $page->getName();
- wfProfileIn( $profName );
$page->run( $par );
- wfProfileOut( $profName );
- wfProfileOut( __METHOD__ );
return true;
}
}
function getAllMessages( $descending ) {
- wfProfileIn( __METHOD__ );
$messageNames = Language::getLocalisationCache()->getSubitemList( 'en', 'messages' );
if ( $descending ) {
rsort( $messageNames );
// Normalise message names so they look like page titles
$messageNames = array_map( array( $this->lang, 'ucfirst' ), $messageNames );
- wfProfileOut( __METHOD__ );
return $messageNames;
}
* @param ResultWrapper $result
*/
function preprocessResults( $result ) {
- wfProfileIn( __METHOD__ );
# Do a link batch query
$lb = new LinkBatch;
$lb->setCaller( __METHOD__ );
}
$lb->execute();
- wfProfileOut( __METHOD__ );
}
}
* @return string
*/
function formatRow( $row ) {
- wfProfileIn( __METHOD__ );
$ret = '';
$classes = array();
$ret = Html::rawElement( 'li', array( 'class' => $classes ), $ret ) . "\n";
}
- wfProfileOut( __METHOD__ );
return $ret;
}
* @return string
*/
function formatRow( $row ) {
- wfProfileIn( __METHOD__ );
$page = Title::makeTitle( $row->ar_namespace, $row->ar_title );
$ret = Html::rawElement( 'li', array(), $ret ) . "\n";
- wfProfileOut( __METHOD__ );
return $ret;
}
}
function getStartBody() {
- wfProfileIn( __METHOD__ );
# Do a link batch query
$this->mResult->seek( 0 );
$batch = new LinkBatch();
$batch->execute();
$this->mResult->seek( 0 );
- wfProfileOut( __METHOD__ );
return '';
}
* @return string
*/
function formatRow( $row ) {
- wfProfileIn( __METHOD__ );
static $infinity = null;
$title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
if ( !$title ) {
- wfProfileOut( __METHOD__ );
return Html::rawElement(
'li',
)->escaped();
}
- wfProfileOut( __METHOD__ );
// @todo i18n: This should use a comma separator instead of a hard coded comma, right?
return '<li>' . $lang->specialList( $link, implode( $description_items, ', ' ) ) . "</li>\n";
}
function getStartBody() {
- wfProfileIn( __METHOD__ );
# Do a link batch query
$this->mResult->seek( 0 );
$lb = new LinkBatch;
}
$lb->execute();
- wfProfileOut( __METHOD__ );
return '';
}
public function showResults( $term ) {
global $wgContLang;
- $profile = new ProfileSection( __METHOD__ );
$search = $this->getSearchEngine();
$search->setLimitOffset( $this->limit, $this->offset );
$search->setNamespaces( $this->namespaces );
protected function showMatches( &$matches ) {
global $wgContLang;
- $profile = new ProfileSection( __METHOD__ );
$terms = $wgContLang->convertForSearchResult( $matches->termMatches() );
$out = "<ul class='mw-search-results'>\n";
* @return string
*/
protected function showHit( $result, $terms ) {
- $profile = new ProfileSection( __METHOD__ );
if ( $result->isBrokenTitle() ) {
return '';
*/
protected function showInterwiki( $matches, $query ) {
global $wgContLang;
- $profile = new ProfileSection( __METHOD__ );
$out = "<div id='mw-search-interwiki'><div id='mw-search-interwiki-caption'>" .
$this->msg( 'search-interwiki-caption' )->text() . "</div>\n";
* @return string
*/
protected function showInterwikiHit( $result, $lastInterwiki, $query, $customCaptions ) {
- $profile = new ProfileSection( __METHOD__ );
if ( $result->isBrokenTitle() ) {
return '';
*/
public static function getVersion( $flags = '' ) {
global $wgVersion, $IP;
- wfProfileIn( __METHOD__ );
$gitInfo = self::getGitHeadSha1( $IP );
$svnInfo = self::getSvnInfo( $IP );
)->text();
}
- wfProfileOut( __METHOD__ );
return $version;
}
*/
public static function getVersionLinked() {
global $wgVersion;
- wfProfileIn( __METHOD__ );
$gitVersion = self::getVersionLinkedGit();
if ( $gitVersion ) {
}
}
- wfProfileOut( __METHOD__ );
return $v;
}
* @return string|bool The real path if it was a virtual URL Returns false on failure
*/
function getRealPath( $srcPath ) {
- wfProfileIn( __METHOD__ );
$repo = RepoGroup::singleton()->getLocalRepo();
if ( $repo->isVirtualUrl( $srcPath ) ) {
/** @todo Just make uploads work with storage paths UploadFromStash
} else {
$path = $srcPath;
}
- wfProfileOut( __METHOD__ );
return $path;
}
* @return mixed Const self::OK or else an array with error information
*/
public function verifyUpload() {
- wfProfileIn( __METHOD__ );
/**
* If there was no filename or a zero size given, give up quick.
*/
if ( $this->isEmptyFile() ) {
- wfProfileOut( __METHOD__ );
return array( 'status' => self::EMPTY_FILE );
}
*/
$maxSize = self::getMaxUploadSize( $this->getSourceType() );
if ( $this->mFileSize > $maxSize ) {
- wfProfileOut( __METHOD__ );
return array(
'status' => self::FILE_TOO_LARGE,
*/
$verification = $this->verifyFile();
if ( $verification !== true ) {
- wfProfileOut( __METHOD__ );
return array(
'status' => self::VERIFICATION_ERROR,
*/
$result = $this->validateName();
if ( $result !== true ) {
- wfProfileOut( __METHOD__ );
return $result;
}
if ( !Hooks::run( 'UploadVerification',
array( $this->mDestName, $this->mTempPath, &$error ) )
) {
- wfProfileOut( __METHOD__ );
return array( 'status' => self::HOOK_ABORTED, 'error' => $error );
}
- wfProfileOut( __METHOD__ );
return array( 'status' => self::OK );
}
*/
protected function verifyMimeType( $mime ) {
global $wgVerifyMimeType;
- wfProfileIn( __METHOD__ );
if ( $wgVerifyMimeType ) {
wfDebug( "mime: <$mime> extension: <{$this->mFinalExtension}>\n" );
global $wgMimeTypeBlacklist;
if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) {
- wfProfileOut( __METHOD__ );
return array( 'filetype-badmime', $mime );
}
$ieTypes = $magic->getIEMimeTypes( $this->mTempPath, $chunk, $extMime );
foreach ( $ieTypes as $ieType ) {
if ( $this->checkFileExtension( $ieType, $wgMimeTypeBlacklist ) ) {
- wfProfileOut( __METHOD__ );
return array( 'filetype-bad-ie-mime', $ieType );
}
}
}
- wfProfileOut( __METHOD__ );
return true;
}
*/
protected function verifyFile() {
global $wgVerifyMimeType, $wgDisableUploadScriptChecks;
- wfProfileIn( __METHOD__ );
$status = $this->verifyPartialFile();
if ( $status !== true ) {
- wfProfileOut( __METHOD__ );
return $status;
}
if ( $wgVerifyMimeType ) {
# XXX: Missing extension will be caught by validateName() via getTitle()
if ( $this->mFinalExtension != '' && !$this->verifyExtension( $mime, $this->mFinalExtension ) ) {
- wfProfileOut( __METHOD__ );
return array( 'filetype-mime-mismatch', $this->mFinalExtension, $mime );
}
if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) {
$svgStatus = $this->detectScriptInSvg( $this->mTempPath, false );
if ( $svgStatus !== false ) {
- wfProfileOut( __METHOD__ );
return $svgStatus;
}
$handlerStatus = $handler->verifyUpload( $this->mTempPath );
if ( !$handlerStatus->isOK() ) {
$errors = $handlerStatus->getErrorsArray();
- wfProfileOut( __METHOD__ );
return reset( $errors );
}
Hooks::run( 'UploadVerifyFile', array( $this, $mime, &$status ) );
if ( $status !== true ) {
- wfProfileOut( __METHOD__ );
return $status;
}
wfDebug( __METHOD__ . ": all clear; passing.\n" );
- wfProfileOut( __METHOD__ );
return true;
}
*/
protected function verifyPartialFile() {
global $wgAllowJavaUploads, $wgDisableUploadScriptChecks;
- wfProfileIn( __METHOD__ );
# getTitle() sets some internal parameters like $this->mFinalExtension
$this->getTitle();
$mime = $this->mFileProps['file-mime'];
$status = $this->verifyMimeType( $mime );
if ( $status !== true ) {
- wfProfileOut( __METHOD__ );
return $status;
}
# check for htmlish code and javascript
if ( !$wgDisableUploadScriptChecks ) {
if ( self::detectScript( $this->mTempPath, $mime, $this->mFinalExtension ) ) {
- wfProfileOut( __METHOD__ );
return array( 'uploadscripted' );
}
if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) {
$svgStatus = $this->detectScriptInSvg( $this->mTempPath, true );
if ( $svgStatus !== false ) {
- wfProfileOut( __METHOD__ );
return $svgStatus;
}
$errors = $zipStatus->getErrorsArray();
$error = reset( $errors );
if ( $error[0] !== 'zip-wrong-format' ) {
- wfProfileOut( __METHOD__ );
return $error;
}
}
if ( $this->mJavaDetected ) {
- wfProfileOut( __METHOD__ );
return array( 'uploadjava' );
}
# Scan the uploaded file for viruses
$virus = $this->detectVirus( $this->mTempPath );
if ( $virus ) {
- wfProfileOut( __METHOD__ );
return array( 'uploadvirus', $virus );
}
- wfProfileOut( __METHOD__ );
return true;
}
*/
public function checkWarnings() {
global $wgLang;
- wfProfileIn( __METHOD__ );
$warnings = array();
}
}
- wfProfileOut( __METHOD__ );
return $warnings;
}
* @return Status Indicating the whether the upload succeeded.
*/
public function performUpload( $comment, $pageText, $watch, $user ) {
- wfProfileIn( __METHOD__ );
$status = $this->getLocalFile()->upload(
$this->mTempPath,
$this->postProcessUpload();
}
- wfProfileOut( __METHOD__ );
return $status;
}
*/
public function stashFile( User $user = null ) {
// was stashSessionFile
- wfProfileIn( __METHOD__ );
$stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash( $user );
$file = $stash->stashFile( $this->mTempPath, $this->getSourceType() );
$this->mLocalFile = $file;
- wfProfileOut( __METHOD__ );
return $file;
}
*/
public static function detectScript( $file, $mime, $extension ) {
global $wgAllowTitlesInSVG;
- wfProfileIn( __METHOD__ );
# ugly hack: for text files, always look at the entire file.
# For binary field, just check the first K.
$chunk = strtolower( $chunk );
if ( !$chunk ) {
- wfProfileOut( __METHOD__ );
return false;
}
# check for HTML doctype
if ( preg_match( "/<!DOCTYPE *X?HTML/i", $chunk ) ) {
- wfProfileOut( __METHOD__ );
return true;
}
// PHP/expat will interpret the given encoding in the xml declaration (bug 47304)
if ( $extension == 'svg' || strpos( $mime, 'image/svg' ) === 0 ) {
if ( self::checkXMLEncodingMissmatch( $file ) ) {
- wfProfileOut( __METHOD__ );
return true;
}
foreach ( $tags as $tag ) {
if ( false !== strpos( $chunk, $tag ) ) {
wfDebug( __METHOD__ . ": found something that may make it be mistaken for html: $tag\n" );
- wfProfileOut( __METHOD__ );
return true;
}
# look for script-types
if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) ) {
wfDebug( __METHOD__ . ": found script types\n" );
- wfProfileOut( __METHOD__ );
return true;
}
# look for html-style script-urls
if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) {
wfDebug( __METHOD__ . ": found html-style script urls\n" );
- wfProfileOut( __METHOD__ );
return true;
}
# look for css-style script-urls
if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) {
wfDebug( __METHOD__ . ": found css-style script urls\n" );
- wfProfileOut( __METHOD__ );
return true;
}
wfDebug( __METHOD__ . ": no scripts found\n" );
- wfProfileOut( __METHOD__ );
return false;
}
*/
public static function detectVirus( $file ) {
global $wgAntivirus, $wgAntivirusSetup, $wgAntivirusRequired, $wgOut;
- wfProfileIn( __METHOD__ );
if ( !$wgAntivirus ) {
wfDebug( __METHOD__ . ": virus scanner disabled\n" );
- wfProfileOut( __METHOD__ );
return null;
}
wfDebug( __METHOD__ . ": unknown virus scanner: $wgAntivirus\n" );
$wgOut->wrapWikiMsg( "<div class=\"error\">\n$1\n</div>",
array( 'virus-badscanner', $wgAntivirus ) );
- wfProfileOut( __METHOD__ );
return wfMessage( 'virus-unknownscanner' )->text() . " $wgAntivirus";
}
wfDebug( __METHOD__ . ": FOUND VIRUS! scanner feedback: $output \n" );
}
- wfProfileOut( __METHOD__ );
return $output;
}
public static function isConfiguredProxy( $ip ) {
global $wgSquidServers, $wgSquidServersNoPurge;
- wfProfileIn( __METHOD__ );
// Quick check of known singular proxy servers
$trusted = in_array( $ip, $wgSquidServers );
}
$trusted = self::$proxyIpSet->match( $ip );
}
- wfProfileOut( __METHOD__ );
return $trusted;
}
* @see self::generate()
*/
public function realGenerate( $bytes, $forceStrong = false ) {
- wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . ": Generating cryptographic random bytes for " .
wfGetAllCallers( 5 ) . "\n" );
wfDebug( __METHOD__ . ": " . strlen( $buffer ) .
" bytes of randomness leftover in the buffer.\n" );
- wfProfileOut( __METHOD__ );
return $generated;
}
* @since 1.20
*/
public static function fetchLanguageNames( $inLanguage = null, $include = 'mw' ) {
- wfProfileIn( __METHOD__ );
$cacheKey = $inLanguage === null ? 'null' : $inLanguage;
$cacheKey .= ":$include";
if ( self::$languageNameCache === null ) {
$ret = self::fetchLanguageNamesUncached( $inLanguage, $include );
self::$languageNameCache->set( $cacheKey, $ret );
}
- wfProfileOut( __METHOD__ );
return $ret;
}
return array( $wikiUpperChars, $wikiLowerChars );
}
- wfProfileIn( __METHOD__ );
$arr = wfGetPrecompiledData( 'Utf8Case.ser' );
if ( $arr === false ) {
throw new MWException(
}
$wikiUpperChars = $arr['wikiUpperChars'];
$wikiLowerChars = $arr['wikiLowerChars'];
- wfProfileOut( __METHOD__ );
return array( $wikiUpperChars, $wikiLowerChars );
}
* @return string The converted text
*/
public function autoConvert( $text, $toVariant = false ) {
- wfProfileIn( __METHOD__ );
$this->loadTables();
if ( !$toVariant ) {
$toVariant = $this->getPreferredVariant();
if ( !$toVariant ) {
- wfProfileOut( __METHOD__ );
return $text;
}
}
if ( $this->guessVariant( $text, $toVariant ) ) {
- wfProfileOut( __METHOD__ );
return $text;
}
$literalIter->next();
}
- wfProfileOut( __METHOD__ );
return $output;
}
* @return string Translated text
*/
public function translate( $text, $variant ) {
- wfProfileIn( __METHOD__ );
// If $text is empty or only includes spaces, do nothing
// Otherwise translate it
if ( trim( $text ) ) {
$this->loadTables();
$text = $this->mTables[$variant]->replace( $text );
}
- wfProfileOut( __METHOD__ );
return $text;
}
* @return array Variant => converted text
*/
public function autoConvertToAllVariants( $text ) {
- wfProfileIn( __METHOD__ );
$this->loadTables();
$ret = array();
$ret[$variant] = $this->translate( $text, $variant );
}
- wfProfileOut( __METHOD__ );
return $ret;
}
return;
}
- wfProfileIn( __METHOD__ );
$this->mTablesLoaded = true;
$this->mTables = false;
if ( $fromCache ) {
$wgLangConvMemc->set( $this->mCacheKey, $this->mTables, 43200 );
wfProfileOut( __METHOD__ . '-recache' );
}
- wfProfileOut( __METHOD__ );
}
/**
* @return string
*/
function normalizeForSearch( $string ) {
- wfProfileIn( __METHOD__ );
# MySQL fulltext index doesn't grok utf-8, so we
# need to fold cases and convert to hex
$s = parent::normalizeForSearch( $s );
- wfProfileOut( __METHOD__ );
return $s;
}
* @return string
*/
function convertGrammar( $word, $case ) {
- wfProfileIn( __METHOD__ );
$variant = $this->getPreferredVariant();
switch ( $variant ) {
$word = parent::convertGrammarKk_cyrl( $word, $case );
}
- wfProfileOut( __METHOD__ );
return $word;
}
}
* @return string
*/
function normalizeForSearch( $string ) {
- wfProfileIn( __METHOD__ );
// Double-width roman characters
$s = self::convertDoubleWidth( $string );
$s = trim( $s );
$s = parent::normalizeForSearch( $s );
- wfProfileOut( __METHOD__ );
return $s;
}
}
* @return string
*/
function normalizeForSearch( $string, $autoVariant = 'zh-hans' ) {
- wfProfileIn( __METHOD__ );
// always convert to zh-hans before indexing. it should be
// better to use zh-hans for search, since conversion from
$s = $this->mConverter->autoConvert( $string, $autoVariant );
// LanguageZh_hans::normalizeForSearch
$s = parent::normalizeForSearch( $s );
- wfProfileOut( __METHOD__ );
return $s;
}
* @return string
*/
function normalizeForSearch( $s ) {
- wfProfileIn( __METHOD__ );
// Double-width roman characters
$s = parent::normalizeForSearch( $s );
$s = trim( $s );
$s = $this->segmentByWord( $s );
- wfProfileOut( __METHOD__ );
return $s;
}
}
protected function setUp() {
- wfProfileIn( __METHOD__ );
parent::setUp();
$this->called['setUp'] = true;
DeferredUpdates::clearPendingUpdates();
- wfProfileOut( __METHOD__ );
}
protected function tearDown() {
- wfProfileIn( __METHOD__ );
$this->called['tearDown'] = true;
// Cleaning up temporary files
}
parent::tearDown();
- wfProfileOut( __METHOD__ );
}
/**
function wfStreamThumb( array $params ) {
global $wgVaryOnXFP;
- $section = new ProfileSection( __METHOD__ );
$headers = array(); // HTTP headers to send