Jump to content

Topic on Extension talk:WindowsAzureStorage/Archive 2

 WindowsAzure\Blob\Models\ContainerACL/The specified container already exists.

4
Simon Shortman (talkcontribs)

Config from LocalSettings.php:

require_once("$IP/extensions/WindowsAzureSDK/WindowsAzureSDK.php");
require_once("$IP/extensions/WindowsAzureStorage/WindowsAzureStorage.php");

$wgFileBackends[] = array(
    'name'         => 'azure-backend',
    'class'        => 'WindowsAzureFileBackend',
    'lockManager'  => 'nullLockManager',
 	'azureHost'	   => 'https://blob.core.windows.net',
    'azureAccount' => '<my-acct>',
    'azureKey'     => '<my-key>',
	#IMPORTANT: Mind the container naming conventions! http://msdn.microsoft.com/en-us/library/dd135715.aspx
	'wikiId'       => 'Wiki',
	'containerPaths' => array(
		'media-public'  => 'media-public',
		'media-thumb'   => 'media-thumb',
		'media-deleted' => 'media-deleted',
		'media-temp'    => 'media-temp',
 
		                )		
);

$wgLocalFileRepo = array (
    'class'             => 'LocalRepo',
    'name'              => 'local',
    'backend'           => 'azure-backend',
    'scriptDirUrl'      => $wgScriptPath,
    'scriptExtension'   => $wgScriptExtension,
    'url'               => $wgScriptPath . '/img_auth.php',
	'thumbScriptUrl'    => false,
	'transformVia404'   => false,
    'hashLevels'        => 2,
    'deletedHashLevels' => 3,
    'zones' 			=> array (
                    			'public' => array (
                                				'container' => 'file-upload',
                                    			'directory' => '',
                    			 ),
                    			 'thumb' => array(
                                 	   			'container' => 'file-upload',
                                    			'directory' => 'thumb',
                    			 ),
                    			 'deleted' => array (
                                    			'container' => 'file-upload',
                                    			'directory' => 'deleted',
                    			 ),
                    			 'temp' => array(
                                    			'container' => 'file-upload',
                                    			'directory' => 'temp',
                    			 )
    )
);

$wgImgAuthPublicTest = false;

First run:

Fatal error: Class 'WindowsAzure\Blob\Models\ContainerACL' not found in D:\home\site\wwwroot\extensions\WindowsAzureStorage\WindowsAzureFileBackend.php on line 318

Second run:

 Exception encountered, of type "MicrosoftAzure\Storage\Common\ServiceException"
[14907c24] /index.php?title=Special:Upload MicrosoftAzure\Storage\Common\ServiceException from line 228 of D:\home\site\wwwroot\extensions\WindowsAzureSDK\vendor\microsoft\azure-storage\src\Common\Internal\ServiceRestProxy.php: Fail:
Code: 409
Value: The specified container already exists.
details (if any): <?xml version="1.0" encoding="utf-8"?><Error><Code>ContainerAlreadyExists</Code><Message>The specified container already exists.
RequestId:313754d7-0001-00ba-68df-cbfddb000000
Time:2016-06-21T17:06:41.4777161Z</Message></Error>.
Backtrace:
#0 D:\home\site\wwwroot\extensions\WindowsAzureSDK\vendor\microsoft\azure-storage\src\Common\Internal\ServiceRestProxy.php(187): MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::throwIfError(integer, string, GuzzleHttp\Psr7\Stream, integer)
#1 D:\home\site\wwwroot\extensions\WindowsAzureSDK\vendor\microsoft\azure-storage\src\Blob\BlobRestProxy.php(826): MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy->send(string, array, array, array, string, integer)
#2 D:\home\site\wwwroot\extensions\WindowsAzureStorage\WindowsAzureFileBackend.php(284): MicrosoftAzure\Storage\Blob\BlobRestProxy->createContainer(string)
#3 D:\home\site\wwwroot\includes\filebackend\FileBackendStore.php(454): WindowsAzureFileBackend->doPrepareInternal(string, string, array)
#4 D:\home\site\wwwroot\includes\filebackend\FileBackend.php(766): FileBackendStore->doPrepare(array)
#5 D:\home\site\wwwroot\includes\filerepo\FileRepo.php(1332): FileBackend->prepare(array)
#6 D:\home\site\wwwroot\includes\filerepo\FileRepo.php(1233): FileRepo->initDirectory(string)
#7 [internal function]: FileRepo->publishBatch(array, integer)
#8 D:\home\site\wwwroot\includes\filerepo\LocalRepo.php(598): call_user_func_array(string, array)
#9 D:\home\site\wwwroot\includes\filerepo\LocalRepo.php(573): LocalRepo->skipWriteOperationIfSha1(string, array)
#10 D:\home\site\wwwroot\includes\filerepo\FileRepo.php(1176): LocalRepo->publishBatch(array, integer)
#11 [internal function]: FileRepo->publish(string, string, string, integer, array)
#12 D:\home\site\wwwroot\includes\filerepo\LocalRepo.php(598): call_user_func_array(string, array)
#13 D:\home\site\wwwroot\includes\filerepo\LocalRepo.php(569): LocalRepo->skipWriteOperationIfSha1(string, array)
#14 D:\home\site\wwwroot\includes\filerepo\file\LocalFile.php(1522): LocalRepo->publish(string, string, string, integer, array)
#15 D:\home\site\wwwroot\includes\filerepo\file\LocalFile.php(1478): LocalFile->publishTo(string, string, integer, array)
#16 D:\home\site\wwwroot\includes\filerepo\file\LocalFile.php(1148): LocalFile->publish(string, integer, array)
#17 D:\home\site\wwwroot\includes\upload\UploadBase.php(708): LocalFile->upload(string, string, string, integer, array, boolean, User)
#18 D:\home\site\wwwroot\includes\specials\SpecialUpload.php(486): UploadBase->performUpload(string, string, boolean, User)
#19 D:\home\site\wwwroot\includes\specials\SpecialUpload.php(197): SpecialUpload->processUpload()
#20 D:\home\site\wwwroot\includes\specialpage\SpecialPage.php(384): SpecialUpload->execute(NULL)
#21 D:\home\site\wwwroot\includes\specialpage\SpecialPageFactory.php(553): SpecialPage->run(NULL)
#22 D:\home\site\wwwroot\includes\MediaWiki.php(281): SpecialPageFactory::executePath(Title, RequestContext)
#23 D:\home\site\wwwroot\includes\MediaWiki.php(714): MediaWiki->performRequest()
#24 D:\home\site\wwwroot\includes\MediaWiki.php(508): MediaWiki->main()
#25 D:\home\site\wwwroot\index.php(41): MediaWiki->run()
#26 {main}
142.179.3.76 (talkcontribs)

Hi Simon, might be a bit late for you, but for anyone else hitting the issue, I just submitted a pull request to GitHub that should use the latest azure sdk and fix the issue you are seeing.

49.198.24.156 (talkcontribs)

thanks for pushing that PR, helped me get things working

Tam-edwin-microsoft (talkcontribs)

The patch for this issue is now accepted and merged.

Reply to " WindowsAzure\Blob\Models\ContainerACL/The specified container already exists."