Extension:FileProtocolLinksLinux

What can this extension do?
If you use Extension:FileProtocolLinks to create links to local Windows shares, Linux and Mac users are not able to follow them.

This extension changes the links according to the client OS from "file:///\\windows_server\folder\to\file.ext" to "smb://windows_server/folder/to/file.ext" All other behaviour from Extension:FileProtocolLinks should remains unchanged.

This is an adaptation/improvement of the Extension:SmbLinks from Daniel Schürmann and of Extension:FileProtocolLinksSMB from Dan Sinclair. The same idea is implemented (detection by user-agent, rewritings of links). The only difference is that it is applied not at the link creation but just before it get displayed. That way it works also with cache activated. Extension:SmbLinks seems broken on the current version of MediaWiki (which is 1.25 as of June 2015). Extension:FileProtocolLinksSMB does not works with cache enable. So this can be considered as a rewriting/update of Daniel Schürmann and Dan Sinclair work.

Usage
The usage is the very same as for Extension:FileProtocolLinks, it just expands its possibility to have it work on Linux (and Mac). Note that it might also slow your wiki a bit due to extra time processing before displaying the page. (I did not notice it...)

MS Windows
On MS Windows machines, the behavior stay just as with the Extension:FileProtocolLinks extension

Firefox
you have to register the smb: protocol handler.  network.protocol-handler.expose.smb = false (Typ: boolean) network.protocol-handler.external.smb = true (Typ: boolean)  select "/usr/bin/xdg-open". This does not mount the location. So ensure sat you have opened the window share with your file application first.
 * Open "about:config" and add the following settings:
 * Next time you click an smb: Link firefox ask you for an application.

This is from the Extension:SmbLinks extension and was not actually tested:
 * For KDE:

we have to make a workaround with a script because Firefox does not allow do add additional parameters

chrome/chromium

 * You will have to confirm that you want to access on local share

Tested with:
 * Client: Firefox 38.0.1 on Debian jessie, Server: centos6.6, Apache/2.2.15, php-fpm/5.5.26, memcached

MAC OS
... TO DO ...

Installation

 * First install Extension:FileProtocolLinks
 * Then add the following to :

"$wgUseFileCache = false;"
 * Be sure to disable file caching, as it create a conflict:
 * Then paste the following code in a new /extensions/FileProtocolLinksLinux.php file.