Extension talk:WindowsAzureStorage

About this board

Error: Class "MicrosoftAzure\Storage\Blob\BlobRestProxy" not found with MediaWiki 1.39.7

4
Krisssde (talkcontribs)

Hello.

I'm struggling with getting WindowsAzureStorage extension to work with MediaWiki 1.39.7. It worked well for multiple versions until upgrade from 1.37 to 1.39. I downloaded extension for 1.39, replaced all files in the respective folder and configuration is done exactly as shown in the documentation. But when I run update.php script to get db updated for version 1.39.7 I'm getting following error:

Converting djvu metadata...[0ecc20d19c3146dad62c3254] [no req]   Error: Class "MicrosoftAzure\Storage\Blob\BlobRestProxy" not found

Backtrace:

from /var/www/html/extensions/WindowsAzureStorage/includes/WindowsAzureFileBackend.php(68)

#0 /var/www/html/includes/filebackend/FileBackendGroup.php(201): WindowsAzureFileBackend->__construct(array)

#1 /var/www/html/includes/filerepo/FileRepo.php(186): FileBackendGroup->get(string)

#2 /var/www/html/includes/filerepo/LocalRepo.php(77): FileRepo->__construct(array)

#3 /var/www/html/includes/filerepo/RepoGroup.php(416): LocalRepo->__construct(array)

#4 /var/www/html/includes/filerepo/RepoGroup.php(403): RepoGroup->newRepo(array)

#5 /var/www/html/maintenance/refreshImageMetadata.php(284): RepoGroup->newCustomLocalRepo(array)

#6 /var/www/html/maintenance/refreshImageMetadata.php(140): RefreshImageMetadata->newLocalRepo(boolean, boolean, boolean, boolean)

#7 /var/www/html/includes/installer/DatabaseUpdater.php(1184): RefreshImageMetadata->execute()

#8 /var/www/html/includes/installer/DatabaseUpdater.php(547): DatabaseUpdater->doConvertDjvuMetadata()

#9 /var/www/html/includes/installer/DatabaseUpdater.php(511): DatabaseUpdater->runUpdates(array, boolean)

#10 /var/www/html/maintenance/update.php(209): DatabaseUpdater->doUpdates(array)

#11 /var/www/html/maintenance/includes/MaintenanceRunner.php(309): UpdateMediaWiki->execute()

#12 /var/www/html/maintenance/doMaintenance.php(85): MediaWiki\Maintenance\MaintenanceRunner->run()

#13 /var/www/html/maintenance/update.php(319): require_once(string)

#14 {main}

command terminated with exit code 255


Do you know what can be the problem here?

This is the configuration in LocalSettings.php:

wfLoadExtension( 'WindowsAzureStorage' );

$wgFileBackends[] = [

    'name'         => 'localAzure',

    'class'        => 'WindowsAzureFileBackend',

    'lockManager'  => 'nullLockManager',

    'azureAccount' => getenv('<REDACTED>'),

    'azureKey'     => getenv('<REDACTED>')

];

$wgLocalFileRepo = [

    'class'             => 'LocalRepo',

    'name'              => 'local',

    'backend'           => 'localAzure',

    'scriptDirUrl'      => $wgScriptPath,

    'scriptExtension'   => $wgScriptExtension,

    'url'               => $wgScriptPath . '/img_auth.php',

    'hashLevels'        => 0,

    'deletedHashLevels' => 0,

    'zones'             => array(

        'public'  => [ 'container' => 'public' ],

        'thumb'   => [ 'container' => 'thumb' ],

        'temp'    => [ 'container' => 'temp' ],

        'deleted' => [ 'container' => 'deleted' ]

    )

];

$wgImgAuthPublicTest = false;


In composer.local.json:

{

    "extra": {

        "merge-plugin": {

            "include": [

                "extensions/WindowsAzureStorage/composer.json",

                <REDACTED>

            ]

        }

    }

}

Any help or tips are much appreciated!

Ciencia Al Poder (talkcontribs)

Try to not "replace files", but actually delete the whole directory of the extension, and copy the newly downloaded one instead. Remaining files may cause problems like this

Krisssde (talkcontribs)

Thanks, by replace I meant that I cleaned the folder and added new files from the downloaded extension.

Krisssde (talkcontribs)

I found out what the reason was! I upgraded composer version to 2.7.2 and that doesn't seem to load dependencies properly...downgrading to current LTS version 2.2.23 resolved the problem.

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

This extension does not work on MediaWiki 1.20

4
Thaiphan2 (talkcontribs)

I'm currently working on a new extension that uses the new Azure SDK.

Osnard (talkcontribs)
Thaiphan2 (talkcontribs)

Hey again, yes, it is built on that. Here is the link to the extension for it.

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/AzureSDK.git;a=tree

What kind of experiences are you interested in? The README.md file in the Github repo for the Windows Azure SDK was very helpful in understanding how all the basics worked. It was all pretty straightforward after that. I also used the following page http://dl.windowsazure.com/phpdocs/index.html as a reference. It's a bit outdated and hard to use but it still gets the job done.

Osnard (talkcontribs)

Thanks for the information. It's good to see that this feature is going to be in the core.

Reply to "This extension does not work on MediaWiki 1.20"
There are no older topics
Return to "WindowsAzureStorage" page.