Manual talk:$wgForeignFileRepos

Using files from Wikimedia Commons
I followed Manual:$wgForeignFileRepos but the wiki goes blank when I hit preview or submit with an image tag that doesn't exist in the wiki (and presumably the wiki will attempt to find for it on commons). I am using MediaWiki 1.13.3. Example: (removed) Why would this be? --Yonghokim 17:59, 20 January 2009 (UTC)
 * As stated on the page, it requires PHP 5.2.0 or greater, you seem to have only PHP 5.1.6. i Alex  19:44, 20 January 2009 (UTC)
 * I upgraded to PHP 5.2 and it works. Thank you! --Yonghokim 00:58, 21 January 2009 (UTC)

Using files from a local folder : FSRepo
I followed the instruction on the page and I am using Php 5.2. I digged a bit into the code and it seems that GroupRepo does not see the foreign repository. Any idea what is going wrong here? 08:09, 10 June 2009 (UTC) Andreas

EXIF errors
We're running MediaWiki 1.14.0 and PHP 5.2 and everything works just fine except when viewing the images. PHP Warnings are generated: http://pastebin.vanonymous.org/pastebin.php?show=8 The page loads fine, however when attempting to view the metadata table the info doesn't exist. Forgott3n 09:25, 2 March 2009 (UTC)

Similar error
@ http://wikademia.org/File:Coffee_at_King's_Road_Café.jpg I get the error: "Warning: preg_match expects parameter 2 to be string, array given in..."

This only appears on some images. For example:

http://wikademia.org/File:Haeckel_Florideae_Chondrus_crispus.png

That image does not display the error.

Any help would be appreciated. Thank you.
 * I get the same error here but not here. Is this problem related to the PNGs or does somebody experience it for other image formats ? --PiRK 02:43, 25 May 2009 (UTC)

Inline display of commons-Media
Hi,

I am Lars one of the administrators of the german PflegeWiki. In our Wiki the question for displaying images from the commons inline in our articles. I found the $wgForeignFileRepos as you see and now I have a question before defining the variable. Will the variable override the def's for images (we have a pool for sharing images with the english NursingWiki)? How will the System decide wich repo to use? Is there a different tag? We're using Bild: and/or Image:. We would be very happy if someone would takt care of our problems... Greets and thanks in advance, --Bruder Lars 06:46, 25 August 2009 (UTC)

Cannot redeclare class HttpRequest
Upgrading to 16.0 lead to
 * Fatal error: Cannot redeclare class HttpRequest in / /public_html/priv/includes/HttpFunctions.php on line 122

