meza icon indicating copy to clipboard operation
meza copied to clipboard

Consider setting up primewiki as foreign file repo

Open jamesmontalvo3 opened this issue 8 years ago • 1 comments

This would allow using the primewiki like InstantCommons (Wikimedia Commons). To make this work, add the following code:

if ( is_array( $primewiki ) ) {

	$primeWikiId = $primewiki['id'];
	$wgForeignFileRepos[] = array(
		'class' => 'ForeignDBRepo',
		'name' => 'primewikifiles', // any unique name I think
		'url' => "$wgServer/$primeWikiId/img_auth.php",
		'directory' => "/opt/meza/htdocs/wikis/$primeWikiId/images",
		'hashLevels' => 2,
		'dbType' => $wgDBtype,
		'dbServer' => $wgDBserver,
		'dbUser' => $wgDBuser,
		'dbPassword' => $wgDBpassword,
		'dbFlags' => DBO_DEFAULT,
		'dbName' => $primewiki['database'],
		'tablePrefix' => '',
		'hasSharedCache' => false,
		'descBaseUrl' => "$wgServer/$primeWikiId/index.php/File:",
		'fetchDescription' => false
	);

}

Note that these files don't appear to show in searches. I'm not sure if that's an indexing issue (indexing hasn't run on them yet) or by design (e.g. small wikis don't want to be clobbered by Commons).

jamesmontalvo3 avatar Jan 09 '17 20:01 jamesmontalvo3

This worked for me on a modified Meza:

// Set the English wiki to share images with everyone
$wgForeignFileRepos[] = [
        'class' => 'ForeignDBRepo',
        'name' => 'mainwiki',
        'url' => "$wgServer/wiki/en/img_auth.php",
        'directory' => '/opt/data-meza/uploads-gluster/en',
        'hashLevels' => 2, // This must be the same for the other family member
        'dbType' => 'mysql',
        'dbServer' => $wgDBservers[0]['host'],
        'dbUser' => $mezaDatabaseUser,
        'dbPassword' => $mezaDatabasePassword,
        'dbFlags' => DBO_DEFAULT,
        'dbName' => 'wiki_en',
        'tablePrefix' => '',
        'hasSharedCache' => false,
        'descBaseUrl' => "$wgServer/wiki/en/File:",
        'fetchDescription' => false
];

freephile avatar May 04 '19 20:05 freephile