From be70c2e9da06f473775b6c7efec7e39b06f05f84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Wed, 13 Jul 2005 15:35:22 +0000 Subject: [PATCH] Some shared upload fixes --- RELEASE-NOTES | 1 + includes/DefaultSettings.php | 2 ++ includes/Image.php | 4 ++-- includes/ImagePage.php | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fda0cec120..b08f27b7c8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -569,6 +569,7 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new. * Optional parameters for [[Special:Listusers]] * (bug 2832) [[Special:Listadmins]] redirects to [[Special:Listusers/sysop]] * (bug 785) Parser did not get out of
 with list elements
+* Some shared upload fixes
 
 === Caveats ===
 
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 9f4971eb0c..520f8a4094 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -259,6 +259,8 @@ $wgFetchCommonsDescriptions = false;
 $wgSharedUploadDirectory = "/var/www/wiki3/images";
 /** DB name with metadata about shared directory. Set this to false if the uploads do not come from a wiki. */
 $wgSharedUploadDBname = false;
+/** Optional table prefix used in database. */
+$wgSharedUploadDBprefix = '';
 /** Cache shared metadata in memcached. Don't do this if the commons wiki is in a different memcached domain */
 $wgCacheSharedUploads = true;
 
diff --git a/includes/Image.php b/includes/Image.php
index 2812f47336..75d85906b7 100644
--- a/includes/Image.php
+++ b/includes/Image.php
@@ -306,7 +306,7 @@ class Image
 	 * Load image metadata from the DB
 	 */
 	function loadFromDB() {
-		global $wgUseSharedUploads, $wgSharedUploadDBname, $wgLang;
+		global $wgUseSharedUploads, $wgSharedUploadDBname, $wgSharedUploadDBprefix, $wgLang;
 		$fname = 'Image::loadFromDB';
 		wfProfileIn( $fname );
 		
@@ -333,7 +333,7 @@ class Image
 			# looking it up in the shared repository.
 			$name = $wgLang->ucfirst($this->name);
 
-			$row = $dbr->selectRow( "`$wgSharedUploadDBname`.image", 
+			$row = $dbr->selectRow( "`$wgSharedUploadDBname`.{$wgSharedUploadDBprefix}image",
 				array( 
 					'img_size', 'img_width', 'img_height', 'img_bits', 
 					'img_media_type', 'img_major_mime', 'img_minor_mime', 'img_metadata' ),
diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index d8c0b8cc12..5808580952 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -258,6 +258,7 @@ class ImagePage extends Article {
 		$wgOut->addWikiText($sharedtext);
 
 		if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
+			require_once("HttpFunctions.php");
 			$ur = ini_set('allow_url_fopen', true);
 			$text = wfGetHTTP($url . '?action=render');
 			ini_set('allow_url_fopen', $ur);
-- 
2.20.1