MediaWiki and Windows Azure storage
How do I use MediaWiki Windows Azure Storage extension with Windows Azure Websites?
The required extensions for the Windows Azure Storage are already included in the package. You don't need to do any manual operations to get the Windows Azure Storage extensions.
How can I enter the Windows Azure Storage settings at the time of installation?
In the "Configure Your App" step of your MediaWiki installation, you can see the corresponding fields to enter your Windows Azure Storage settings.
In the dialog select "Enable MediaWiki file upload" and "Use Windows Azure as file backend" to True, provide the azure host, your storage account name and private key.
Finally in the "Wiki ID (Prefix to container names that is unique to this wiki)" dialog you need to provide a unique string that identifies the wiki.
Note: The Wiki ID value is used as the prefix to Windows Azure storage container names. So this value should follow Windows Azure storage container naming conventions.
The following are the naming rules:
- This value must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
- Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted.
- All letters in this value must be lowercase.
- This prefix to container names must be from 3 through 30 characters long.
How can I edit the Windows Azure Storage settings after installation?
You can find the Windows Azure Storage settings in ./LocalSettings.php file. The following are the configuration parameters for the Windows Azure storage.
$wgFileBackends = array( 'name' => 'azure-backend', 'class' => 'WindowsAzureFileBackend', 'lockManager' => 'nullLockManager', 'azureHost' => '<your-azure-server>', 'azureAccount' => '<your-azure-storage-service-account>', 'azureKey' => '<your-azure-accounts-accesskey>', //IMPORTANT: Mind the container naming conventions! http://msdn.microsoft.com/en-us/library/dd135715.aspx 'wikiId' => '<your-unique-wiki-id>', 'containerPaths' => array( 'media-public' => 'media-public', 'media-thumb' => 'media-thumb', 'media-deleted' => 'media-deleted', 'media-temp' => 'media-temp', ) ); $wgLocalFileRepo = array ( 'class' => 'LocalRepo', 'name' => 'local', 'scriptDirUrl' => '/mediawiki-filebackend-azure', 'scriptExtension' => '.php', 'url' => $wgScriptPath.'/img_auth.php', // It is important to set this to img_auth. Basically, there is no alternative. 'hashLevels' => 2, 'thumbScriptUrl' => false, 'transformVia404' => false, 'deletedHashLevels' => 3, 'backend' => 'azure-backend', 'zones' => array ( 'public' => array ( 'container' => 'local-public', 'directory' => '', ), 'thumb' => array( 'container' => 'local-public', 'directory' => 'thumb', ), 'deleted' => array ( 'container' => 'local-public', 'directory' => 'deleted', ), 'temp' => array( 'container' => 'local-public', 'directory' => 'temp', ) ) ); $wgImgAuthPublicTest = false;
You can use WebMatrix or any FTP client to connect to your web site and edit LocalSettings.php file. The FTP hostname and user name are shown on your website dashboard.
See Create and deploy a PHP-MySQL Windows Azure Website using WebMatrix for more information.
Open the /mediawiki/LocalSettings.php file, and replace the values of 'azureHost', 'azureAccount', 'azureKey', and 'wikiId' in the $wgFileBackends array with the correct values for your new storage details. The 'wikiId' value is used as the prefix to Windows Azure storage container names. Make sure that it follows Windows Azure storage container naming conventions. For ex: if your wikiId value is 'mywiki', the full container name would be 'mywiki-local-public'.
How to use different Windows Azure storage settings for local and remote site?
Assuming you have a MediaWiki site running already in your local environment with the MediaWiki file upload and windows azure storage enabled.
Open the MediaWiki site in WebMatrix and click Files:
Double click the LocalSettings.php file to edit the windows azure storage details.
By default the LocalSettings.php file is protected against any modifications because it's a core file of the MediaWiki application. So when you start typing anything in the file you can see a warning prompted as shown below:
Click OK to turn off the WebMatrix file protection.
Scroll down and replace the values of 'azureHost', 'azureAccount', 'azureKey', and 'wikiId' in the $wgFileBackends array with the correct values for your new azure storage details.
Be sure to save the LocalSettings.php file.
Now manually copy the contents of your storage container which you were using in the local environment to the new container which you will be using in the remote Windows Azure Website.
Once the syncing is completed you are ready to publish to remote Windows Azure Website.
There is a step-by-step tutorial on http://www.windowsazure.com that walks you through creating and deploying a PHP-MySQL Windows Azure Website using WebMatrix.