init
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace AeonDumpManager;
|
||||
|
||||
use Shopware\Core\Framework\Plugin;
|
||||
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
|
||||
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
|
||||
use Shopware\Core\Framework\Plugin\Context\InstallContext;
|
||||
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
|
||||
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
|
||||
|
||||
class AeonDumpManager extends Plugin
|
||||
{
|
||||
public function install(InstallContext $installContext): void
|
||||
{
|
||||
// Do stuff such as creating a new payment method
|
||||
}
|
||||
|
||||
public function uninstall(UninstallContext $uninstallContext): void
|
||||
{
|
||||
parent::uninstall($uninstallContext);
|
||||
|
||||
if ($uninstallContext->keepUserData()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove or deactivate the data created by the plugin
|
||||
}
|
||||
|
||||
public function activate(ActivateContext $activateContext): void
|
||||
{
|
||||
// Activate entities, such as a new payment method
|
||||
// Or create new entities here, because now your plugin is installed and active for sure
|
||||
}
|
||||
|
||||
public function deactivate(DeactivateContext $deactivateContext): void
|
||||
{
|
||||
// Deactivate entities, such as a new payment method
|
||||
// Or remove previously created entities
|
||||
}
|
||||
|
||||
public function update(UpdateContext $updateContext): void
|
||||
{
|
||||
// Update necessary stuff, mostly non-database related
|
||||
}
|
||||
|
||||
public function postInstall(InstallContext $installContext): void
|
||||
{
|
||||
}
|
||||
|
||||
public function postUpdate(UpdateContext $updateContext): void
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace AeonDumpManager\Command;
|
||||
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'aeon:example',
|
||||
description: 'Add a short description for your command',
|
||||
)]
|
||||
class ExampleCommand extends Command
|
||||
{
|
||||
// Provides a description, printed out in bin/console
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setDescription('Does something very special.');
|
||||
}
|
||||
|
||||
// Actual code executed in the command
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$output->writeln('It works!');
|
||||
|
||||
// Exit code 0 for success
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// Import admin module
|
||||
import './module/swag-example';
|
||||
@@ -0,0 +1,49 @@
|
||||
// <plugin root>/src/Resources/app/administration/src/module/swag-example/index.js
|
||||
import './page/swag-example-list';
|
||||
import './page/swag-example-detail';
|
||||
import './page/swag-example-create';
|
||||
import deDE from './snippet/de-DE';
|
||||
import enGB from './snippet/en-GB';
|
||||
|
||||
Shopware.Module.register('swag-example', {
|
||||
type: 'plugin',
|
||||
name: 'Example',
|
||||
title: 'swag-example.general.mainMenuItemGeneral',
|
||||
description: 'sw-property.general.descriptionTextModule',
|
||||
color: '#ff3d58',
|
||||
icon: 'default-shopping-paper-bag-product',
|
||||
|
||||
snippets: {
|
||||
'de-DE': deDE,
|
||||
'en-GB': enGB
|
||||
},
|
||||
|
||||
routes: {
|
||||
list: {
|
||||
component: 'swag-example-list',
|
||||
path: 'list'
|
||||
},
|
||||
detail: {
|
||||
component: 'swag-example-detail',
|
||||
path: 'detail/:id',
|
||||
meta: {
|
||||
parentPath: 'swag.example.list'
|
||||
}
|
||||
},
|
||||
create: {
|
||||
component: 'swag-example-create',
|
||||
path: 'create',
|
||||
meta: {
|
||||
parentPath: 'swag.example.list'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
navigation: [{
|
||||
label: 'swag-example.general.mainMenuItemGeneral',
|
||||
color: '#ff3d58',
|
||||
path: 'swag.example.list',
|
||||
icon: 'default-shopping-paper-bag-product',
|
||||
position: 100
|
||||
}]
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"swag-example": {
|
||||
"general": {
|
||||
"mainMenuItemGeneral": "My custom module",
|
||||
"descriptionTextModule": "Manage this custom module here"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"swag-example": {
|
||||
"general": {
|
||||
"mainMenuItemGeneral": "My custom module",
|
||||
"descriptionTextModule": "Manage this custom module here"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/shopware/shopware/trunk/src/Core/System/SystemConfig/Schema/config.xsd">
|
||||
|
||||
<card>
|
||||
<title>Minimal configuration</title>
|
||||
|
||||
<input-field type="number">
|
||||
<name>maxDumps</name>
|
||||
<label>Maximum allowed dumps to exist</label>
|
||||
<defaultValue>6</defaultValue>
|
||||
</input-field>
|
||||
<input-field type="number">
|
||||
<name>retantionDays</name>
|
||||
<label>How many Days the dumps kept in the Storage. 0 Means unlimited</label>
|
||||
<defaultValue>0</defaultValue>
|
||||
</input-field>
|
||||
</card>
|
||||
|
||||
</config>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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="AeonDumpManager\Command\ExampleCommand">
|
||||
<tag name="console.command"/>
|
||||
</service>
|
||||
|
||||
<service id="AeonDumpManager\ScheduledTask\ExampleTask">
|
||||
<tag name="shopware.scheduled.task"/>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
</container>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace AeonDumpManager\ScheduledTask;
|
||||
|
||||
use Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTask;
|
||||
|
||||
class ExampleTask extends ScheduledTask
|
||||
{
|
||||
public static function getTaskName(): string
|
||||
{
|
||||
return 'swag.example_task';
|
||||
}
|
||||
|
||||
public static function getDefaultInterval(): int
|
||||
{
|
||||
return 300; // 5 minutes
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user