RESOLVED $wgUseSharedUploads causes trouble

Jump to: navigation, search

Hi...

I'm running four interwikis sharing one pool wiki for the media files. After upgrading from 1.16 to 1.17 I'm getting an error, when I set $wgUseSharedUploads = true; in the LocalSettings.php of each interwiki.

Here is the error:

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null
given in /html/wiki/en/w/includes/db/DatabaseMysql.php on line 318

Warning: mysql_real_escape_string() expects parameter 2 to be resource, null
given in /html/wiki/en/w/includes/db/DatabaseMysql.php on line 318

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in
/html/wiki/en/w/includes/db/DatabaseMysql.php on line 23

A database query syntax error has occurred. This may indicate a bug in the
software. The last attempted database query was: 
BEGIN
from within function "DatabaseBase::begin". Database returned error "0: ". 

Debug data:
Start request 

GET /wiki/Main_Page 
HTTP HEADERS: 
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png,
image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 
Accept-Encoding: gzip, deflate 
Accept-Language: en,de;q=0.9,de-DE;q=0.8 
Cache-Control: no-cache 
Connection: Keep-Alive 
Cookie: database_3UserID=1; database_3UserName=Till+Kraemer;
database_3Token=1d8916427743c36ef3936c5f20a8c9e3; awc_startTime=20110814185359;
database_3_session=2bauhg71ti53lp57pfhqage6q2;
__utma=162725736.456536178.1297683604.1313346115.1313410956.169;
__utmb=162725736.37.10.1313410956; __utmc=162725736;
__utmz=162725736.1313410956.169.53.utmcsr=pool.domain.com|utmccn=(referral)|utmcmd=referral|utmcct=/wiki/Main_Page 
Host: en.domain.com 
Referer: http://en.domain.com/wiki/Till_Kraemer 
User-Agent: Opera/9.80 (Windows NT 6.1; U; en) Presto/2.9.168 Version/11.50 

CACHES: APCBagOStuff[main] APCBagOStuff[message] FakeMemCachedClient[parser] 
Unstubbing $wgParser on call of $wgParser::setFunctionHook from
SimpleSecurity::__construct 
Unstubbing $wgOut on call of $wgOut::_unstub from wfDebug 
Unstubbing $wgContLang on call of $wgContLang::getMagic from MagicWord::load 
LocalisationCache: using store LCStore_DB 
Unstubbing $wgMessageCache on call of $wgMessageCache::get from wfMsgGetKey 
Unstubbing $wgLang on call of $wgLang::getCode from MessageCache::get 
User: got user 1 from cache 
Connecting to 111.222.333.444 database_3... 
Connected to 111.222.333.444 database_3. 
User: loading options for user 1 from override cache. 
User: logged in from session 
User: loading options for user 1 from override cache. 
MessageCache::load: Loading en... got from global cache 
Use of MessageCache::addMessages is deprecated. [Called from
call_user_func_array in (internal function)] 
Use of MessageCache::addMessage is deprecated. [Called from setupSEOParserHooks
in /html/wiki/en/w/extensions/Add_HTML_Meta_and_Title.php at line 57] 
Fully initialised 
Title::getRestrictionTypes: applicable restriction types for Main Page are
edit,move,readOutputPage::checkLastModified: CACHE DISABLED 
User::isBlockedFrom: enter 
User::isBlockedFrom: asking isBlocked() 
User::isBlocked: enter 
User::getBlockedStatus: checking... 
IP: 555.666.777.888 
Block::load: '', '1', 1 
Article::view using parser cache: no 
Class SkinMonobook not found; skipped loading 
Article::view: doing uncached parse 
User::isBlockedFrom: enter 
User::isBlockedFrom: asking isBlocked() 
User::isBlocked: enter 
User::getBlockedStatus: already loaded. 
SiteStats::loadAndLazyInit: reading site_stats from slave 
SQL ERROR: 
User::isBlockedFrom: enter 
User::isBlockedFrom: asking isBlocked() 
User::isBlocked: enter 
User::getBlockedStatus: already loaded. 
Title::getRestrictionTypes: applicable restriction types for Main Page are
edit,move,read

It's very brutal, because no images show up, except for the pool wiki. I'm about to try MW 1.18 alpha, because I have no idea how to fix this and I really need the images.

Any help is more than appreciated!

Thanks + cheers,

Till Kraemer19:48, 16 August 2011

P.S.: Is it possible to downgrade from 1.17 to 1.16? And if so, do I have to change the databases in some way?

Till Kraemer05:53, 17 August 2011
 

If needed I could walk you through on how to use it, but it's probably easiest to use $wgForeignFileRepos since the SharedUploads method has been deprecated (although it should still work).

You may also come by on IRC to ask for help.

Krinkle17:32, 24 August 2011

Thanks for your help!

I added the following to LocalSettings.php:

$wgForeignFileRepos[] = array(
    'class' => 'ForeignDBRepo',
    'name' => 'pool',
    'url' => "http://pool.domain.com/w/images",
    'directory' => '/html/wiki/pool/w/images/',
    'hashLevels' => 2, // This must be the same for the other family member
    'dbType' => $wgDBtype,
    'dbServer' => $wgDBserver,
    'dbUser' => $wgDBuser,
    'dbPassword' => $wgDBpassword,
    'dbFlags' => DBO_DEFAULT,
    'dbName' => 'pool_db_username',
    'tablePrefix' => '',
    'hasSharedCache' => false,
    'descBaseUrl' => 'http://pool.domain.com/w/index.php/Image:',
    'fetchDescription' => false
);

...and ended up getting the same error :(

I also tried to use LocalRepo:

$wgForeignFileRepos[] = array(
   'class'                    => 'LocalRepo',
   'name'                     => 'pool',
   'url'                      => 'http://pool.domain.com/w/images',
   'hashLevels'               => 2, // This must be the same for the other family member
   'pathDisclosureProtection' => 'paranoid',
   'descBaseUrl'              => 'http://pool.domain.com/wiki/Image:',
   'scriptDirUrl'             => 'http://pool.domain.com/w',
   'fetchDescription'         => true, // Optional
);

...but no images showed up :|

I'm gonna try to find you on #MediaWiki.

Thanks + cheers,

Till Kraemer09:32, 27 August 2011

This is my config. and it works perfectly. Hope this helps.

$wgForeignFileRepos[] = array(
   'class'                   => 'ForeignAPIRepo',
   'name'                    => 'shared',
   'apibase'                 => 'http://You're site.whereever/w/api.php',
   'fetchDescription'        => true, // Optional
   'descriptionCacheExpiry'  => 43200, // 12 hours, optional (values are seconds)
   'apiThumbCacheExpiry'     => 43200, // 12 hours, optional, but required for local thumb caching
);
Mlpearc powwow17:32, 27 August 2011

I was scared to use ForeignAPIRepo, because it says "Access through ForeignDBRepo is faster than through ForeignAPIRepo", but you're right, it works perfectly. Thanks a lot! Cheers,

Till Kraemer09:24, 28 August 2011

Glad to help.

Mlpearc powwow17:33, 28 August 2011
 
 
 
 
 
Personal tools

Variants
Actions
Navigation
Support
Download
Development
Communication
Toolbox