synolia/sylius-scheduler-command-plugin

Scheduler Command Plugin.

This package is auto-updated.

Last update: 2020-07-27 19:35:36 UTC


README

License Tests Version Total Downloads

68747470733a2f2f64656d6f2e73796c6975732e636f6d2f6173736574732f73686f702f696d672f6c6f676f2e706e67

Scheduler Command Plugin

68747470733a2f2f73796c6975732e636f6d2f6173736574732f62616467652d617070726f7665642d62792d73796c6975732e706e67

Schedule Symfony Commands in your Sylius admin panel.

Capture

Features

  • See the list of planned command
  • Add, edit, enable/disable or delete scheduled commands
  • For each command, you have to define :
    • Name
    • Selected Command from the list of Symfony commands
    • Based on Cron schedule expression see Cron formats
    • Output Log file (optional)
    • Priority (highest is priority)
  • Run the Command immediately
  • Download, show file size, empty log files directly from the admin panel
  • Define commands with a Factory (from a Doctrine migration, for example)

Installation

  1. Add the bundle and dependencies in your composer.json :

    With Symfony Flex :

     composer config extra.symfony.allow-contrib true
     composer req synolia/sylius-scheduler-command-plugin
    

    Yon can now go to step 5.

    Or manually :

     composer require synolia/sylius-scheduler-command-plugin
    
  2. Enable the plugin in your config/bundles.php file by add

    Synolia\SyliusSchedulerCommandPlugin\SynoliaSyliusSchedulerCommandPlugin::class => ['all' => true],
  3. Import required config in your config/packages/_sylius.yaml file:

    imports:
        - { resource: "@SynoliaSyliusSchedulerCommandPlugin/Resources/config/config.yaml" }
  4. Import routing in your config/routes.yaml file:

    synolia_scheduled_command:
        resource: "@SynoliaSyliusSchedulerCommandPlugin/Resources/config/admin_routing.yaml"
        prefix: /admin
  5. Copy plugin migrations to your migrations directory (e.g. src/Migrations) and apply them to your database:

    cp -R vendor/synolia/sylius-scheduler-command-plugin/src/Migrations/* src/Migrations
    bin/console doctrine:migrations:migrate
  6. Launch Run command in your Crontab

    * * * * * /_PROJECT_DIRECTORY_/bin/console synolia:scheduler-run
  7. (optional) Showing humanized cron expression

    composer require sivaschenko/utility-cron

Usage

  • Log into admin panel
  • Click on Scheduled commands in the Configuration section in main menu
  • Manage your Scheduled commands

Fixtures

Inside sylius fixture file config/packages/sylius_fixtures.yaml you can add scheduled command fixtures to your suite.

sylius_fixtures:
    suites:
        my_fixture_suite:
            fixtures:
                scheduler_command:
                    options:
                        scheduled_commands:
                            -
                                name: 'Reset Sylius'
                                command: 'sylius:fixtures:load'
                                cronExpression: '0 0 * * *'
                                logFile: 'reset.log'
                                priority: 0
                                enabled: true
                            -
                                name: 'Cancel Unpaid Orders'
                                command: 'sylius:cancel-unpaid-orders'
                                cronExpression: '0 0 * * *'
                                priority: 1
                                enabled: false

Development

See How to contribute.

License

This library is under the MIT license.

Credits

Developed by Synolia.