jenkins-bot has submitted this change and it was merged.

Change subject: fix time useage counter (1.0.10)
......................................................................


fix time useage counter (1.0.10)

Change-Id: Ib6e62863d6ec34e7ec696fe203d9fcf99abbbbd7
---
M PhpTags.body.php
M PhpTags.i18n.php
M PhpTags.php
3 files changed, 22 insertions(+), 10 deletions(-)

Approvals:
  Pastakhov: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/PhpTags.body.php b/PhpTags.body.php
index dfaea1f..5d77a87 100644
--- a/PhpTags.body.php
+++ b/PhpTags.body.php
@@ -24,7 +24,9 @@
         */
        public static function renderFunction( $parser, $frame, $args ) {
                global $wgPhpTagsTime, $wgPhpTagsMaxLoops;
-               $time = microtime(true);
+
+               //$time = microtime(true);
+               $time = $parser->mOutput->getTimeSinceStart('cpu');
 
                $is_banned = self::isBanned($frame);
                if ( $is_banned ) {
@@ -50,7 +52,8 @@
                        $compiler = new PhpTags\Compiler();
                        $bytecode = $compiler->compile($command, $titleText);
 
-                       self::$compileTime += microtime(true) - $time;
+                       // self::$compileTime += microtime(true) - $time;
+                       self::$compileTime += 
$parser->mOutput->getTimeSinceStart('cpu') - $time;
 
                        $result = \PhpTags\Runtime::run(
                                        $bytecode,
@@ -65,13 +68,17 @@
                        $return = $exc->getTraceAsString();
                }
 
-               $wgPhpTagsTime += microtime(true) - $time;
+               // $wgPhpTagsTime += microtime(true) - $time;
+               $wgPhpTagsTime += $parser->mOutput->getTimeSinceStart('cpu') - 
$time;
+
                return \UtfNormal::cleanUp($return);
        }
 
        public static function render($input, array $args, Parser $parser, 
PPFrame $frame) {
                global $wgPhpTagsTime, $wgPhpTagsMaxLoops;
-               $time = microtime(true);
+
+               //$time = microtime(true);
+               $time = $parser->mOutput->getTimeSinceStart('cpu');
 
                $is_banned = self::isBanned($frame);
                if ( $is_banned ) {
@@ -92,7 +99,8 @@
                        $compiler = new PhpTags\Compiler();
                        $bytecode = $compiler->compile($input, $titleText);
 
-                       self::$compileTime += microtime(true) - $time;
+                       // self::$compileTime += microtime(true) - $time;
+                       self::$compileTime += 
$parser->mOutput->getTimeSinceStart('cpu') - $time;
 
                        $result = \PhpTags\Runtime::run(
                                        $bytecode,
@@ -101,12 +109,17 @@
                                        array( 
PHPTAGS_TRANSIT_PARSER=>&$parser, PHPTAGS_TRANSIT_PPFRAME=>&$frame )
                                        );
                } catch ( \PhpTags\ExceptionPhpTags $exc ) {
-                       $wgPhpTagsTime += microtime(true) - $time;
+                       // $wgPhpTagsTime += microtime(true) - $time;
+                       $wgPhpTagsTime += 
$parser->mOutput->getTimeSinceStart('cpu') - $time;
                        return (string) $exc;
                } catch ( Exception $exc ) {
-                       $wgPhpTagsTime += microtime(true) - $time;
+                       // $wgPhpTagsTime += microtime(true) - $time;
+                       $wgPhpTagsTime += 
$parser->mOutput->getTimeSinceStart('cpu') - $time;
                        return $exc->getTraceAsString();
                }
+
+               // $wgPhpTagsTime += microtime(true) - $time;
+               $wgPhpTagsTime += $parser->mOutput->getTimeSinceStart('cpu') - 
$time;
 
                if( $is_debug ) {
                        $parser->getOutput()->addModules('ext.php.Debug');
@@ -121,7 +134,6 @@
                        $return .= self::insertGeneral( $parser, 
$parser->recursiveTagParse(implode($result),$frame) );
                }
 
-               $wgPhpTagsTime += microtime(true) - $time;
                return \UtfNormal::cleanUp($return);
        }
 
diff --git a/PhpTags.i18n.php b/PhpTags.i18n.php
index 8e5344d..08f7dd3 100644
--- a/PhpTags.i18n.php
+++ b/PhpTags.i18n.php
@@ -18,7 +18,7 @@
  * @author pastakhov
  */
 $messages['en'] = array(
-       'phptags-desc' => 'Enhances parser with magic expressions that has 
syntax of PHP language',
+       'phptags-desc' => 'Enhances parser with Magic expression that has 
syntax of PHP language',
        'phptags-disabled-for-namespace' => 'Extension PhpTags disabled for 
namespace "$1"',
 );
 
diff --git a/PhpTags.php b/PhpTags.php
index c57cd48..de801b7 100644
--- a/PhpTags.php
+++ b/PhpTags.php
@@ -17,7 +17,7 @@
 
 define( 'PHPTAGS_MAJOR_VERSION', 1 );
 define( 'PHPTAGS_MINOR_VERSION', 0 );
-define( 'PHPTAGS_RELEASE_VERSION', 9 );
+define( 'PHPTAGS_RELEASE_VERSION', 10 );
 define( 'PHPTAGS_VERSION', PHPTAGS_MAJOR_VERSION . '.' . PHPTAGS_MINOR_VERSION 
. '.' . PHPTAGS_RELEASE_VERSION );
 
 // Register this extension on Special:Version

-- 
To view, visit https://gerrit.wikimedia.org/r/120359
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6e62863d6ec34e7ec696fe203d9fcf99abbbbd7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PhpTags
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to