diff --git a/Block/Adminhtml/Job/Edit/Tab/Main.php b/Block/Adminhtml/Job/Edit/Tab/Main.php index c2212ae..0cbd7a4 100644 --- a/Block/Adminhtml/Job/Edit/Tab/Main.php +++ b/Block/Adminhtml/Job/Edit/Tab/Main.php @@ -73,7 +73,7 @@ public function __construct( array $data = [] ) { $this->jobStatus = $jobStatus; - $this->group = $group; + $this->group = $group; parent::__construct($context, $registry, $formFactory, $data); } diff --git a/Block/Adminhtml/Timetable.php b/Block/Adminhtml/Timetable.php index d35611f..677583a 100644 --- a/Block/Adminhtml/Timetable.php +++ b/Block/Adminhtml/Timetable.php @@ -66,8 +66,8 @@ public function __construct( CollectionFactory $collectionFactory, array $data = [] ) { - $this->helper = $helper; - $this->datetime = $datetime; + $this->helper = $helper; + $this->datetime = $datetime; $this->collectionFactory = $collectionFactory; parent::__construct($context, $data); @@ -78,7 +78,7 @@ public function __construct( */ public function getCronJobData() { - $data = []; + $data = []; $count = 0; $schedules = $this->collectionFactory->create(); @@ -88,8 +88,8 @@ public function getCronJobData() /** @var Schedule $schedule */ foreach ($schedules->getItems() as $schedule) { $status = $schedule->getStatus(); - $start = $schedule->getScheduledAt(); - $end = $start; + $start = $schedule->getScheduledAt(); + $end = $start; switch ($status) { case Schedule::STATUS_RUNNING: @@ -97,7 +97,7 @@ public function getCronJobData() break; case Schedule::STATUS_SUCCESS: $start = $schedule->getExecutedAt(); - $end = $schedule->getFinishedAt(); + $end = $schedule->getFinishedAt(); break; } @@ -134,7 +134,7 @@ private function getToolTip($schedule, $status) $tooltip .= sprintf('%s%s', __('ID'), $schedule->getId()); $statusHtml = sprintf('%s', $status, $status); - $tooltip .= sprintf('%s%s', __('Status'), $statusHtml); + $tooltip .= sprintf('%s%s', __('Status'), $statusHtml); if ($message = $schedule->getMessages()) { $tooltip .= sprintf('%s%s', __('Message'), $this->escapeQuote($message)); diff --git a/CHANGELOG b/CHANGELOG index 720cee4..532958e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1 +1 @@ -CHANGELOG: https://www.mageplaza.com/releases/cron-schedule/ +CHANGELOG: https://www.mageplaza.com/releases/cron-schedule/ diff --git a/Controller/Adminhtml/AbstractJob.php b/Controller/Adminhtml/AbstractJob.php index 33ef185..dd042eb 100644 --- a/Controller/Adminhtml/AbstractJob.php +++ b/Controller/Adminhtml/AbstractJob.php @@ -112,13 +112,13 @@ public function __construct( TypeListInterface $cacheTypeList ) { $this->resultPageFactory = $resultPageFactory; - $this->jsonFactory = $jsonFactory; - $this->registry = $registry; - $this->helper = $helper; - $this->jobFactory = $jobFactory; - $this->scheduleFactory = $scheduleFactory; - $this->logger = $logger; - $this->cacheTypeList = $cacheTypeList; + $this->jsonFactory = $jsonFactory; + $this->registry = $registry; + $this->helper = $helper; + $this->jobFactory = $jobFactory; + $this->scheduleFactory = $scheduleFactory; + $this->logger = $logger; + $this->cacheTypeList = $cacheTypeList; parent::__construct($context); } @@ -174,7 +174,7 @@ protected function getSelectedRecords($data) }); } - $jobs = array_values($allJobs); + $jobs = array_values($allJobs); $filters = (array) $data['filters']; unset($filters['placeholder']); foreach ($filters as $column => $value) { diff --git a/Controller/Adminhtml/AbstractLog.php b/Controller/Adminhtml/AbstractLog.php index c6c7b5e..bb6f0ab 100644 --- a/Controller/Adminhtml/AbstractLog.php +++ b/Controller/Adminhtml/AbstractLog.php @@ -70,7 +70,7 @@ public function __construct( CollectionFactory $collectionFactory ) { $this->resultPageFactory = $resultPageFactory; - $this->filter = $filter; + $this->filter = $filter; $this->collectionFactory = $collectionFactory; parent::__construct($context); diff --git a/Controller/Adminhtml/Job/Edit.php b/Controller/Adminhtml/Job/Edit.php index 4eed35b..7ebfb1d 100644 --- a/Controller/Adminhtml/Job/Edit.php +++ b/Controller/Adminhtml/Job/Edit.php @@ -38,7 +38,7 @@ class Edit extends AbstractJob public function execute() { $object = $this->_initJob(); - $name = $this->getRequest()->getParam('name'); + $name = $this->getRequest()->getParam('name'); if ($name !== null) { if ($object->getData() === null) { @@ -61,7 +61,7 @@ public function execute() $this->registry->register('mpcronschedule_job', $object); - $pageTitle = $name !== null ? __('Edit Cron Job "%1"', $name) : __('Create New Cron Job'); + $pageTitle = $name !== null ? __('Edit Cron Job "%1"', $name) : __('Create New Cron Job'); $resultPage = $this->_initAction(); $resultPage->getConfig()->getTitle()->prepend($pageTitle); diff --git a/Controller/Adminhtml/Job/InlineEdit.php b/Controller/Adminhtml/Job/InlineEdit.php index 2599fea..f1c0ae5 100644 --- a/Controller/Adminhtml/Job/InlineEdit.php +++ b/Controller/Adminhtml/Job/InlineEdit.php @@ -39,9 +39,9 @@ public function execute() { /** @var Json $resultJson */ $resultJson = $this->jsonFactory->create(); - $error = false; - $messages = []; - $items = $this->getRequest()->getParam('items', []); + $error = false; + $messages = []; + $items = $this->getRequest()->getParam('items', []); if (empty($items) && !$this->getRequest()->getParam('isAjax')) { return $resultJson->setData([ @@ -57,7 +57,7 @@ public function execute() $object->changeJobStatus($items[$name]['status']); } catch (Exception $e) { $messages[] = '[Cron Job: ' . $object->getName() . '] ' . $e->getMessage(); - $error = true; + $error = true; } } diff --git a/Controller/Adminhtml/Job/Validate.php b/Controller/Adminhtml/Job/Validate.php index b020e1a..f824d88 100644 --- a/Controller/Adminhtml/Job/Validate.php +++ b/Controller/Adminhtml/Job/Validate.php @@ -45,7 +45,7 @@ public function execute() $error = false; $request = $this->getRequest(); - $name = $request->getParam('code'); + $name = $request->getParam('code'); $validator = new Zend_Validate_Regex('/^[a-z][a-z_0-9]{0,30}$/'); if (!$validator->isValid($name)) { @@ -57,7 +57,7 @@ public function execute() } $orgName = $request->getParam('org_name'); - $jobs = $this->helper->getJobs(); + $jobs = $this->helper->getJobs(); if ($name !== $orgName && isset($jobs[$name])) { $this->messageManager->addErrorMessage(__('A cron job with this code already exists.')); @@ -65,7 +65,7 @@ public function execute() } $schedule = $request->getParam('schedule'); - $e = count(preg_split('#\s+#', $schedule, null, PREG_SPLIT_NO_EMPTY)); + $e = count(preg_split('#\s+#', $schedule, null, PREG_SPLIT_NO_EMPTY)); if ($e < 5 || $e > 6) { $this->messageManager->addErrorMessage(__('Invalid cron expression: %1', $schedule)); $error = true; diff --git a/Helper/Data.php b/Helper/Data.php index 359dd06..5861d56 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -72,8 +72,8 @@ public function __construct( DateTime $dateTime ) { $this->cronConfig = $cronConfig; - $this->timezone = $timezone; - $this->dateTime = $dateTime; + $this->timezone = $timezone; + $this->dateTime = $dateTime; parent::__construct($context, $objectManager, $storeManager); } @@ -133,7 +133,7 @@ public function getJobs($name = null) */ private function getJobData($job, $code, $group) { - $job['name'] = $code; + $job['name'] = $code; $job['group'] = $group; if (!isset($job['schedule'])) { @@ -174,7 +174,7 @@ public function isJobDisabled($name) */ public function getTime($isFloor = false) { - $time = $this->versionCompare('2.2.0') ? $this->dateTime->gmtTimestamp() : $this->timezone->scopeTimeStamp(); + $time = $this->versionCompare('2.2.0') ? $this->dateTime->gmtTimestamp() : $this->timezone->scopeTimeStamp(); $format = $isFloor ? '%Y-%m-%d %H:%M:00' : '%Y-%m-%d %H:%M:%S'; return strftime($format, $time); diff --git a/Helper/Email.php b/Helper/Email.php index 3370b17..da39a2e 100644 --- a/Helper/Email.php +++ b/Helper/Email.php @@ -23,6 +23,7 @@ use Magento\Framework\App\Area; use Magento\Framework\App\Helper\Context; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\MailException; use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Framework\ObjectManagerInterface; @@ -115,7 +116,7 @@ public function getSchedule($storeId = null) * @param array $templateVars * * @throws MailException - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ public function sendEmail($templateVars = []) { diff --git a/LICENSE b/LICENSE index 6b32f24..c30d03b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -The MIT License - -Copyright (c) 2015-present Mageplaza, Co. Ltd. https://www.mageplaza.com - -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 MIT License + +Copyright (c) 2015-present Mageplaza, Co. Ltd. https://www.mageplaza.com + +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. \ No newline at end of file diff --git a/Model/Command.php b/Model/Command.php index ef2cc61..afaf53a 100644 --- a/Model/Command.php +++ b/Model/Command.php @@ -52,7 +52,7 @@ public function __construct( ShellInterface $shell, PhpExecutableFinderFactory $phpExecutableFinderFactory ) { - $this->shell = $shell; + $this->shell = $shell; $this->phpExecutableFinder = $phpExecutableFinderFactory->create(); } diff --git a/Model/EmailNotify.php b/Model/EmailNotify.php index 112e311..711a9ed 100644 --- a/Model/EmailNotify.php +++ b/Model/EmailNotify.php @@ -22,6 +22,8 @@ namespace Mageplaza\CronSchedule\Model; use Magento\Cron\Model\Schedule; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\MailException; use Mageplaza\CronSchedule\Helper\Email; use Mageplaza\CronSchedule\Model\ResourceModel\Schedule\Collection; use Mageplaza\CronSchedule\Model\ResourceModel\Schedule\CollectionFactory; @@ -53,13 +55,13 @@ public function __construct( Email $helper, CollectionFactory $collectionFactory ) { - $this->helper = $helper; + $this->helper = $helper; $this->collectionFactory = $collectionFactory; } /** - * @throws \Magento\Framework\Exception\LocalizedException - * @throws \Magento\Framework\Exception\MailException + * @throws LocalizedException + * @throws MailException */ public function sendEmail() { @@ -74,7 +76,7 @@ public function sendEmail() ->addFieldToFilter('mpcronschedule_email_sent', ['null' => true]) ->addFieldToFilter('status', ['in' => [Schedule::STATUS_ERROR, Schedule::STATUS_MISSED]]); - if (!$collection->getSize()) { + if (!$collection->getSize() || empty($this->helper->getConfigGeneral('send_to'))) { return; } diff --git a/Model/Job.php b/Model/Job.php index 01e1d65..17ba4b2 100644 --- a/Model/Job.php +++ b/Model/Job.php @@ -82,7 +82,7 @@ public function __construct( AbstractDb $resourceCollection = null, array $data = [] ) { - $this->helper = $helper; + $this->helper = $helper; $this->valueFactory = $valueFactory; parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -140,7 +140,7 @@ public function deleteJob() public function executeJob(&$schedule) { $instance = $this->getInstance(); - $method = $this->getMethod(); + $method = $this->getMethod(); if (!isset($instance, $method)) { throw new RuntimeException(__('No callbacks found')); @@ -171,10 +171,12 @@ public function executeJob(&$schedule) */ public function changeJobStatus($statusValue) { + $path = $this->getCronPath(self::STATUS_PATH); + /** @var Value $config */ $config = $this->valueFactory->create(); - $config->load($this->getCronPath(self::STATUS_PATH), 'path'); - $config->setValue($statusValue); + $config->load($path, 'path'); + $config->setPath($path)->setValue($statusValue); $config->save(); return $this; diff --git a/Model/Message.php b/Model/Message.php index d0f1cb7..bdcc091 100644 --- a/Model/Message.php +++ b/Model/Message.php @@ -61,8 +61,8 @@ public function __construct( UrlInterface $urlBuilder, CollectionFactory $collectionFactory ) { - $this->helper = $helper; - $this->urlBuilder = $urlBuilder; + $this->helper = $helper; + $this->urlBuilder = $urlBuilder; $this->collectionFactory = $collectionFactory; } diff --git a/Observer/ConfigObserver.php b/Observer/ConfigObserver.php index ba13b67..55b08e3 100644 --- a/Observer/ConfigObserver.php +++ b/Observer/ConfigObserver.php @@ -53,7 +53,7 @@ public function __construct( Data $helper ) { $this->modelConfig = $modelConfig; - $this->helper = $helper; + $this->helper = $helper; } /** diff --git a/README.md b/README.md index a3e5b53..e0ea1a8 100644 --- a/README.md +++ b/README.md @@ -1,330 +1,330 @@ -# Magento 2 Cron Schedule extension Free - -[Cron Schedule from Mageplaza](https://www.mageplaza.com/magento-2-cron-schedule/) is one of the most utility which helps you to execute tasks with no effort from the admin panel. The extension prevents errors from popping up, avoid interruption as well as create a smooth flow for your store’s performance. - - -## 1. Documentation -- [Installation guide](https://www.mageplaza.com/install-magento-2-extension/) -- [User guide](https://docs.mageplaza.com/cron-schedule/index.html) -- [Introduction page](http://www.mageplaza.com/magento-2-cron-schedule/) -- [Contribute on Github](https://github.com/mageplaza/magento-2-cron-schedule) -- [Get Support](https://github.com/mageplaza/magento-2-cron-schedule/issues) - - -## 2. FAQ - -**Q: I got an error: Mageplaza_Core has been already defined** - -A: Read solution [here](https://github.com/mageplaza/module-core/issues/3) - -**Q: I would like to locate our Fanpage on any places on the sites. Is it possible?** - -A: Yes. Please create Facebook Widget from Block section from the backend, then embed it on any CMS page or block. - -**Q: What can I do with Cron Jobs Grid?** - -A: You can view all available cron jobs details at the Cron Jobs Grid, including cron job code, group name, activation status, instance classpath, job method, time schedule, and action. Also, you can edit quickly the cron jobs you created from this grid. Besides, the extension supports mass actions such as delete, change status, and execute. - -**Q: What can I see at Cron Jobs Log?** - -A: You can view all states of any cron tasks. You will be well-notified when a cron task gets Error, Missed, Pending, Running, Success. If the process has the problems, the log will display a message containing all error details, and you can identify and resolve to make it run properly. - -**Q: Can I schedule to clear the log frequently?** - -A: Yes, of course. At the admin backend, you can define the time to clean up the log frequently such as every 10 minutes, every 30 minutes, etc. to keep the record neat. - -**Q: What are the benefits of Cron Jobs Timetable?** - -A: Cron Jobs Timetable gives you the power to manage cron tasks visually in chronological order. Color bars are used to mark the scheduled time and notice the state of running cron jobs, for example, red for errors, blue for pending, purple for running, green for success. When hovering over a particular bar, a detail box will appear for you to see more details. - -**Q: When there are errors, how can I know?** - -A: There will be a notification about cron errors sent to you quickly if you turn on Backend Notification and Email Notification. - -**Q: Can I run cron jobs manually?** - -A: Yes, at the Cron Jobs Grid, please choose cron jobs and click on Execute at Action box. - - ## 3. How to install Cron Schedule extension for Magento 2 - -**Install via composer (recommend)** - -Run the following command in Magento 2 root folder: - -``` -composer require mageplaza/module-cron-schedule -php bin/magento setup:upgrade -php bin/magento setup:static-content:deploy -``` - -## 4. Highlight Features - -### Monitor all cronjobs at the admin panel - -From the backend, store admins can track and manage the scheduled cron jobs from a separate listing grid. It is flexible to access the grid to monitor cron jobs details including cron job code, group name, activation status, instance classpath, job method, time schedule, and action. The cron jobs grid provides an overview of all available cron tasks. Admins can make a quick edit to the cron jobs created before from this grid. - -![Imgur](https://i.imgur.com/xFG2nxA.png) - -Admins can also perform mass actions on cron tasks or on selected ones, including deleting, changing the status of cron tasks without any difficulties. - - -### Record all states of a cron task - -![Imgur](https://i.imgur.com/NxfsmV6.png) - -Another outstanding feature of Cron Schedule is that it allows recording and updating all status of a cron task in History Log. - -Store admins will be notified by the Cron Jobs Log when there are action states, including Error, Missed, Pending, Running, and Success. If there are any problems, a message showing all details of errors will be displayed on the log. Admins can reconfigure to solve the problem. - -### Make cron tasks visual in a timetable - -![Imgur](https://i.imgur.com/Vs9Cv0c.png) - -It is necessary to arrange and display cron jobs with different schedule time and status in an easy-to-follow and logical way, which helps store admins to manage the cron jobs grid easily. Cron Timetable and Table wisely display all cron tasks in chronological order with fully setting dates and time of each cron task. - -Notably, each of the cron tasks is set up along with a specific color bar showing the visual status, which makes it easier for store admins to identify the state. For example, red color illustrates errors, blue color for pending, purple for running, and green for success. In case, tasks affect each other; admin can easily define and timely modify them. - -### Manually carry out cron jobs - -![Imgur](https://i.imgur.com/yfnvG1c.png) - -Cron jobs can be run smoothly by applying "Execute" at the Action box. Manual execution makes the process of updating cron tasks more active and straightforward for store admins. - -## 5. More Features - -### Multiple Actions -Remove, execute, or change the status of various cron jobs at once - -### Backend notification -Enable/ Disable notifications at the backend if cron get errors or missed out - -### Notification emails -Enable/ Disable email notification to admin when cron jobs get errors or missed out - -### Email schedule - -Schedule auto-send emails - -### Automatically clear log -Set time to automatically clear up the log (such as every 30 minutes, etc.) - -### Multiple store views -View and manage cron jobs at various store views at Cron Jobs grid or timetable. - - -## 6. Full Features Lists - -### Configuration - -- Enable/ Disable notifications at the backend if cron get errors or missed -- Enable/ Disable email notification to admin when cron jobs get errors or lost -- Choose email senders -- Complete admins’ emails -- Choose email templates -- Automated email sending schedule -- Schedule auto clearing log (such as every 30 minutes, etc.) - -### Cron Jobs Grid -- Check all details of available cron jobs: Cron Job Code, Group Name, Status, Instance Classpath, Job Method, Time Schedule, and Action. -- Multiple actions (delete, change status, execute) on multiple cron jobs -- Make a change of store view -- Cover/ Uncover grid columns - -### Create/ Edit Cron Jobs -- Add the cron job code -- Choose group name -- Allow/ Disallow the cron job -- Fill in job method -- Use cron format to add schedule time - -### Cron Jobs Log -- See result states of cron jobs clearly including Error, Missed, Pending, Running, and Success. -- View other related details: ID, Job Code, Status, Message, Total Executed Time, Created At, Scheduled At, Executed At, Finished At, Action. -- Eliminate cron jobs -- Filter, change store view, show/ hide columns - -### Cron Jobs Timetable -- See result states of cron jobs in details at the timetable format -- Choose when to display cron jobs: last 24 hours, last 7 days, last 30 days - -## 7. User Guide - - -### How to use - -#### Admin can receive notification message when running cron job gets error: - -![](https://i.imgur.com/HllkaCk.png) - -#### Email admin when running cron jobs, Missed and Error: - -![](https://i.imgur.com/QOUziv1.png) - - -#### Show detail Cron Job when hovering on green bars - Crons run successfully - -![](https://i.imgur.com/On7L9VN.png) - -#### Show detail Cron Job when hovering on blue bars - Crons are waiting for approval to run - -![](https://i.imgur.com/XGjOcPW.png) - -#### Show detail Cron Job when hovering on red bars - Crons run failed - -![](https://i.imgur.com/shswdJc.png) - -#### Show detail Cron Job when hovering on red bars - Crons are miss run - -![](https://i.imgur.com/g0gTT7Z.png) - -#### Show detail Cron Job when hovering on purple bars - Crons are running - -![](https://i.imgur.com/R0NTuly.png) - -### How to Configure - -From the Admin Panel, go to `System > Cron Schedule > Configuration` - -![](https://i.imgur.com/fjtqdz6.png) - -#### 1. Configuration - -From the Admin Panel, go to `System > Cron Schedule > Configuration`, select **General** - -![](https://i.imgur.com/hMLkQhi.png) - -- **Backend Notifications**: Select **Yes** to display a notification when running cron jobs is fails. - -![](https://i.imgur.com/UtcBEpL.png) - - - When admin click on **Here** will be directed to the **Cron Jobs Log** page. - -- **Email Notifications**: - - Select **Yes** to send a notification to admin when running cron jobs, report only **Missed** and **Error** Crons. - - Install [Mageplaza SMTP](https://www.mageplaza.com/magento-2-smtp/) to avoid email sent to spam box. -- **Sender**: Select the representative to send the email to notify the customer: - -![](https://i.imgur.com/ZUJdZeO.png) - -- **Send To**: - - Enter the admin email address. - - You can enter multiple emails, each separated by commas (,). - -- **Email Template**: - - Select Email template sent automatically to admin. - - You can access `Marketing > Email Templates`, select **Add New Templates** to create a notification email template - - Instructions on how to create new email templates can be found [here](https://www.mageplaza.com/kb/how-to-customize-email-template-transactional-email-magento-2.html) - -- **Schedule For Email**: Choose the time to send an email error message after cron jobs finish: - -![](https://i.imgur.com/9AKHU5y.png) - -- **Auto Clear Log Every**: - - Set the time to auto clear log. Calculated by day. - - If Empty or 0, the cron jobs log will not be clean. - - -#### 2. Grid - -There are three methods to run Cron manually: -- Method 1: Run the command: `php bin/magento cron:run` -- Method 2: Click **Run All Cron Jobs** at **Manage Cron Jobs** Page. -- Method 3: Tick to choose the Cron Jobs you want to check at **Manage Cron Jobs** table, then choose **Action = Execute**. - -**Note**: - -- First time running Cron, all the cron schedules are in Pending Status. You can view them at **cron_schedule** table or **Cron Jobs Log** Page. - -- The second time running Cron, there are two cases: - - The cron schedule will be Executed if its starting time is over current time but still smaller than 2 mins (The time set at field **Missed If Not Run Within**) - - The cron schedule will be assigned as Missed status if its starting time is over 2 mins - -- You can view or change the Missed Time by: - -From the Admin Panel, go to `Stores > Configuration > Advanced > System > Cron`, change it in the field **Missed If Not Run Within** - -![](https://i.imgur.com/agun0FO.png) - -##### 2.1. Manage Cron Jobs - -From the Admin Panel, go to `System > Cron Schedule > Manage Cron Jobs` - -![](https://i.imgur.com/v9GJh07.png) - -- This is where Cron Jobs information is displayed. -- From **Manage Cron Jobs**, admin can capture basic information such as **Cron Job Code, Group Name, Status, Instance Classpath, Job Method, Time Schedule, Action**. -- **Action**: - - **Delete**: Delete information on **Manage Cron Jobs** page. - - **Change Status**: Change the status of selected Cron Jobs. - - **Execute**: Running Cron Jobs. - - **Edit**: Navigate to the edit page for information Cron Jobs created earlier. Only show **Edit** button with the crons created by admin. Not editable with premade crons. -- **Run All Cron Jobs**: run all Cron Jobs in the table. -- In addition, admin can filter, change store view, hide/ display columns. - -##### 2.2. Create New Cron Jobs - -From the Admin Panel, go to `System > Cron Schedule > Manage Cron Jobs`, select **Add New** - -![](https://i.imgur.com/yHp5jDL.png) - -- **Cron Job Code**: - - Enter the code of Cron Jobs. - - This is a required field. -- **Group Name**: - -![](https://i.imgur.com/GvZ9oWf.png) - -- Choose the group suitable for cron job applying -- In which: - - All groups are available on Magento EE 2.2.x - - Magento CE 2.1.x only has two groups: Default and Index - - Magento CE 2.2.x has three groups: Default, Index and Ddg_automation - - Magento CE 2.3.x has four groups: Default, Index, Ddg_automation and Consumers - -- **Status**: Select **Enable** for Cron Jobs to work. -- **Instance Classpath**: - - Enter the path to the object, or called **namespace** - - This is a required field. - - Example: `Mageplaza\CronSchedule\Model\Test` - -- **Job Method**: - - Enter the Method name (Each object has several methods to fill in this field) - - This is a required field. - - Example: execute, recurring billing - -- **Time Schedule**: - - Enter the runtime of Cron Jobs. - - Using Cron format [here](http://www.nncron.ru/help/EN/working/cron-format.htm) to set time for running cron job. - - This is a required field. - - Example: * * * * * means that cron will be run once every minute. - - -#### 3. Cron Jobs Log - -- From the Admin Panel, go to `System > Cron Schedule > Cron Jobs Log` - -![](https://i.imgur.com/eHy1n39.png) - -- This is where the Cron Jobs information is displayed running in 5 states: Error, Missed, Pending, Running, Success. -- From **Cron Jobs Log**, admin can capture basic information such as ID, Job Code, Status, Message, Total Executed Time, Created At, Scheduled At, Executed At, Finished At, Action. -- **Action**: - - **Delete**: Delete the information on the **Cron Jobs Log** page. - - **View**: View detailed information of running **Job Code**, only can see the cron jobs created by admin. - - **Clear All**: Delete the entire history of running Cron Jobs before. -- In addition, admin can filter, change store view, hide/ display columns. - -#### 4. Cron Jobs Timetable - -From the Admin Panel, go to `System > Cron Schedule > Cron Jobs Timetable` - -![](https://i.imgur.com/9fjMt7a.png) - -- This is the Timetable display page of the Cron Jobs Log page. It plays the role of a chart report helping admin to know the results of the cron running process. - -- **Select Time**: Select the time to display Cron Jobs. - - - -## 8. License - -From June 23th 2019, this extension is licensed under the [MIT License](https://github.com/mageplaza/magento-2-cron-schedule/blob/master/LICENSE) +# Magento 2 Cron Schedule extension Free + +[Cron Schedule from Mageplaza](https://www.mageplaza.com/magento-2-cron-schedule/) is one of the most utility which helps you to execute tasks with no effort from the admin panel. The extension prevents errors from popping up, avoid interruption as well as create a smooth flow for your store’s performance. + + +## 1. Documentation +- [Installation guide](https://www.mageplaza.com/install-magento-2-extension/) +- [User guide](https://docs.mageplaza.com/cron-schedule/index.html) +- [Introduction page](http://www.mageplaza.com/magento-2-cron-schedule/) +- [Contribute on Github](https://github.com/mageplaza/magento-2-cron-schedule) +- [Get Support](https://github.com/mageplaza/magento-2-cron-schedule/issues) + + +## 2. FAQ + +**Q: I got an error: Mageplaza_Core has been already defined** + +A: Read solution [here](https://github.com/mageplaza/module-core/issues/3) + +**Q: I would like to locate our Fanpage on any places on the sites. Is it possible?** + +A: Yes. Please create Facebook Widget from Block section from the backend, then embed it on any CMS page or block. + +**Q: What can I do with Cron Jobs Grid?** + +A: You can view all available cron jobs details at the Cron Jobs Grid, including cron job code, group name, activation status, instance classpath, job method, time schedule, and action. Also, you can edit quickly the cron jobs you created from this grid. Besides, the extension supports mass actions such as delete, change status, and execute. + +**Q: What can I see at Cron Jobs Log?** + +A: You can view all states of any cron tasks. You will be well-notified when a cron task gets Error, Missed, Pending, Running, Success. If the process has the problems, the log will display a message containing all error details, and you can identify and resolve to make it run properly. + +**Q: Can I schedule to clear the log frequently?** + +A: Yes, of course. At the admin backend, you can define the time to clean up the log frequently such as every 10 minutes, every 30 minutes, etc. to keep the record neat. + +**Q: What are the benefits of Cron Jobs Timetable?** + +A: Cron Jobs Timetable gives you the power to manage cron tasks visually in chronological order. Color bars are used to mark the scheduled time and notice the state of running cron jobs, for example, red for errors, blue for pending, purple for running, green for success. When hovering over a particular bar, a detail box will appear for you to see more details. + +**Q: When there are errors, how can I know?** + +A: There will be a notification about cron errors sent to you quickly if you turn on Backend Notification and Email Notification. + +**Q: Can I run cron jobs manually?** + +A: Yes, at the Cron Jobs Grid, please choose cron jobs and click on Execute at Action box. + + ## 3. How to install Cron Schedule extension for Magento 2 + +**Install via composer (recommend)** + +Run the following command in Magento 2 root folder: + +``` +composer require mageplaza/module-cron-schedule +php bin/magento setup:upgrade +php bin/magento setup:static-content:deploy +``` + +## 4. Highlight Features + +### Monitor all cronjobs at the admin panel + +From the backend, store admins can track and manage the scheduled cron jobs from a separate listing grid. It is flexible to access the grid to monitor cron jobs details including cron job code, group name, activation status, instance classpath, job method, time schedule, and action. The cron jobs grid provides an overview of all available cron tasks. Admins can make a quick edit to the cron jobs created before from this grid. + +![Imgur](https://i.imgur.com/xFG2nxA.png) + +Admins can also perform mass actions on cron tasks or on selected ones, including deleting, changing the status of cron tasks without any difficulties. + + +### Record all states of a cron task + +![Imgur](https://i.imgur.com/NxfsmV6.png) + +Another outstanding feature of Cron Schedule is that it allows recording and updating all status of a cron task in History Log. + +Store admins will be notified by the Cron Jobs Log when there are action states, including Error, Missed, Pending, Running, and Success. If there are any problems, a message showing all details of errors will be displayed on the log. Admins can reconfigure to solve the problem. + +### Make cron tasks visual in a timetable + +![Imgur](https://i.imgur.com/Vs9Cv0c.png) + +It is necessary to arrange and display cron jobs with different schedule time and status in an easy-to-follow and logical way, which helps store admins to manage the cron jobs grid easily. Cron Timetable and Table wisely display all cron tasks in chronological order with fully setting dates and time of each cron task. + +Notably, each of the cron tasks is set up along with a specific color bar showing the visual status, which makes it easier for store admins to identify the state. For example, red color illustrates errors, blue color for pending, purple for running, and green for success. In case, tasks affect each other; admin can easily define and timely modify them. + +### Manually carry out cron jobs + +![Imgur](https://i.imgur.com/yfnvG1c.png) + +Cron jobs can be run smoothly by applying "Execute" at the Action box. Manual execution makes the process of updating cron tasks more active and straightforward for store admins. + +## 5. More Features + +### Multiple Actions +Remove, execute, or change the status of various cron jobs at once + +### Backend notification +Enable/ Disable notifications at the backend if cron get errors or missed out + +### Notification emails +Enable/ Disable email notification to admin when cron jobs get errors or missed out + +### Email schedule + +Schedule auto-send emails + +### Automatically clear log +Set time to automatically clear up the log (such as every 30 minutes, etc.) + +### Multiple store views +View and manage cron jobs at various store views at Cron Jobs grid or timetable. + + +## 6. Full Features Lists + +### Configuration + +- Enable/ Disable notifications at the backend if cron get errors or missed +- Enable/ Disable email notification to admin when cron jobs get errors or lost +- Choose email senders +- Complete admins’ emails +- Choose email templates +- Automated email sending schedule +- Schedule auto clearing log (such as every 30 minutes, etc.) + +### Cron Jobs Grid +- Check all details of available cron jobs: Cron Job Code, Group Name, Status, Instance Classpath, Job Method, Time Schedule, and Action. +- Multiple actions (delete, change status, execute) on multiple cron jobs +- Make a change of store view +- Cover/ Uncover grid columns + +### Create/ Edit Cron Jobs +- Add the cron job code +- Choose group name +- Allow/ Disallow the cron job +- Fill in job method +- Use cron format to add schedule time + +### Cron Jobs Log +- See result states of cron jobs clearly including Error, Missed, Pending, Running, and Success. +- View other related details: ID, Job Code, Status, Message, Total Executed Time, Created At, Scheduled At, Executed At, Finished At, Action. +- Eliminate cron jobs +- Filter, change store view, show/ hide columns + +### Cron Jobs Timetable +- See result states of cron jobs in details at the timetable format +- Choose when to display cron jobs: last 24 hours, last 7 days, last 30 days + +## 7. User Guide + + +### How to use + +#### Admin can receive notification message when running cron job gets error: + +![](https://i.imgur.com/HllkaCk.png) + +#### Email admin when running cron jobs, Missed and Error: + +![](https://i.imgur.com/QOUziv1.png) + + +#### Show detail Cron Job when hovering on green bars - Crons run successfully + +![](https://i.imgur.com/On7L9VN.png) + +#### Show detail Cron Job when hovering on blue bars - Crons are waiting for approval to run + +![](https://i.imgur.com/XGjOcPW.png) + +#### Show detail Cron Job when hovering on red bars - Crons run failed + +![](https://i.imgur.com/shswdJc.png) + +#### Show detail Cron Job when hovering on red bars - Crons are miss run + +![](https://i.imgur.com/g0gTT7Z.png) + +#### Show detail Cron Job when hovering on purple bars - Crons are running + +![](https://i.imgur.com/R0NTuly.png) + +### How to Configure + +From the Admin Panel, go to `System > Cron Schedule > Configuration` + +![](https://i.imgur.com/fjtqdz6.png) + +#### 1. Configuration + +From the Admin Panel, go to `System > Cron Schedule > Configuration`, select **General** + +![](https://i.imgur.com/hMLkQhi.png) + +- **Backend Notifications**: Select **Yes** to display a notification when running cron jobs is fails. + +![](https://i.imgur.com/UtcBEpL.png) + + - When admin click on **Here** will be directed to the **Cron Jobs Log** page. + +- **Email Notifications**: + - Select **Yes** to send a notification to admin when running cron jobs, report only **Missed** and **Error** Crons. + - Install [Mageplaza SMTP](https://www.mageplaza.com/magento-2-smtp/) to avoid email sent to spam box. +- **Sender**: Select the representative to send the email to notify the customer: + +![](https://i.imgur.com/ZUJdZeO.png) + +- **Send To**: + - Enter the admin email address. + - You can enter multiple emails, each separated by commas (,). + +- **Email Template**: + - Select Email template sent automatically to admin. + - You can access `Marketing > Email Templates`, select **Add New Templates** to create a notification email template + - Instructions on how to create new email templates can be found [here](https://www.mageplaza.com/kb/how-to-customize-email-template-transactional-email-magento-2.html) + +- **Schedule For Email**: Choose the time to send an email error message after cron jobs finish: + +![](https://i.imgur.com/9AKHU5y.png) + +- **Auto Clear Log Every**: + - Set the time to auto clear log. Calculated by day. + - If Empty or 0, the cron jobs log will not be clean. + + +#### 2. Grid + +There are three methods to run Cron manually: +- Method 1: Run the command: `php bin/magento cron:run` +- Method 2: Click **Run All Cron Jobs** at **Manage Cron Jobs** Page. +- Method 3: Tick to choose the Cron Jobs you want to check at **Manage Cron Jobs** table, then choose **Action = Execute**. + +**Note**: + +- First time running Cron, all the cron schedules are in Pending Status. You can view them at **cron_schedule** table or **Cron Jobs Log** Page. + +- The second time running Cron, there are two cases: + - The cron schedule will be Executed if its starting time is over current time but still smaller than 2 mins (The time set at field **Missed If Not Run Within**) + - The cron schedule will be assigned as Missed status if its starting time is over 2 mins + +- You can view or change the Missed Time by: + +From the Admin Panel, go to `Stores > Configuration > Advanced > System > Cron`, change it in the field **Missed If Not Run Within** + +![](https://i.imgur.com/agun0FO.png) + +##### 2.1. Manage Cron Jobs + +From the Admin Panel, go to `System > Cron Schedule > Manage Cron Jobs` + +![](https://i.imgur.com/v9GJh07.png) + +- This is where Cron Jobs information is displayed. +- From **Manage Cron Jobs**, admin can capture basic information such as **Cron Job Code, Group Name, Status, Instance Classpath, Job Method, Time Schedule, Action**. +- **Action**: + - **Delete**: Delete information on **Manage Cron Jobs** page. + - **Change Status**: Change the status of selected Cron Jobs. + - **Execute**: Running Cron Jobs. + - **Edit**: Navigate to the edit page for information Cron Jobs created earlier. Only show **Edit** button with the crons created by admin. Not editable with premade crons. +- **Run All Cron Jobs**: run all Cron Jobs in the table. +- In addition, admin can filter, change store view, hide/ display columns. + +##### 2.2. Create New Cron Jobs + +From the Admin Panel, go to `System > Cron Schedule > Manage Cron Jobs`, select **Add New** + +![](https://i.imgur.com/yHp5jDL.png) + +- **Cron Job Code**: + - Enter the code of Cron Jobs. + - This is a required field. +- **Group Name**: + +![](https://i.imgur.com/GvZ9oWf.png) + +- Choose the group suitable for cron job applying +- In which: + - All groups are available on Magento EE 2.2.x + - Magento CE 2.1.x only has two groups: Default and Index + - Magento CE 2.2.x has three groups: Default, Index and Ddg_automation + - Magento CE 2.3.x has four groups: Default, Index, Ddg_automation and Consumers + +- **Status**: Select **Enable** for Cron Jobs to work. +- **Instance Classpath**: + - Enter the path to the object, or called **namespace** + - This is a required field. + - Example: `Mageplaza\CronSchedule\Model\Test` + +- **Job Method**: + - Enter the Method name (Each object has several methods to fill in this field) + - This is a required field. + - Example: execute, recurring billing + +- **Time Schedule**: + - Enter the runtime of Cron Jobs. + - Using Cron format [here](http://www.nncron.ru/help/EN/working/cron-format.htm) to set time for running cron job. + - This is a required field. + - Example: * * * * * means that cron will be run once every minute. + + +#### 3. Cron Jobs Log + +- From the Admin Panel, go to `System > Cron Schedule > Cron Jobs Log` + +![](https://i.imgur.com/eHy1n39.png) + +- This is where the Cron Jobs information is displayed running in 5 states: Error, Missed, Pending, Running, Success. +- From **Cron Jobs Log**, admin can capture basic information such as ID, Job Code, Status, Message, Total Executed Time, Created At, Scheduled At, Executed At, Finished At, Action. +- **Action**: + - **Delete**: Delete the information on the **Cron Jobs Log** page. + - **View**: View detailed information of running **Job Code**, only can see the cron jobs created by admin. + - **Clear All**: Delete the entire history of running Cron Jobs before. +- In addition, admin can filter, change store view, hide/ display columns. + +#### 4. Cron Jobs Timetable + +From the Admin Panel, go to `System > Cron Schedule > Cron Jobs Timetable` + +![](https://i.imgur.com/9fjMt7a.png) + +- This is the Timetable display page of the Cron Jobs Log page. It plays the role of a chart report helping admin to know the results of the cron running process. + +- **Select Time**: Select the time to display Cron Jobs. + + + +## 8. License + +From June 23th 2019, this extension is licensed under the [MIT License](https://github.com/mageplaza/magento-2-cron-schedule/blob/master/LICENSE) diff --git a/Test/Unit/Block/Adminhtml/TimetableTest.php b/Test/Unit/Block/Adminhtml/TimetableTest.php index 9a76bb4..283cfc8 100644 --- a/Test/Unit/Block/Adminhtml/TimetableTest.php +++ b/Test/Unit/Block/Adminhtml/TimetableTest.php @@ -71,9 +71,9 @@ class TimetableTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); - $this->helper = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->getMock(); - $this->datetime = $this->getMockBuilder(DateTime::class)->disableOriginalConstructor()->getMock(); + $this->context = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(); + $this->helper = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->getMock(); + $this->datetime = $this->getMockBuilder(DateTime::class)->disableOriginalConstructor()->getMock(); $this->collectionFactory = $this->getMockBuilder(CollectionFactory::class) ->setMethods(['create']) ->disableOriginalConstructor()->getMock(); @@ -91,7 +91,7 @@ protected function setUp() public function testGetCronData() { - $data = []; + $data = []; $count = 0; $schedules = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock(); @@ -115,9 +115,9 @@ public function testGetCronData() ->disableOriginalConstructor()->getMock(); $schedules->method('getItems')->willReturn([$schedule]); - $id = '1'; - $status = 'pending'; - $date = '2019-06-14 14:23:00'; + $id = '1'; + $status = 'pending'; + $date = '2019-06-14 14:23:00'; $jobCode = 'code'; $schedule->method('getId')->willReturn($id); @@ -171,7 +171,7 @@ private function getToolTip($id, $code, $date, $status) $tooltip .= sprintf('%s%s', __('ID'), $id); $statusHtml = sprintf('%s', $status, $status); - $tooltip .= sprintf('%s%s', __('Status'), $statusHtml); + $tooltip .= sprintf('%s%s', __('Status'), $statusHtml); $tooltip .= sprintf('%s%s', __('Created Date'), $date); $tooltip .= sprintf('%s%s', __('Schedule Date'), $date); diff --git a/USER-GUIDE.md b/USER-GUIDE.md index 2f01c87..5536afc 100644 --- a/USER-GUIDE.md +++ b/USER-GUIDE.md @@ -1,54 +1,54 @@ -## Documentation - -- Installation guide: https://www.mageplaza.com/install-magento-2-extension/#solution-1-ready-to-paste -- User Guide: https://docs.mageplaza.com/cron-schedule/ -- Product page: https://www.mageplaza.com/magento-2-cron-schedule/ -- FAQs: https://www.mageplaza.com/faqs/ -- Get Support: https://www.mageplaza.com/contact.html or support@mageplaza.com -- Changelog: https://www.mageplaza.com/releases/cron-schedule/ -- License agreement: https://www.mageplaza.com/LICENSE.txt - -## How to install - -### Install ready-to-paste package (Recommended) - -- Installation guide: https://www.mageplaza.com/install-magento-2-extension/ - -## How to upgrade - -1. Backup - -Backup your Magento code, database before upgrading. - -2. Remove CronSchedule folder - -In case of customization, you should backup the customized files and modify in newer version. -Now you remove `app/code/Mageplaza/CronSchedule` folder. In this step, you can copy override CronSchedule folder but this may cause of compilation issue. That why you should remove it. - -3. Upload new version -Upload this package to Magento root directory - -4. Run command line: - -``` -php bin/magento setup:upgrade -php bin/magento setup:static-content:deploy -``` - - -## FAQs - - -#### Q: I got error: `Mageplaza_Core has been already defined` -A: Read solution: https://github.com/mageplaza/module-core/issues/3 - - -#### Q: My site is down -A: Please follow this guide: https://www.mageplaza.com/blog/magento-site-down.html - - -## Support - -- FAQs: https://www.mageplaza.com/faqs/ -- https://www.mageplaza.com/contact.html -- support@mageplaza.com +## Documentation + +- Installation guide: https://www.mageplaza.com/install-magento-2-extension/#solution-1-ready-to-paste +- User Guide: https://docs.mageplaza.com/cron-schedule/ +- Product page: https://www.mageplaza.com/magento-2-cron-schedule/ +- FAQs: https://www.mageplaza.com/faqs/ +- Get Support: https://www.mageplaza.com/contact.html or support@mageplaza.com +- Changelog: https://www.mageplaza.com/releases/cron-schedule/ +- License agreement: https://www.mageplaza.com/LICENSE.txt + +## How to install + +### Install ready-to-paste package (Recommended) + +- Installation guide: https://www.mageplaza.com/install-magento-2-extension/ + +## How to upgrade + +1. Backup + +Backup your Magento code, database before upgrading. + +2. Remove CronSchedule folder + +In case of customization, you should backup the customized files and modify in newer version. +Now you remove `app/code/Mageplaza/CronSchedule` folder. In this step, you can copy override CronSchedule folder but this may cause of compilation issue. That why you should remove it. + +3. Upload new version +Upload this package to Magento root directory + +4. Run command line: + +``` +php bin/magento setup:upgrade +php bin/magento setup:static-content:deploy +``` + + +## FAQs + + +#### Q: I got error: `Mageplaza_Core has been already defined` +A: Read solution: https://github.com/mageplaza/module-core/issues/3 + + +#### Q: My site is down +A: Please follow this guide: https://www.mageplaza.com/blog/magento-site-down.html + + +## Support + +- FAQs: https://www.mageplaza.com/faqs/ +- https://www.mageplaza.com/contact.html +- support@mageplaza.com diff --git a/Ui/Component/Listing/Column/LogActions.php b/Ui/Component/Listing/Column/LogActions.php index 7a475e7..00b0c96 100644 --- a/Ui/Component/Listing/Column/LogActions.php +++ b/Ui/Component/Listing/Column/LogActions.php @@ -60,7 +60,7 @@ public function __construct( array $data = [] ) { $this->urlBuilder = $urlBuilder; - $this->helper = $helper; + $this->helper = $helper; parent::__construct($context, $uiComponentFactory, $components, $data); } diff --git a/Ui/DataProvider/JobProvider.php b/Ui/DataProvider/JobProvider.php index 4762ee8..7b2b482 100644 --- a/Ui/DataProvider/JobProvider.php +++ b/Ui/DataProvider/JobProvider.php @@ -102,7 +102,7 @@ public function addFilter(Filter $filter) public function addOrder($field, $direction) { $this->sortField = $field; - $this->sortDir = strtolower($direction); + $this->sortDir = strtolower($direction); } /** @@ -111,7 +111,7 @@ public function addOrder($field, $direction) */ public function setLimit($offset, $size) { - $this->size = $size; + $this->size = $size; $this->offset = $offset; } @@ -143,7 +143,7 @@ public function getData() // add order $sortField = $this->sortField; - $sortDir = $this->sortDir; + $sortDir = $this->sortDir; usort($items, function ($a, $b) use ($sortField, $sortDir) { return $sortDir === 'asc' ? $a[$sortField] > $b[$sortField] : $a[$sortField] < $b[$sortField]; }); diff --git a/composer.json b/composer.json index 9de160a..cd14273 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,26 @@ -{ - "name": "mageplaza/module-cron-schedule", - "description": "Magento 2 Cron Schedule Extension", - "require": { - "mageplaza/module-core": "^1.4.4" - }, - "type": "magento2-module", - "version": "1.0.0", - "license": "proprietary", - "authors": [ - { - "name": "Mageplaza", - "email": "support@mageplaza.com", - "homepage": "https://www.mageplaza.com", - "role": "Technical Support" - } - ], - "autoload": { - "files": [ - "registration.php" - ], - "psr-4": { - "Mageplaza\\CronSchedule\\": "" - } - } -} +{ + "name": "mageplaza/module-cron-schedule", + "description": "Magento 2 Cron Schedule Extension", + "require": { + "mageplaza/module-core": "^1.4.5" + }, + "type": "magento2-module", + "version": "1.0.1", + "license": "proprietary", + "authors": [ + { + "name": "Mageplaza", + "email": "support@mageplaza.com", + "homepage": "https://www.mageplaza.com", + "role": "Technical Support" + } + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Mageplaza\\CronSchedule\\": "" + } + } +} diff --git a/etc/acl.xml b/etc/acl.xml index b484513..fb3fae0 100644 --- a/etc/acl.xml +++ b/etc/acl.xml @@ -1,44 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml index a8b9358..74e34bd 100644 --- a/etc/adminhtml/di.xml +++ b/etc/adminhtml/di.xml @@ -1,31 +1,31 @@ - - - - - - - Mageplaza\CronSchedule\Model\Message - - - - + + + + + + + Mageplaza\CronSchedule\Model\Message + + + + diff --git a/etc/adminhtml/events.xml b/etc/adminhtml/events.xml index 1e21bf0..946f64e 100644 --- a/etc/adminhtml/events.xml +++ b/etc/adminhtml/events.xml @@ -1,27 +1,27 @@ - - - - - - - + + + + + + + diff --git a/etc/adminhtml/menu.xml b/etc/adminhtml/menu.xml index a15fb2f..100a161 100644 --- a/etc/adminhtml/menu.xml +++ b/etc/adminhtml/menu.xml @@ -1,31 +1,31 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/etc/adminhtml/routes.xml b/etc/adminhtml/routes.xml index 6efae57..b978128 100644 --- a/etc/adminhtml/routes.xml +++ b/etc/adminhtml/routes.xml @@ -1,29 +1,29 @@ - - - - - - - - - + + + + + + + + + diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index ddbe55c..907ad6f 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -1,77 +1,77 @@ - - - -
- - mageplaza - Mageplaza_CronSchedule::configuration - - - - - Magento\Config\Model\Config\Source\Yesno - If Yes, admin can see notification on backend when cron job run fail. - - - - Magento\Config\Model\Config\Source\Yesno - - Install Mageplaza SMTP to avoid sending emails to spam box.]]> - - - - - 1 - - Magento\Config\Model\Config\Source\Email\Identity - - - - - 1 - - Separated by commas (,) - - - - - 1 - - Magento\Config\Model\Config\Source\Email\Template - - - - - 1 - - Mageplaza\CronSchedule\Model\Config\Source\EmailTime - - - - validate-number validate-zero-or-greater validate-digits - day(s). If Empty or 0, the cron jobs log will not be clean. - - -
-
-
+ + + +
+ + mageplaza + Mageplaza_CronSchedule::configuration + + + + + Magento\Config\Model\Config\Source\Yesno + If Yes, admin can see notification on backend when cron job run fail. + + + + Magento\Config\Model\Config\Source\Yesno + + Install Mageplaza SMTP to avoid sending emails to spam box.]]> + + + + + 1 + + Magento\Config\Model\Config\Source\Email\Identity + + + + + 1 + + Separated by commas (,) + + + + + 1 + + Magento\Config\Model\Config\Source\Email\Template + + + + + 1 + + Mageplaza\CronSchedule\Model\Config\Source\EmailTime + + + + validate-number validate-zero-or-greater validate-digits + day(s). If Empty or 0, the cron jobs log will not be clean. + + +
+
+
diff --git a/etc/config.xml b/etc/config.xml index d75a21a..ba71b85 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -1,40 +1,40 @@ - - - - - - - 1 - - - 1 - 1 - general - mpcronschedule_general_email_template - 0 * * * * - 30 - 0 */720 * * * - - - - + + + + + + + 1 + + + 1 + 1 + general + mpcronschedule_general_email_template + 0 * * * * + 30 + 0 */720 * * * + + + + diff --git a/etc/crontab.xml b/etc/crontab.xml index 151d78e..75d5be0 100644 --- a/etc/crontab.xml +++ b/etc/crontab.xml @@ -1,32 +1,32 @@ - - - - - - mpcronschedule/general/schedule - - - mpcronschedule/general/clear_schedule_expr - - - + + + + + + mpcronschedule/general/schedule + + + mpcronschedule/general/clear_schedule_expr + + + diff --git a/etc/di.xml b/etc/di.xml index 7bb0f5e..28777a5 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -1,43 +1,43 @@ - - - - - - - - Mageplaza\CronSchedule\Model\ResourceModel\Schedule\Grid\Collection - - - - - - cron_schedule - Magento\Cron\Model\ResourceModel\Schedule - - - - - shellBackground - - - + + + + + + + + Mageplaza\CronSchedule\Model\ResourceModel\Schedule\Grid\Collection + + + + + + cron_schedule + Magento\Cron\Model\ResourceModel\Schedule + + + + + shellBackground + + + diff --git a/etc/email_templates.xml b/etc/email_templates.xml index e5569a4..df159c8 100644 --- a/etc/email_templates.xml +++ b/etc/email_templates.xml @@ -1,25 +1,25 @@ - - - -