Skip to content

Commit

Permalink
Merge pull request #81 from Ethan3600/1.x-develop
Browse files Browse the repository at this point in the history
Release 1.6.4
  • Loading branch information
Ethan Yehuda authored Dec 2, 2018
2 parents 01ea4b6 + 0e30762 commit dc7008c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
10 changes: 8 additions & 2 deletions Console/Command/Runjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Console\Cli;
use Magento\Framework\Stdlib\DateTime\DateTimeFactory;
Expand Down Expand Up @@ -34,7 +35,8 @@ public function __construct(
State $state,
ManagerFactory $managerFactory,
DateTimeFactory $dateTimeFactory
) {
)
{
$this->managerFactory = $managerFactory;
$this->state = $state;
$this->dateTimeFactory = $dateTimeFactory;
Expand Down Expand Up @@ -63,8 +65,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
$dateTime = $this->dateTimeFactory->create();

try {
$this->state->setAreaCode('adminhtml');
$this->state->setAreaCode(Area::AREA_ADMINHTML);
} catch (\Magento\Framework\Exception\LocalizedException $exception) {
// Area code is already set
}

try {
// lets create a new cron job and dispatch it
$jobCode = $input->getArgument(self::INPUT_KEY_JOB_CODE);
$now = strftime('%Y-%m-%dT%H:%M:%S', $dateTime->gmtTimestamp());
Expand Down
11 changes: 9 additions & 2 deletions Console/Command/Showjobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\Table;
use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Console\Cli;
Expand All @@ -30,7 +31,8 @@ class Showjobs extends Command
public function __construct(
State $state,
ManagerFactory $managerFactory
) {
)
{
$this->managerFactory = $managerFactory;
$this->state = $state;
parent::__construct();
Expand All @@ -49,9 +51,14 @@ protected function execute(InputInterface $input, OutputInterface $output)

try {
$this->state->setAreaCode(Area::AREA_ADMINHTML);
} catch (\Magento\Framework\Exception\LocalizedException $exception) {
// Area code is already set
}

try {
$jobs = $manager->getCronJobs();
$table = $this->getHelperSet()->get('table')->setHeaders($this->headers);
$table = new Table($output);
$table->setHeaders($this->headers);

foreach ($jobs as $group => $crons) {
foreach ($crons as $code => $job) {
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "ethanyehuda/magento2-cronjobmanager",
"description": "A module for managing scheduled cron jobs from magento's admin panel",
"require": {
"php": "~7.0.0||~7.1.0",
"magento/framework": "~100.3.0-dev|~101.0.0"
"php": "~7.0.0||~7.1.0||~7.2.0",
"magento/framework": "~100.3.0-dev|~101.0.0|~102.0.0"
},
"type": "magento2-module",
"license": "OSL-3.0",
Expand Down

0 comments on commit dc7008c

Please sign in to comment.