Extension:CloudStorage

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
CloudStorage

Release status:Extension status stable

ImplementationTemplate:Extension#type File repository
DescriptionTemplate:Extension#description Provides an option of storing media files in the cloud
Author(s)Template:Extension#username TYO Lab
Latest versionTemplate:Extension#version 0.9 (2015-12-17)
MediaWikiTemplate:Extension#mediawiki 1.21.0 or higher
PHPTemplate:Extension#php 5.5 or above
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#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.

Usage[edit]

MediaWiki On GAE Settings[edit]

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 Settings[edit]

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

Debug[edit]

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

Acknowledgement[edit]

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 Also[edit]

Running MediaWiki On Google App Engine

Support[edit]

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