// Ignore warnings about master connections/writes...hard to avoid here
$trxProfiler = \Profiler::instance()->getTransactionProfiler();
- $trxProfiler->setSilenced( true );
+ $old = $trxProfiler->setSilenced( true );
try {
$status = $user->addToDatabase();
if ( !$status->isOK() ) {
return $status;
}
} catch ( \Exception $ex ) {
- $trxProfiler->setSilenced( false );
+ $trxProfiler->setSilenced( $old );
$this->logger->error( __METHOD__ . ': {username} failed with exception {exception}', [
'username' => $username,
'exception' => $ex,
$logEntry->insert();
}
- $trxProfiler->setSilenced( false );
+ $trxProfiler->setSilenced( $old );
if ( $login ) {
$this->setSessionDataForUser( $user );
}
/**
- * @param bool $value
+ * @param bool $value New value
+ * @return bool Old value
* @since 1.28
*/
public function setSilenced( $value ) {
+ $old = $this->silenced;
$this->silenced = $value;
+
+ return $old;
}
/**
$cache->makeGlobalKey( __CLASS__, 'server-read-only', $masterServer ),
self::TTL_CACHE_READONLY,
function () use ( $domain, $conn ) {
- $this->trxProfiler->setSilenced( true );
+ $old = $this->trxProfiler->setSilenced( true );
try {
$dbw = $conn ?: $this->getConnection( self::DB_MASTER, [], $domain );
$readOnly = (int)$dbw->serverIsReadOnly();
} catch ( DBError $e ) {
$readOnly = 0;
}
- $this->trxProfiler->setSilenced( false );
+ $this->trxProfiler->setSilenced( $old );
return $readOnly;
},
[ 'pcTTL' => $cache::TTL_PROC_LONG, 'busyValue' => 0 ]
$this->getOutput()->addWikiMsg( 'confirmemail_noemail' );
}
} else {
- $trxProfiler->setSilenced( true );
+ $old = $trxProfiler->setSilenced( true );
$this->attemptConfirm( $code );
- $trxProfiler->setSilenced( false );
+ $trxProfiler->setSilenced( $old );
}
}
$this->checkReadOnly();
$this->checkPermissions();
- $trxProfiler->setSilenced( true );
+ $old = $trxProfiler->setSilenced( true );
$this->attemptInvalidate( $code );
- $trxProfiler->setSilenced( false );
+ $trxProfiler->setSilenced( $old );
}
/**