Download the PHP package basecom/akeneo-cron-ui without Composer
On this page you can find all versions of the php package basecom/akeneo-cron-ui. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download basecom/akeneo-cron-ui
More information about basecom/akeneo-cron-ui
Files in basecom/akeneo-cron-ui
Package akeneo-cron-ui
Short Description This bundle provides an UI for managing Cronjobs in Akeneo
License MIT
Informations about the package akeneo-cron-ui
Basecom CronUI Bundle
The basecom CronUI is an extension for Akeneo community and enterprise edition. It adds a new user interface which can be used to create, manage and delete cronjobs. Also, it allows the developers to create cronjobs through code.
Table of contents
- Installation
1.1 Requirements
1.2 Install the bundle - Usage
2.1 Define cronjobs in code
2.1.1 Symfony Commands
2.1.2 Akeneo Jobs
2.2 Registering cronjobs
2.3 Define cronjobs in ui - Contributing
- Authors
- License
Installation
Requirements
This bundle requires Akeneo 4.0.33 Community Edition or higher. Also it requires PHP 7.1 or higher.
Install the bundle
-
Install this package via composer:
-
Follow the installation steps of the Custom entity bundle if not already installed.
-
Add the bundle to the
bundles.php
: -
Run the doctrine schema update to create the new cronjobs table
-
Add the
cronjobs:run
command to the crontab: - Clear all caches and regenerate front-end assets:
Usage
There are two ways to create cronjobs. You can create them via the user interface, and you may define them in code. The benefit of creating them via code is that you can execute regular PHP code. The cronjobs defined in the user interface can perform any shell command, including but not limited to the Symfony commands.
Define cronjobs in code
Every cronjob needs to implement the interface Cronjob
. The interface consists of three methods: getCronExpression, execute and getLabel. The getCronExpression method can take any valid cron expression including @daily, @monthly and more. You can read more related to cron expressions here. The execute method can run any php code. The getLabel method is only used for logging purposes and will never be shown inside the user interface.
A very basic cronjob, which curl's a specific url can be seen here:
In addition to the interface there are multiple abstract classes which can be used for specific purposes (running a symfony command or akeneo job for example). If your own cronjob extends one of these classes there is no need to implement the interface manually since it is already implemented in the classes.
Symfony Commands (CommandCronjob)
This abstract class can be used to execute any symfony / akeneo command. Here is a basic example, which will run a "schema:update" every hour:
Akeneo Jobs (JobCronjob)
The last abstract class allows the execution of import and export jobs for akeneo. It can take additional parameters (like the filePath) and run the job. All jobs are automatically put into the default akeneo queue.
Registering cronjobs
To register your created cronjobs (regardless which interface and class you used) you just need to register the cronjob as a service and tag it with: basecom.cronjob
. This is a example of the ExportProductsCronjob
which is registered in resources/config/cronjobs.yml
:
The symfony and akeneo cronjobs require that you pass the kernel root dir as the first parameter. This is used to find the correct ./bin/console
file to execute the commands. Of course you can pass more arguments to your custom cronjobs. The symfony compiler will automatically find all registered cronjobs with the tag basecom.cronjob
.
Define cronjobs in ui
It is also possible to register cronjobs through the UI of akeneo. This is useful if some cronjobs are different between stages of your application (e.g. staging, live, etc.). To register a new cronjob, navigate in the ui to Settings
> Cronjobs
.
To add a new cronjob, simply press the Create
button and fill in a unique code and the command. Every command is relative to the root directory of your installation. So you may define commands like this: ./bin/console some:akeneo:command
.
After the creation it will automatically open the edit page for this new cronjob. There you may define the cron expression. You can switch between the manual input and some predefined expressions. You can use any default cron expressions.
Contributing
If you need help or want to ask a question, open an issue. If you found a bug or have a feature request please also open an issue.
We welcome everyone to create Pull Requests and discuss new ideas.
If you found a security-related issue, please send details via e-mail to [email protected]
Authors
Core Team
Jordan Kniest Github |
License
Copyright basecom GmbH & Co. KG
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of akeneo-cron-ui with dependencies
tightenco/collect Version ^5.7
dragonmantank/cron-expression Version ^2.2
cocur/background-process Version ^0.7.0
akeneo-labs/custom-entity-bundle Version ^2.4