[Mediawiki-l] file upload to pool wiki from wiki family

Laurent laurent.savaete at gmail.com
Sun May 16 22:41:22 UTC 2010


Hi all,

I'm setting up a wiki family in various languages (eng, fra, swe, ...) with all
of them uploading media files to a 'pool' wiki.
I set up the family as explained in scenario 5 here:
http://www.mediawiki.org/wiki/Manual:Wiki_family and it works well for regular
uploads.

Now I am working on an extension that uploads sound files directly without using
Special:Upload, and I still want files to end up in 'pool'.
Unfortunately, I've tried several configs, and the closest I got is where files
physically end up in the 'pool/images' folder, but are still recorded in the
language wiki (like 'eng' for instance).
Relevant code was:
$destFile = wfLocalFile( $mytitle);
$uploadResult = $destFile->upload($myfile, $mysubtitle, $mycomment);

and config common to all wikis:
$wgUseSharedUploads = true;
$wgSharedUploadPath = "$POOL_URL/images";
$wgSharedUploadDirectory = "$POOL_IP/images/";
$wgHashedSharedUploadDirectory = true;
$wgSharedUploadDBname = $wgDBname;
$wgSharedUploadDBprefix = $wgDBprefix;
$wgUploadDirectory = "$POOL_IP/images";

I also have $wgEnableUpload = false in the localised wikis (but not in 'pool').

After this, I changed wfLocalFile to
$destFile = RepoGroup::singleton()->getRepoByName('pool')->newFile( $mytitle )
and defined
$wgForeignFileRepos[] = array(
       'class'            => 'ForeignDBRepo',
       'name'             => 'pool',
       'directory'        => "$POOL_IP/images",
       'url'              => "$POOL_URL/images",
       'hashLevels'       => 2,
       'dbType'           => "mysql",
       'dbServer'         => $wgDBserver,
       'dbUser'           => $wgDBuser,
       'dbPassword'       => $wgDBpassword,
       'dbName'           => "wikidb", # $wgDBname,
       'dbFlags'          => DBO_DEFAULT,
       'tablePrefix'      => "wb",     # $wgDBprefix,
       'thumbScriptUrl'   => false,
       'hasSharedCache'   => false,
       'descBaseUrl'      => "$POOL_URL/Image:",
       'scriptDirUrl'     => "$POOL_IP",
       'fetchDescription' => false,
       'initialCapital'   => true,
);
in place of the above settings.
Then I received an internal error saying ForeignDBRepo does not support write
operations.

So my question is: am I trying to do something that MW does not handle, or am I
doing it the wrong way?

Thanks for any advice,
Laurent




More information about the MediaWiki-l mailing list