-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Ethan3600/0.x-develop
release v0.4.0
- Loading branch information
Showing
49 changed files
with
2,087 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
sudo: required | ||
dist: trusty | ||
group: edge | ||
addons: | ||
apt: | ||
packages: | ||
- mysql-server-5.6 | ||
- mysql-client-core-5.6 | ||
- mysql-client-5.6 | ||
- postfix | ||
hosts: | ||
- magento2.travis | ||
language: php | ||
matrix: | ||
include: | ||
- php: 7.1 | ||
env: | ||
- MAGENTO_VERSION=2.3-develop | ||
- TEST_SUITE=integration | ||
- php: 7.1 | ||
env: | ||
- MAGENTO_VERSION=2.2-develop | ||
- TEST_SUITE=integration | ||
- php: 7.1 | ||
env: | ||
- MAGENTO_VERSION=2.2.2 | ||
- TEST_SUITE=integration | ||
- php: 7.0 | ||
env: | ||
- MAGENTO_VERSION=2.3-develop | ||
- TEST_SUITE=integration | ||
- php: 7.0 | ||
env: | ||
- MAGENTO_VERSION=2.2-develop | ||
- TEST_SUITE=integration | ||
- php: 7.0 | ||
env: | ||
- MAGENTO_VERSION=2.2.2 | ||
- TEST_SUITE=integration | ||
env: | ||
global: | ||
- COMPOSER_BIN_DIR=~/bin | ||
- COMPOSER_PACKAGE_NAME=ethanyehuda/magento2-cronjobmanager | ||
cache: | ||
apt: true | ||
directories: | ||
- $HOME/.composer/cache | ||
before_script: ./.travis/before_script.sh | ||
script: phpunit -c magento2/dev/tests/$TEST_SUITE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR | ||
|
||
# mock mail | ||
sudo service postfix stop | ||
echo # print a newline | ||
smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 & | ||
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/sendmail.ini | ||
|
||
# disable xdebug and adjust memory limit | ||
echo > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini | ||
echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini | ||
phpenv rehash; | ||
|
||
composer selfupdate | ||
|
||
# clone main magento github repository | ||
git clone --branch $MAGENTO_VERSION --depth=1 https://github.com/magento/magento2 | ||
|
||
# install Magento | ||
cd magento2 | ||
|
||
# add composer package under test, composer require will trigger update/install | ||
composer config minimum-stability dev | ||
composer config repositories.travis_to_test git https://github.com/$TRAVIS_REPO_SLUG.git | ||
composer require $COMPOSER_PACKAGE_NAME:dev-$TRAVIS_BRANCH#$TRAVIS_COMMIT | ||
|
||
# prepare for test suite | ||
case $TEST_SUITE in | ||
integration) | ||
cp vendor/$COMPOSER_PACKAGE_NAME/Test/Integration/phpunit.xml.dist dev/tests/integration/phpunit.xml | ||
|
||
cd dev/tests/integration | ||
|
||
# create database and move db config into place | ||
mysql -uroot -e ' | ||
SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; | ||
CREATE DATABASE magento_integration_tests; | ||
' | ||
mv etc/install-config-mysql.travis.php.dist etc/install-config-mysql.php | ||
|
||
cd ../../.. | ||
;; | ||
unit) | ||
cp vendor/$COMPOSER_PACKAGE_NAME/Test/Unit/phpunit.xml.dist dev/tests/unit/phpunit.xml | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace EthanYehuda\CronjobManager\Block\Adminhtml\Cronjob\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class RestoreSystemDefault extends GenericButton implements ButtonProviderInterface | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function getButtonData() | ||
{ | ||
$params = $this->getRequestParams(); | ||
unset($params['key'], $params['form_key']); | ||
$data = [ | ||
'label' => __('Restore System Default'), | ||
'class' => 'secondary', | ||
'on_click' => 'deleteConfirm(\'' | ||
. __('Are you sure you want to restore this to system defaults?') | ||
. '\', \'' | ||
. $this->urlBuilder->getUrl('*/config_job/restoreSystemDefault', $params) | ||
. '\')', | ||
'sort_order' => 5, | ||
]; | ||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace EthanYehuda\CronjobManager\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,78 @@ | ||
<?php | ||
|
||
namespace EthanYehuda\CronjobManager\Command; | ||
|
||
use Magento\Framework\App\Area; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use EthanYehuda\CronjobManager\Model\Manager; | ||
use \Magento\Framework\App\State; | ||
use \Magento\Framework\Console\Cli; | ||
use EthanYehuda\CronjobManager\Model\ManagerFactory; | ||
use Magento\Framework\App\State; | ||
use Magento\Framework\Console\Cli; | ||
|
||
class Showjobs extends Command | ||
{ | ||
/** | ||
* @var EthanYehuda\CronjobManager\Model\Manager $manager | ||
*/ | ||
private $manager; | ||
|
||
/** | ||
* @var \Magento\Framework\App\State $state | ||
*/ | ||
private $state; | ||
|
||
/** | ||
* @var Array $headers | ||
*/ | ||
private $headers = ['Code', 'Group', 'Frequency', 'Class']; | ||
|
||
public function __construct( | ||
State $state, | ||
Manager $manager | ||
) { | ||
$this->manager = $manager; | ||
$this->state = $state; | ||
parent::__construct(); | ||
} | ||
/** | ||
* @var \EthanYehuda\CronjobManager\Model\ManagerFactory $managerFactory | ||
*/ | ||
private $managerFactory; | ||
|
||
/** | ||
* @var \Magento\Framework\App\State $state | ||
*/ | ||
private $state; | ||
|
||
/** | ||
* @var array $headers | ||
*/ | ||
private $headers = ['Job Code', 'Group', 'Frequency', 'Class']; | ||
|
||
public function __construct( | ||
State $state, | ||
ManagerFactory $managerFactory | ||
) { | ||
$this->managerFactory = $managerFactory; | ||
$this->state = $state; | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure() | ||
{ | ||
$this->setName("cronmanager:showjobs"); | ||
$this->setDescription("Show all cron jobs in Magento"); | ||
$this->setDescription("Show all cron job codes in Magento"); | ||
parent::configure(); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$manager = $this->managerFactory->create(); | ||
|
||
try { | ||
$this->state->setAreaCode('adminhtml'); | ||
$jobs = $this->manager->getCronJobs(); | ||
$table = $this->getHelperSet()->get('table')->setHeaders($this->headers); | ||
foreach ($jobs as $group => $crons) { | ||
foreach ($crons as $code => $job) { | ||
$instance = $job['instance']; | ||
$method = $job['method']; | ||
$schedule = (isset($job['schedule']) ? $job['schedule'] : ""); | ||
$jobData = [ | ||
$code, | ||
$group, | ||
$schedule, | ||
"$instance::$method" | ||
]; | ||
$table->addRow($jobData); | ||
} | ||
} | ||
$table->render($output); | ||
return Cli::RETURN_SUCCESS; | ||
$this->state->setAreaCode(Area::AREA_ADMINHTML); | ||
|
||
$jobs = $manager->getCronJobs(); | ||
$table = $this->getHelperSet()->get('table')->setHeaders($this->headers); | ||
|
||
foreach ($jobs as $group => $crons) { | ||
foreach ($crons as $code => $job) { | ||
$instance = $job['instance']; | ||
$method = $job['method']; | ||
$schedule = (isset($job['schedule']) ? $job['schedule'] : ""); | ||
$jobData = [ | ||
$code, | ||
$group, | ||
$schedule, | ||
"$instance::$method" | ||
]; | ||
$table->addRow($jobData); | ||
} | ||
} | ||
|
||
$table->render($output); | ||
return Cli::RETURN_SUCCESS; | ||
} catch (\Magento\Framework\Exception\LocalizedException $e) { | ||
$output->writeln($e->getMessage()); | ||
return Cli::RETURN_FAILURE; | ||
$output->writeln($e->getMessage()); | ||
return Cli::RETURN_FAILURE; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.