MediaWiki Extension: CloudStorage

From TYO Lab Wiki
Revision as of 07:20, 17 December 2015 by Admin (Talk | contribs) (Created page with "{{TNT|Extension | status = stable | type = filerepo | author = [ TYO Lab] | image = | imagesize = | version...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


'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.


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
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:



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:

# 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 = "//"; // 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;
if (!$wgRunOnNonGae) {
	$wgCloudStorageBucket = "YOUR BUCKET NAME"; // 
	require_once( "$IP/extensions/CloudStorage/CloudStorage.php" );
        $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


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


Please email your questions and suggestions to support at