From e37ac151a9e15fecd18f399e1d2cfa30b2fe13a6 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 11 Apr 2006 19:53:38 +0000 Subject: [PATCH] Use a separate query group for commons. --- includes/Image.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/Image.php b/includes/Image.php index 9d23e95c9c..5ac3bad888 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -330,8 +330,9 @@ class Image # capitalize the first letter of the filename before # looking it up in the shared repository. $name = $wgContLang->ucfirst($this->name); + $dbc =& wfGetDB( DB_SLAVE, 'commons' ); - $row = $dbr->selectRow( "`$wgSharedUploadDBname`.{$wgSharedUploadDBprefix}image", + $row = $dbc->selectRow( "`$wgSharedUploadDBname`.{$wgSharedUploadDBprefix}image", array( 'img_size', 'img_width', 'img_height', 'img_bits', 'img_media_type', 'img_major_mime', 'img_minor_mime', 'img_metadata' ), @@ -419,7 +420,6 @@ class Image wfProfileIn( $fname ); $this->loadFromFile(); - $dbw =& wfGetDB( DB_MASTER ); if ( $this->fromSharedDirectory ) { if ( !$wgSharedUploadDBname ) { @@ -429,7 +429,10 @@ class Image // Write to the other DB using selectDB, not database selectors // This avoids breaking replication in MySQL + $dbw =& wfGetDB( DB_MASTER, 'commons' ); $dbw->selectDB( $wgSharedUploadDBname ); + } else { + $dbw =& wfGetDB( DB_MASTER ); } $this->checkDBSchema($dbw); -- 2.20.1