Open main menu

Extension:CloudStorage

MediaWiki extensions manual
OOjs UI icon advanced.svg
CloudStorage
Release status: stable
Implementation File repository
Description Provides an option of storing media files in the cloud
Author(s) TYO Lab
Latest version 0.9 (2015-12-17)
MediaWiki 1.21.0+
PHP 5.5+
Database changes No
License GNU General Public License 2.0 or later
Download
README
Translate the CloudStorage extension if it is available at translatewiki.net
Check usage and version matrix.

CloudStorage is an extension for allowing storing media files (images, videos, ...) in the cloud such as Google Cloud Storage, particularly when MediaWiki is hosted on Google App Engine. Please note the current implementation of this extension only works with the modified version of MediaWiki.

Contents

UsageEdit

MediaWiki On GAE SettingsEdit

If you decide to run your Wiki on Google App Engine and would like to make use of its Cloud Storage, please first get a latest copy of supported version of MediaWiki On GAE as showed below.

git clone https://github.com/tyolab/mediawiki-on-gae.git
cd mediawiki-on-gae
git submodule update

Edit the GoogleappEngineSettings.php under the mediawiki-on-gae directory, and add:

$wgGaeAppId = 'Google App Engine ID';
$wgGaeInstanceName = 'Google Cloud SQL Instance Name';

CloudStorage Extension SettingsEdit

And add the following code to your LocalSettings.php file:

# CloudStorage
$wgCloudStorageBucket = 'YOUR BUCKET NAME';

# Optional
$wgCloudStorageDirectory = 'images';

require_once "$IP/extensions/CloudStorage/CloudStorage.php";

Please make sure that you specify the cloud storage bucket name before loading the extension. Setting $wgCloudStorageDirectory is optional.

For Google Cloud Storage, you will be able to check your bucket by running the following command:

gsutil ls gs://BUCKET/IMAGES-FOLDER

DebugEdit

When you try to debug your Wiki locally with either Apache or Google Development Server, you can switch the CloudStorage to local file system. To do so, please add following code in your LocalSettings.php file:

$ev = $_SERVER["SERVER_SOFTWARE"];

# determine whether we are running on Google App Engine
$wgRunOnGae = false;
$wgRunOnLocalGae = false;
$wgRunOnNonGae = true; // could be the local apache server, or the Google App Engine development server

$wgServer = "http://localhost";

if (isset($ev)) {
	if (strpos($ev,'Google App Engine') !== false) {
	  $wgRunOnGae = true;
	  $wgRunOnNonGae = false;

	  $wgServer = "//wiki.tyolab.com"; // please update this line to match your domain name
	  $wgArticlePath = "$wgScriptPath/$1";
	}
	elseif (strpos($ev,'Development')  !== false )  {
          $wgServer = "http://localhost:8080";

	  $wgRunOnLocalGae = true;
	  $wgRunOnNonGae = false;
	  $wgRunOnGae = false;
	}
}

/* OPTIONAL */
if (!$wgRunOnNonGae) {
	$wgCloudStorageBucket = "YOUR BUCKET NAME";
	require_once( "$IP/extensions/CloudStorage/CloudStorage.php" );
}
else
        $wgUseGoogleStorage = false; // I want to use local file system for images
                                     // change to true to use cloud storage, you still can,
                                     // but you have to use Google Development Server,
                                     // and image link will return null content

AcknowledgementEdit

The Amazon S3 Service as File Repo is forked from: Extension:LocalS3Repo it may not work as the code was refactored a lot and weren't tested at all.

See AlsoEdit

SupportEdit

Please email your questions and suggestions to support at tyo.com.au.