-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from philipgatzka/new-plugin-system-compatibility
Migrate plugin to the structure used since Shopware v5.2
- Loading branch information
Showing
5 changed files
with
97 additions
and
106 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<services> | ||
<service id="swag_media_sftp.subscriber.adapter_collection_subscriber" class="SwagMediaSftp\Subscriber\AdapterCollectionSubscriber"> | ||
<tag name="shopware.event_subscriber" /> | ||
</service> | ||
</services> | ||
|
||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
namespace SwagMediaSftp\Subscriber; | ||
|
||
use Enlight\Event\SubscriberInterface; | ||
use Enlight_Event_EventArgs; | ||
|
||
use League\Flysystem\AdapterInterface; | ||
use League\Flysystem\Sftp\SftpAdapter; | ||
|
||
require __DIR__ . "/../vendor/autoload.php"; | ||
|
||
class AdapterCollectionSubscriber implements SubscriberInterface { | ||
|
||
public static function getSubscribedEvents() | ||
{ | ||
return [ | ||
'Shopware_Collect_MediaAdapter_sftp' => 'createSftpAdapter' | ||
]; | ||
} | ||
|
||
/** | ||
* Creates adapter instance | ||
* | ||
* @param Enlight_Event_EventArgs $args | ||
* @return AdapterInterface | ||
*/ | ||
public function createSftpAdapter(Enlight_Event_EventArgs $args) | ||
{ | ||
$defaultConfig = [ | ||
'host' => '', | ||
'port' => 22, | ||
'username' => '', | ||
'password' => '', | ||
'privateKey' => '', | ||
'root' => '', | ||
'timeout' => 10 | ||
]; | ||
|
||
$config = array_merge($defaultConfig, $args->get('config')); | ||
|
||
return new SftpAdapter([ | ||
'host' => $config['host'], | ||
'port' => $config['port'], | ||
'username' => $config['username'], | ||
'password' => $config['password'], | ||
'privateKey' => $config['privateKey'], | ||
'root' => $config['root'], | ||
'timeout' => $config['timeout'] | ||
]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
/* | ||
* (c) shopware AG <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
*/ | ||
|
||
namespace SwagMediaSftp; | ||
|
||
use Shopware\Components\Plugin; | ||
|
||
class SwagMediaSftp extends Plugin {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/shopware/5.2/engine/Shopware/Components/Plugin/schema/plugin.xsd"> | ||
|
||
<version>1.0.0</version> | ||
<author>shopware AG</author> | ||
<license>MIT</license> | ||
|
||
<label lang="de">Media Adapter: SFTP</label> | ||
<label lang="en">Media adapter: SFTP</label> | ||
|
||
<description lang="de">SFTP-Erweiterung für die Media Adapter</description> | ||
<description lang="en">SFTP-Extension for the Shopware media adapters</description> | ||
|
||
<compatibility minVersion="5.2.0" /> | ||
|
||
</plugin> |