Merge "DatabaseMssql: Don't duplicate body of makeList()"
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index 9985c36..3a31b2a 100644 (file)
@@ -1045,6 +1045,7 @@ abstract class ApiBase extends ContextSource {
         * @param string $token Supplied token
         * @param array $params All supplied parameters for the module
         * @return bool
+        * @throws MWException
         */
        final public function validateToken( $token, array $params ) {
                $tokenType = $this->needsToken();
@@ -1294,6 +1295,7 @@ abstract class ApiBase extends ContextSource {
         * @since 1.23
         * @param Status $status
         * @return array Array of code and error string
+        * @throws MWException
         */
        public function getErrorFromStatus( $status ) {
                if ( $status->isGood() ) {
@@ -2179,6 +2181,10 @@ abstract class ApiBase extends ContextSource {
         * Profiling: total module execution time
         */
        private $mTimeIn = 0, $mModuleTime = 0;
+       /** @var ScopedCallback */
+       private $profile;
+       /** @var ScopedCallback */
+       private $dbProfile;
 
        /**
         * Get the name of the module as shown in the profiler log
@@ -2203,7 +2209,7 @@ abstract class ApiBase extends ContextSource {
                        ApiBase::dieDebug( __METHOD__, 'Called twice without calling profileOut()' );
                }
                $this->mTimeIn = microtime( true );
-               wfProfileIn( $this->getModuleProfileName() );
+               $this->profile = Profiler::instance()->scopedProfileIn( $this->getModuleProfileName() );
        }
 
        /**
@@ -2222,7 +2228,7 @@ abstract class ApiBase extends ContextSource {
 
                $this->mModuleTime += microtime( true ) - $this->mTimeIn;
                $this->mTimeIn = 0;
-               wfProfileOut( $this->getModuleProfileName() );
+               Profiler::instance()->scopedProfileOut( $this->profile );
        }
 
        /**
@@ -2269,7 +2275,8 @@ abstract class ApiBase extends ContextSource {
                        ApiBase::dieDebug( __METHOD__, 'Called twice without calling profileDBOut()' );
                }
                $this->mDBTimeIn = microtime( true );
-               wfProfileIn( $this->getModuleProfileName( true ) );
+
+               $this->dbProfile = Profiler::instance()->scopedProfileIn( $this->getModuleProfileName( true ) );
        }
 
        /**
@@ -2289,7 +2296,7 @@ abstract class ApiBase extends ContextSource {
 
                $this->mDBTime += $time;
                $this->getMain()->mDBTime += $time;
-               wfProfileOut( $this->getModuleProfileName( true ) );
+               Profiler::instance()->scopedProfileOut( $this->dbProfile );
        }
 
        /**