Extension:WebStore
This extension is obsolete!
|
WebStore Release status: unstable |
|
|---|---|
| Implementation | User interface |
| Description | Web-only (non-NFS) file storage middleware. It is needed by the ProofreadPage extension. |
| Author(s) | Tim Starling |
| License | Any OSI approved license |
| Download |
SVN [?]:
|
| Check usage and version matrix | |
WebStore is intended to handle images and the generation of thumbnails in a multiple-server environment. It includes a web-server error 404 handler; if a thumbnail is requested that does not already exist on the local server, the request is forwarded to another server so that the thumbnail image may be automatically generated.
Communication between the multiple servers is based on WWW protocols (http) only.
The WebStore extension is needed by the ProofreadPage extension. Unfortunately, documentation seems to be missing completely. Please add anything you know about this extension here.
WebStore extends the FileStore.
Contents |
Installation [edit]
- Copy all the files to
extensions/WebStore - Add
require( "$IP/extensions/WebStore/WebStore.php" );to your LocalSettings.php - WebStore comes with a file called 404-handler.php. To be able to catch 404 events, it needs to be registered as a 404 handler.
Using Apache, adding something likeErrorDocument 404 /extensions/WebStore/404-handler.php
to httpd.conf or to apache2.conf should work.
- by example
The root of your server is configured as following :
DocumentRoot /var/www/
the path of 404-handler.php
/var/www/wiki/extensions/WebStore/404-handler.php
the code will be
ErrorDocument 404 /wiki/extensions/WebStore/404-handler.php
With Apache, an other possibility is to use a rewrite rule. By example, you can add following lines in an Apache configuration file :
RewriteEngine On RewriteRule ^/images/thumb(.*)\.(jpg|jpeg|png|gif)$ /extensions/WebStore/404-handler.php
You should also create a file called simple404.php like this:
<?php class Simple404 extends WebStoreCommon { function execute(){ $this->htmlError( 404, 'webstore_404' ); } } $h = new Simple404; $h->execute();
and add the following line to LocalSettings.php, somewhere below require( "$IP/extensions/WebStore/WebStore.php" );:
$wgWebStoreSettings['fallback404'] = 'simple404.php';
This way, when an image is requested for the first time, it is directly sent to the browser (without sending a 404 status error code before the image file).
Problems and Solutions [edit]
WebStore doesn't work [edit]
A WebStore needs a CURL-module for php. A default configuration in a some systems doesn't containt this module. In this situation you see, for example, a black frame in proofread or nothing instead a thumbnail and a 404-error in an apache logfile for this thumbnail.
If you try to specify the URL of this thumbnail in you browser, you will get, for example,
Fatal error: Call to undefined function curl_init() in /var/www/wiki/extensions/WebStore/WebStorePostFile.php on line 38
Solution:
Install CURL module for php. For example, in Ubuntu
apt-get install php5-curl
and don't forget to restart apache.
A non-Latin characters in a file name [edit]
A WebStore trying to creates temporary file in a directory with encoded name. So, if a file name contains a non-Latin characters that encoded to %xx, that this attempt finish with error webstore_temp_open.
Solution: In file $IP/extensions/WebStore/404-handler.php search string:
$rel = substr( $url, strlen( $thumbBase ) + 1 ); // plus one for slash
and replace it by
$rel = urldecode(substr( $url, strlen( $thumbBase ) + 1 )); // plus one for slash