when trying to upload any file. Commenting out the piece in LocalSettings.php below resolved it: $wgForeignFileRepos[] = array(  'class'                   => 'ForeignAPIRepo',   'name'                    => 'shared',   'apibase'                 => 'http://commons.wikimedia.org/w/api.php',   'fetchDescription'        => true, // Optional   'descriptionCacheExpiry'  => 43200, // 12 hours, optional   'apiThumbCacheExpiry'     => 43200, // 12 hours, optional, but required for local thumb caching ); Don't know why but uploading is functioning again. Arent 15:35, 20 August 2010 (UTC)
 * This was fixed in 76566. Bawolff 07:56, 12 November 2010 (UTC)

FSRepo
Is FSRepo a working functionality? I am trying to display images from a local folder without uploading them into the wiki. But UnregisteredLocalFile.php does not seem to be fully functional yet. I would like to display images on the wiki, but maintaining their original folder structure in the file system, any ideas?--Xavier Atero 09:41, 7 June 2011 (UTC)


 * Answering my own questions, in case someone finds this useful:
 * Yes, FSRepo is a working functionality
 * There is a way to display images on the wiki maintaining their original folder structure in the file system, although it is pretty ugly.

For the FSRepo to work:

 * 'hashLevels' must be 0
 * 'directory' has to be visible from the web
 * 'url' has to be the url that points to 'directory'
 * the files contained in the folder should NOT:
 * have the first character in lowercase
 * contain any blank spaces in the name
 * The reason is that MediaWiki will capitalize the first character and will replace blank spaces by underscores _.


 * LocalSettings.php should contain the FSRepo definition:


 * where 'http://www.my_wiki.com/media' has to point to '/home/my_user/public_html/wiki/media'


 * The file system would look something like this:

home |-- public_html |-- wiki |-- media |-- Picture_1.jpg |-- Picture_2.jpg +-- Picture_3.jpg
 * -- my_user


 * And the call from the page:



To display images on the wiki maintaining their original folder structure in the file system

 * I guess that it can be accomplished by defining multiple FSRepos in LocalSettings.php. But I had files with same names in different folders, which creates conflicts between the different repositories. And my folder structure will grow, which implies constant modifications to LocalSettings.php
 * I wanted only one FSRepo and to have the relative path associated with the image.


 * The folder structure looks like this:

home |-- public_html |-- wiki |-- media |-- 00-photos |-- 2009_Irvine |-- Picture_1.jpg |-- Picture_2.jpg +-- Picture_3.jpg |-- 2011_Barcelona |-- Picture_1.jpg |-- Picture_2.jpg +-- Picture_3.jpg
 * -- my_user


 * and the page like this:


 * The fast (but dirty) way to make it work is to rawurldecode the src attribute in includes/media/MediaTransformOutput.php toHtml function:


 * Of course this will break all the files in the other repositories that contained special characters. This problem can be restricted by checking that the url contains 00-photos (in this case) before doing the rawurldecode or by checking that the file comes from FSRepo.
 * Note: I named my directory 00-photos so I do not have to worry about MediaWiki changing the first character to uppercase.--Xavier Atero 13:29, 8 June 2011 (UTC)

Fallback
Does this let you specify a primary repo and a secondary repo in case the file doesn't exist at the primary repo? Leucosticte (talk) 09:20, 11 November 2013 (UTC)
 * I don't know if there is a true "fallback" mechanism, but I know that wiki uses or used to use both Commons and it.wiki as foreign repos. --Nemo 09:25, 11 November 2013 (UTC)

"For all core repos"
The section name "For all core repos" feels ambiguous to me. Is it referring to "The core repository classes are LocalRepo, ForeignDBRepo, FSRepo and ForeignAPIRepo" or something else? John Vandenberg (talk) 09:23, 17 June 2015 (UTC)

Confusion ForeignDBRepoViaLB or ForeignDBViaLBRepo?
I guess it’s the latter:, right? Because at the end of section “Using files from a database that you can access : ForeignDBRepo” it documents ForeignDBRepoViaLB but as far as I see in  (MW 1.26) there is no ForeignDBRepoViaLB.php but a ForeignDBViaLBRepo.php --Andreas P.  16:12, 1 February 2016 (UTC)

How to disable both transformVia404 and wgGenerateThumbnailOnParse when using ForeignDBRepo??
Hi guys, I got my files all uploaded to a commons wiki, and access those file on other wikis via ForeignDBRepo as following. Although all wiki share a same DB with different name, they are on different machine where access to files on commonswiki are impossible. I tried to comment out thumbScriptUrl & transformVia404 = false. Then I get thumbnail generating error.

Following settings work, but using thumb.php is buggy and slow. I want other wiki generate thumb url like this: https://commonswiki.org/commons/thumb/1/1f/filename.jpg/200px-filename.jpg directly. To make this clear, I need the solution to generate right url without thumb.php or attempts on generate thumbnails of image. I have all the rest part done expect the URL.

$wgGenerateThumbnailOnParse = false; $wgForeignFileRepos[] = array(   'class' => 'ForeignDBRepo',    'name' => 'commonswiki',    'directory' => '/tmp', //NO, OTHER WIKIS DOES NOT HAVE ACCESS TO THE COMMONS' FILE THOUGH DIRECTORY!!!    'url' => 'https://static.commonswiki.org/common',    'thumbScriptUrl' => 'https://commonswiki.org/thumb.php',    //'transformVia404' => false,     'dbType' => $wgDBtype,    'dbServer' => $wgDBserver,    'dbUser' => $wgDBuser,    'dbPassword' => $wgDBpassword,    'dbName' => 'commonswiki',    'hasSharedCache' => false,    'descBaseUrl' => 'https://commonswiki.org/File:',    'fetchDescription' => false );

Empty server array given to LoadBalancer??
I tried to set wgForeignFileRepos with the 'class' => 'ForeignDBViaLBRepo'. This settings should get Server info from $wgLBFactoryConf. But it actually return me an error: "InvalidArgumentException from line 371 of /includes/libs/rdbms/loadbalancer/LoadBalancer.php: Empty server array given to LoadBalancer". What's wrong? --Zoglun (talk) 04:17, 24 December 2017 (UTC)