Merge "Use a faster 7z command line by default"
[lhc/web/wiklou.git] / includes / parser / MWTidy.php
index 6c62302..e29ee88 100644 (file)
@@ -40,13 +40,10 @@ class MWTidyWrapper {
         */
        protected $mTokens;
 
-       protected $mUniqPrefix;
-
        protected $mMarkerIndex;
 
        public function __construct() {
                $this->mTokens = null;
-               $this->mUniqPrefix = null;
        }
 
        /**
@@ -55,8 +52,6 @@ class MWTidyWrapper {
         */
        public function getWrapped( $text ) {
                $this->mTokens = new ReplacementArray;
-               $this->mUniqPrefix = "\x7fUNIQ" .
-                       dechex( mt_rand( 0, 0x7fffffff ) ) . dechex( mt_rand( 0, 0x7fffffff ) );
                $this->mMarkerIndex = 0;
 
                // Replace <mw:editsection> elements with placeholders
@@ -86,7 +81,7 @@ class MWTidyWrapper {
         * @return string
         */
        public function replaceCallback( $m ) {
-               $marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
+               $marker = Parser::MARKER_PREFIX . "-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
                $this->mMarkerIndex++;
                $this->mTokens->setPair( $marker, $m[0] );
                return $marker;
@@ -195,7 +190,6 @@ class MWTidy {
         */
        private static function externalClean( $text, $stderr = false, &$retval = null ) {
                global $wgTidyConf, $wgTidyBin, $wgTidyOpts;
-               wfProfileIn( __METHOD__ );
 
                $cleansource = '';
                $opts = ' -utf8';
@@ -247,7 +241,6 @@ class MWTidy {
                        $cleansource = null;
                }
 
-               wfProfileOut( __METHOD__ );
                return $cleansource;
        }
 
@@ -262,7 +255,6 @@ class MWTidy {
         */
        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' ) )
@@ -270,7 +262,6 @@ class MWTidy {
                        wfWarn( "Unable to load internal tidy class." );
                        $retval = -1;
 
-                       wfProfileOut( __METHOD__ );
                        return null;
                }
 
@@ -279,8 +270,6 @@ class MWTidy {
 
                if ( $stderr ) {
                        $retval = $tidy->getStatus();
-
-                       wfProfileOut( __METHOD__ );
                        return $tidy->errorBuffer;
                }
 
@@ -299,7 +288,6 @@ class MWTidy {
                        }
                }
 
-               wfProfileOut( __METHOD__ );
                return $cleansource;
        }
 
@@ -316,7 +304,7 @@ class MWTidy {
         */
        private static function hhvmClean( $text, &$retval ) {
                global $wgTidyConf;
-               wfProfileIn( __METHOD__ );
+
                $cleansource = tidy_repair_string( $text, $wgTidyConf, 'utf8' );
                if ( $cleansource === false ) {
                        $cleansource = null;
@@ -324,7 +312,7 @@ class MWTidy {
                } else {
                        $retval = 0;
                }
-               wfProfileOut( __METHOD__ );
+
                return $cleansource;
        }
 }