X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdb%2FDatabase.php;h=27e6dadb06304beea286f464734064bf46084593;hb=fc63d1567acaff261104cd61288b650e902d87dc;hp=623010f2eae04ca849393a607c661f63152c4014;hpb=ba0f72b8a0f796dca101f53deaad4ecc3290013d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/Database.php b/includes/db/Database.php index 623010f2ea..27e6dadb06 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -882,22 +882,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { * for a successful read query, or false on failure if $tempIgnore set */ public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) { - $isMaster = !is_null( $this->getLBInfo( 'master' ) ); - if ( !Profiler::instance()->isStub() ) { - # generalizeSQL will probably cut down the query to reasonable - # logging size most of the time. The substr is really just a sanity check. - - if ( $isMaster ) { - $queryProf = 'query-m: ' . substr( DatabaseBase::generalizeSQL( $sql ), 0, 255 ); - $totalProf = 'DatabaseBase::query-master'; - } else { - $queryProf = 'query: ' . substr( DatabaseBase::generalizeSQL( $sql ), 0, 255 ); - $totalProf = 'DatabaseBase::query'; - } - - wfProfileIn( $totalProf ); - wfProfileIn( $queryProf ); - } + global $wgUser, $wgDebugDBTransactions; $this->mLastQuery = $sql; if ( !$this->mDoneWrites && $this->isWriteQuery( $sql ) ) { @@ -907,7 +892,6 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { } # Add a comment for easy SHOW PROCESSLIST interpretation - global $wgUser; if ( is_object( $wgUser ) && $wgUser->isItemLoaded( 'name' ) ) { $userName = $wgUser->getName(); if ( mb_strlen( $userName ) > 15 ) { @@ -931,7 +915,6 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { # is really used by application $sqlstart = substr( $sql, 0, 10 ); // very much worth it, benchmark certified(tm) if ( strpos( $sqlstart, "SHOW " ) !== 0 && strpos( $sqlstart, "SET " ) !== 0 ) { - global $wgDebugDBTransactions; if ( $wgDebugDBTransactions ) { wfDebug( "Implicit transaction start.\n" ); } @@ -946,6 +929,21 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { Profiler::instance()->transactionWritingIn( $this->mServer, $this->mDBname ); } + $isMaster = !is_null( $this->getLBInfo( 'master' ) ); + if ( !Profiler::instance()->isStub() ) { + # generalizeSQL will probably cut down the query to reasonable + # logging size most of the time. The substr is really just a sanity check. + if ( $isMaster ) { + $queryProf = 'query-m: ' . substr( DatabaseBase::generalizeSQL( $sql ), 0, 255 ); + $totalProf = 'DatabaseBase::query-master'; + } else { + $queryProf = 'query: ' . substr( DatabaseBase::generalizeSQL( $sql ), 0, 255 ); + $totalProf = 'DatabaseBase::query'; + } + wfProfileIn( $totalProf ); + wfProfileIn( $queryProf ); + } + if ( $this->debug() ) { static $cnt = 0; @@ -1607,7 +1605,8 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { $sql = preg_replace( '/\s+/', ' ', $sql ); # All numbers => N - $sql = preg_replace( '/-?[0-9]+/s', 'N', $sql ); + $sql = preg_replace( '/-?\d+(,-?\d+)+/s', 'N,...,N', $sql ); + $sql = preg_replace( '/-?\d+/s', 'N', $sql ); return $sql; }