Skip to content

Commit

Permalink
BUGFIX: Fix Neos 5.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellienert committed Feb 1, 2020
1 parent bb59930 commit 3fbe066
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions Classes/AssetSource/MediaWikiAssetProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* source code.
*/

use Neos\Flow\Http\Uri;
use Neos\Flow\Annotations as Flow;
use Neos\Http\Factories\UriFactory;
use Neos\Media\Domain\Model\AssetSource\AssetProxy\AssetProxyInterface;
use Neos\Media\Domain\Model\AssetSource\AssetProxy\HasRemoteOriginalInterface;
use Neos\Media\Domain\Model\AssetSource\AssetProxy\SupportsIptcMetadataInterface;
Expand Down Expand Up @@ -43,6 +44,12 @@ final class MediaWikiAssetProxy implements AssetProxyInterface, HasRemoteOrigina
*/
private $iptcProperties;

/**
* @Flow\Inject
* @var UriFactory
*/
protected $uriFactory;

/**
* MediaWikiAssetProxy constructor.
* @param string[] $assetData
Expand Down Expand Up @@ -76,15 +83,15 @@ public function getIdentifier(): string
*/
public function getLabel(): string
{
return $this->getProperty('extmetadata.ObjectName.value');
return (string)$this->getProperty('extmetadata.ObjectName.value');
}

/**
* @return string
*/
public function getFilename(): string
{
return $this->getProperty('filename');
return (string)$this->getProperty('filename');
}

/**
Expand Down Expand Up @@ -132,23 +139,23 @@ public function getHeightInPixels(): ?int
*/
public function getThumbnailUri(): ?UriInterface
{
return new Uri($this->getProperty('thumburl'));
return $this->uriFactory->createUri((string)$this->getProperty('thumburl'));
}

/**
* @return null|UriInterface
*/
public function getPreviewUri(): ?UriInterface
{
return new Uri($this->getProperty('url'));
return $this->uriFactory->createUri((string)$this->getProperty('url'));
}

/**
* @return resource
*/
public function getImportStream()
{
return fopen($this->getProperty('url'), 'r');
return fopen($this->getProperty('url'), 'rb');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "dl/assetsource-mediawiki",
"license": "MIT",
"require": {
"neos/neos": "^4.1",
"neos/neos": "^4.1 || ^5.0",
"guzzlehttp/guzzle": "^6.3"
},
"authors": [
Expand Down

0 comments on commit 3fbe066

Please sign in to comment.