From a6c69e9ca301e0970dbe67767b6e50f475843648 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 16 Aug 2004 19:06:03 +0000 Subject: [PATCH] * Add more profiling granularity to replaceLinkHolders * Split a couple "?>" instances in string literals -- these hose some syntax highlighters --- includes/OutputPage.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e962f04ca7..36c522c446 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -664,7 +664,7 @@ class OutputPage { $a = array_slice ( $a , 0 , 10 ) ; # 10 keywords max $a = implode ( "," , $a ) ; $strip = array( - "/<.*?>/" => '', + "/<.*?" . ">/" => '', "/[_]/" => ' ' ); $a = htmlspecialchars(preg_replace(array_keys($strip), array_values($strip),$a )); @@ -736,7 +736,7 @@ class OutputPage { if ( count( $this->mKeywords ) > 0 ) { $strip = array( - "/<.*?>/" => '', + "/<.*?" . ">/" => '', "/[_]/" => ' ' ); $ret .= "/", $this->mBodytext, $tmpLinks ); + wfProfileOut( "$fname-match" ); if ( !empty( $tmpLinks[0] ) ) { + wfProfileIn( "$fname-check" ); $dbr =& wfGetDB( DB_SLAVE ); $cur = $dbr->tableName( 'cur' ); $sk = $wgUser->getSkin(); @@ -868,8 +871,10 @@ class OutputPage { } } } + wfProfileOut( "$fname-check" ); # Construct search and replace arrays + wfProfileIn( "$fname-construct" ); $search = $replace = array(); foreach ( $namespaces as $key => $ns ) { $pdbk = $pdbks[$key]; @@ -885,8 +890,11 @@ class OutputPage { $replace[] = $sk->makeStubLinkObj( $title, $texts[$key], $queries[$key] ); } } + wfProfileOut( "$fname-construct" ); # Do the thing + wfProfileIn( "$fname-replace" ); $this->mBodytext = str_replace( $search, $replace, $this->mBodytext ); + wfProfileOut( "$fname-replace" ); } wfProfileOut( $fname ); return $colours; -- 2.20.1