X-Git-Url: http://git.cyclocoop.org/ecrire?a=blobdiff_plain;f=includes%2Fdb%2FDatabase.php;h=8b56ab0ba8b12eae79c44b986cf98b0bf7a06385;hb=af154bea2bd58112674c4dd71acc396152ab3653;hp=3072bfd5d8dccf951fca7090be863b6c6363c07b;hpb=ec0cfb13c053eedf9b5b18074b3a9bf4c8d1b307;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/db/Database.php b/includes/db/Database.php index 3072bfd5d8..8b56ab0ba8 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -236,6 +236,7 @@ abstract class DatabaseBase implements DatabaseType { protected $mTablePrefix; protected $mFlags; + protected $mForeign; protected $mTrxLevel = 0; protected $mErrorCount = 0; protected $mLBInfo = array(); @@ -660,9 +661,10 @@ abstract class DatabaseBase implements DatabaseType { * @param string $dbName database name * @param $flags * @param string $tablePrefix database table prefixes. By default use the prefix gave in LocalSettings.php + * @param bool $foreign disable some operations specific to local databases */ function __construct( $server = false, $user = false, $password = false, $dbName = false, - $flags = 0, $tablePrefix = 'get from global' + $flags = 0, $tablePrefix = 'get from global', $foreign = false ) { global $wgDBprefix, $wgCommandLineMode, $wgDebugDBTransactions; @@ -689,6 +691,8 @@ abstract class DatabaseBase implements DatabaseType { $this->mTablePrefix = $tablePrefix; } + $this->mForeign = $foreign; + if ( $user ) { $this->open( $server, $user, $password, $dbName ); } @@ -738,7 +742,8 @@ abstract class DatabaseBase implements DatabaseType { isset( $p['password'] ) ? $p['password'] : false, isset( $p['dbname'] ) ? $p['dbname'] : false, isset( $p['flags'] ) ? $p['flags'] : 0, - isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global' + isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global', + isset( $p['foreign'] ) ? $p['foreign'] : false ); } else { return null; @@ -945,14 +950,6 @@ abstract class DatabaseBase implements DatabaseType { wfDebug( "Query {$this->mDBname} ($cnt) ($master): $sqlx\n" ); } - if ( istainted( $sql ) & TC_MYSQL ) { - if ( !Profiler::instance()->isStub() ) { - wfProfileOut( $queryProf ); - wfProfileOut( $totalProf ); - } - throw new MWException( 'Tainted query found' ); - } - $queryId = MWDebug::query( $sql, $fname, $isMaster ); # Do the query and handle errors @@ -2076,6 +2073,7 @@ abstract class DatabaseBase implements DatabaseType { } else { list( $table ) = $dbDetails; if ( $wgSharedDB !== null # We have a shared database + && $this->mForeign == false # We're not working on a foreign database && !$this->isQuotedIdentifier( $table ) # Paranoia check to prevent shared tables listing '`table`' && in_array( $table, $wgSharedTables ) # A shared table is selected ) {