Version Notes
View list your scheduler/cron tasks and add your simple task. 4543543
Download this release
Release Info
Developer | Jaroslaw |
Extension | centerkom_scheduler |
Version | 0.2.0 |
Comparing to | |
See all releases |
Version 0.2.0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Config/List.php +23 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Config/List/Grid.php +44 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/Edit.php +34 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/Edit/Form.php +90 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/List.php +22 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/List/Grid.php +108 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Scheduler/List.php +23 -0
- app/code/local/Centerkom/Scheduler/Block/Adminhtml/Scheduler/List/Grid.php +124 -0
- app/code/local/Centerkom/Scheduler/Helper/Data.php +4 -0
- app/code/local/Centerkom/Scheduler/Model/Crons.php +67 -0
- app/code/local/Centerkom/Scheduler/Model/Mysql4/Scheduler.php +8 -0
- app/code/local/Centerkom/Scheduler/Model/Mysql4/Scheduler/Collection.php +9 -0
- app/code/local/Centerkom/Scheduler/Model/Resource/Setup.php +4 -0
- app/code/local/Centerkom/Scheduler/Model/Scheduler.php +49 -0
- app/code/local/Centerkom/Scheduler/controllers/Adminhtml/ConfigController.php +16 -0
- app/code/local/Centerkom/Scheduler/controllers/Adminhtml/MyschedulerController.php +74 -0
- app/code/local/Centerkom/Scheduler/controllers/Adminhtml/SchedulerController.php +16 -0
- app/code/local/Centerkom/Scheduler/etc/config.xml +115 -0
- app/code/local/Centerkom/Scheduler/sql/scheduler/mysql4-install-0.1.0.php +21 -0
- app/etc/modules/Centerkom_Scheduler.xml +9 -0
- package.xml +18 -0
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Config/List.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Config_List extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct(){
|
6 |
+
$this->_controller = 'adminhtml_config_list';
|
7 |
+
$this->_blockGroup = 'scheduler';
|
8 |
+
$this->_headerText = 'System cron list';
|
9 |
+
parent::__construct();
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Prepare layout
|
14 |
+
*
|
15 |
+
* @return Centerkom_Scheduler_Block_Adminhtml_Config_List
|
16 |
+
*/
|
17 |
+
protected function _prepareLayout() {
|
18 |
+
$this->removeButton('add');
|
19 |
+
|
20 |
+
return parent::_prepareLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Config/List/Grid.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Config_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('scheduler_grid');
|
8 |
+
$this->setDefaultSort('scheduled_at');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('scheduler/crons');
|
17 |
+
$this->setCollection($collection);
|
18 |
+
|
19 |
+
return parent::_prepareCollection();
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
protected function _prepareColumns() {
|
24 |
+
|
25 |
+
$this->addColumn('code', array (
|
26 |
+
'header' => 'Code',
|
27 |
+
'index' => 'code'
|
28 |
+
));
|
29 |
+
$this->addColumn('cron_expr', array (
|
30 |
+
'header' => 'Cron Expression',
|
31 |
+
'index' => 'cron_expr'
|
32 |
+
));
|
33 |
+
$this->addColumn('model', array (
|
34 |
+
'header' => 'Model',
|
35 |
+
'index' => 'model'
|
36 |
+
));
|
37 |
+
$this->addColumn('class', array (
|
38 |
+
'header' => 'Class',
|
39 |
+
'index' => 'class'
|
40 |
+
));
|
41 |
+
|
42 |
+
return parent::_prepareColumns();
|
43 |
+
}
|
44 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/Edit.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Myscheduler_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
|
8 |
+
$this->_objectId = 'id';
|
9 |
+
$this->_blockGroup = 'scheduler';
|
10 |
+
$this->_controller = 'adminhtml_myscheduler_list';
|
11 |
+
$this->_mode = 'edit';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', 'Save');
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getHeaderText()
|
17 |
+
{
|
18 |
+
if ($this->getRequest()->getParam('id'))
|
19 |
+
{
|
20 |
+
return 'Edit job id : '.$this->getRequest()->getParam('id');
|
21 |
+
} else {
|
22 |
+
return 'New Example';
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _prepareLayout()
|
27 |
+
{
|
28 |
+
if ($this->_blockGroup && $this->_controller && $this->_mode) {
|
29 |
+
$this->setChild('form', $this->getLayout()->createBlock('scheduler/adminhtml_myscheduler_edit_form'));
|
30 |
+
}
|
31 |
+
return parent::_prepareLayout();
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/Edit/Form.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerkom_Scheduler_Block_Adminhtml_Myscheduler_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
|
8 |
+
|
9 |
+
if($this->getRequest()->getParam('id'))
|
10 |
+
{
|
11 |
+
$data = Mage::getModel('scheduler/scheduler')
|
12 |
+
->getCollection()
|
13 |
+
->addFieldToFilter('schedule_id', $this->getRequest()->getParam('id'))
|
14 |
+
->getFirstItem()
|
15 |
+
->getData();
|
16 |
+
|
17 |
+
$data['time']=$time[0] = date('H,i,s', strtotime($data['scheduled_at']));
|
18 |
+
$data['date'] = date('Y-m-d', strtotime($data['scheduled_at']));
|
19 |
+
//var_dump($data);
|
20 |
+
|
21 |
+
$form = new Varien_Data_Form(array(
|
22 |
+
'id' => 'edit_form',
|
23 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
24 |
+
'method' => 'post',
|
25 |
+
'enctype' => 'multipart/form-data',
|
26 |
+
));
|
27 |
+
}
|
28 |
+
else
|
29 |
+
{
|
30 |
+
$data = Array();
|
31 |
+
|
32 |
+
$form = new Varien_Data_Form(array(
|
33 |
+
'id' => 'edit_form',
|
34 |
+
'action' => $this->getUrl('*/*/add'),
|
35 |
+
'method' => 'post',
|
36 |
+
'enctype' => 'multipart/form-data',
|
37 |
+
));
|
38 |
+
}
|
39 |
+
//var_dump($data);
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
$form->setUseContainer(true);
|
44 |
+
|
45 |
+
$this->setForm($form);
|
46 |
+
|
47 |
+
$fieldset = $form->addFieldset('example_form', array(
|
48 |
+
'legend' =>'Job data'
|
49 |
+
));
|
50 |
+
|
51 |
+
$fieldset->addField('job_name', 'text', array(
|
52 |
+
'label' => Mage::helper('adminhtml')->__('Name'),
|
53 |
+
'class' => 'required-entry',
|
54 |
+
'required' => true,
|
55 |
+
'name' => 'job_name',
|
56 |
+
//'note' => 'The name of the example.',
|
57 |
+
));
|
58 |
+
|
59 |
+
$fieldset->addField('time', 'time', array(
|
60 |
+
'label' => Mage::helper('adminhtml')->__('Start time'),
|
61 |
+
'class' => 'required-entry',
|
62 |
+
'required' => true,
|
63 |
+
'name' => 'time'
|
64 |
+
));
|
65 |
+
|
66 |
+
$fieldset->addField('date', 'date', array(
|
67 |
+
'label' => Mage::helper('adminhtml')->__('Start date'),
|
68 |
+
'class' => 'required-entry',
|
69 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
70 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM),
|
71 |
+
'name' => 'date'
|
72 |
+
));
|
73 |
+
|
74 |
+
$fieldset->addField('job_code', 'textarea', array(
|
75 |
+
'label' => Mage::helper('adminhtml')->__('Code'),
|
76 |
+
'class' => 'required-entry',
|
77 |
+
'required' => true,
|
78 |
+
'name' => 'job_code',
|
79 |
+
'style'=>'width:800px;height:500px;',
|
80 |
+
'onclick' => "",
|
81 |
+
'onchange' => "",
|
82 |
+
'disabled' => false,
|
83 |
+
'tabindex' => 1
|
84 |
+
));
|
85 |
+
|
86 |
+
$form->setValues($data);
|
87 |
+
|
88 |
+
return parent::_prepareForm();
|
89 |
+
}
|
90 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/List.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Myscheduler_List extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct(){
|
6 |
+
$this->_controller = 'adminhtml_myscheduler_list';
|
7 |
+
$this->_blockGroup = 'scheduler';
|
8 |
+
$this->_headerText = 'User jobs View';
|
9 |
+
parent::__construct();
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Prepare layout
|
14 |
+
*
|
15 |
+
* @return Centerkom_Scheduler_Block_Adminhtml_Myscheduler_List
|
16 |
+
*/
|
17 |
+
protected function _prepareLayout() {
|
18 |
+
|
19 |
+
return parent::_prepareLayout();
|
20 |
+
}
|
21 |
+
|
22 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Myscheduler/List/Grid.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Myscheduler_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('scheduler_grid');
|
8 |
+
$this->setDefaultSort('scheduled_at');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('scheduler/scheduler')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
|
19 |
+
return parent::_prepareCollection();
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
protected function _prepareColumns() {
|
24 |
+
|
25 |
+
$this->addColumn('schedule_id', array (
|
26 |
+
'header' => 'Id',
|
27 |
+
'index' => 'schedule_id'
|
28 |
+
));
|
29 |
+
$this->addColumn('job_name', array (
|
30 |
+
'header' => 'Name',
|
31 |
+
'index' => 'job_name'
|
32 |
+
));
|
33 |
+
$this->addColumn('created_at', array (
|
34 |
+
'header' => 'Created',
|
35 |
+
'index' => 'created_at'
|
36 |
+
));
|
37 |
+
$this->addColumn('scheduled_at', array (
|
38 |
+
'header' => 'Scheduled',
|
39 |
+
'index' => 'scheduled_at'
|
40 |
+
));
|
41 |
+
$this->addColumn('executed_at', array (
|
42 |
+
'header' => 'Executed',
|
43 |
+
'index' => 'executed_at'
|
44 |
+
));
|
45 |
+
$this->addColumn('finished_at', array (
|
46 |
+
'header' => 'Finished',
|
47 |
+
'index' => 'finished_at'
|
48 |
+
));
|
49 |
+
$this->addColumn('messages', array (
|
50 |
+
'header' =>'Messages',
|
51 |
+
'index' => 'messages',
|
52 |
+
'frame_callback' => array($this, 'decorateMessages')
|
53 |
+
));
|
54 |
+
$this->addColumn('status', array (
|
55 |
+
'header' => 'Status',
|
56 |
+
'index' => 'status',
|
57 |
+
'frame_callback' => array($this, 'decorateStatus')
|
58 |
+
));
|
59 |
+
|
60 |
+
|
61 |
+
return parent::_prepareColumns();
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
public function decorateMessages($messages) {
|
66 |
+
return htmlspecialchars_decode($messages);
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Decorate status values
|
73 |
+
*
|
74 |
+
* @return string
|
75 |
+
*/
|
76 |
+
public function decorateStatus($status) {
|
77 |
+
switch ($status) {
|
78 |
+
case 'success':
|
79 |
+
$result = '<span class="bar-green"><span>'.$status.'</span></span>';
|
80 |
+
break;
|
81 |
+
case 'pending':
|
82 |
+
$result = '<span class="bar-lightgray"><span>'.$status.'</span></span>';
|
83 |
+
break;
|
84 |
+
case 'running':
|
85 |
+
$result = '<span class="bar-yellow"><span>'.$status.'</span></span>';
|
86 |
+
break;
|
87 |
+
case 'missed':
|
88 |
+
$result = '<span class="bar-orange"><span>'.$status.'</span></span>';
|
89 |
+
break;
|
90 |
+
case 'error':
|
91 |
+
$result = '<span class="bar-red"><span>'.$status.'</span></span>';
|
92 |
+
break;
|
93 |
+
default:
|
94 |
+
$result = $status;
|
95 |
+
break;
|
96 |
+
}
|
97 |
+
return $result;
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getRowUrl($row)
|
101 |
+
{
|
102 |
+
return $this->getUrl('*/*/edit', array(
|
103 |
+
'store'=>$this->getRequest()->getParam('store'),
|
104 |
+
'id'=>$row->getSchedule_id ())
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Scheduler/List.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Scheduler_List extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct(){
|
6 |
+
$this->_controller = 'adminhtml_scheduler_list';
|
7 |
+
$this->_blockGroup = 'scheduler';
|
8 |
+
$this->_headerText = 'System jobs View';
|
9 |
+
parent::__construct();
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Prepare layout
|
14 |
+
*
|
15 |
+
* @return Centerkom_Scheduler_Block_Adminhtml_Scheduler_List
|
16 |
+
*/
|
17 |
+
protected function _prepareLayout() {
|
18 |
+
$this->removeButton('add');
|
19 |
+
|
20 |
+
return parent::_prepareLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/local/Centerkom/Scheduler/Block/Adminhtml/Scheduler/List/Grid.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Block_Adminhtml_Scheduler_List_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('scheduler_grid');
|
8 |
+
$this->setDefaultSort('scheduled_at');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('cron/schedule')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
|
19 |
+
return parent::_prepareCollection();
|
20 |
+
}
|
21 |
+
|
22 |
+
/*
|
23 |
+
* TO DO
|
24 |
+
*/
|
25 |
+
//protected function _prepareMassaction() {
|
26 |
+
// $this->setMassactionIdField('job_code');
|
27 |
+
// $this->getMassactionBlock()->setFormFieldName('job_code');
|
28 |
+
// $this->getMassactionBlock()->addItem('delete', array(
|
29 |
+
// 'label' => 'Delete',
|
30 |
+
// 'url' => $this->getUrl('*/*/delete'),
|
31 |
+
// ));
|
32 |
+
// return $this;
|
33 |
+
//}
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
protected function _prepareColumns() {
|
38 |
+
|
39 |
+
$this->addColumn('job_code', array (
|
40 |
+
'header' => 'Code',
|
41 |
+
'index' => 'job_code',
|
42 |
+
'frame_callback' => array($this, 'decorateCode')
|
43 |
+
));
|
44 |
+
$this->addColumn('created_at', array (
|
45 |
+
'header' => 'Created',
|
46 |
+
'index' => 'created_at'
|
47 |
+
));
|
48 |
+
$this->addColumn('scheduled_at', array (
|
49 |
+
'header' => 'Scheduled',
|
50 |
+
'index' => 'scheduled_at'
|
51 |
+
));
|
52 |
+
$this->addColumn('executed_at', array (
|
53 |
+
'header' => 'Executed',
|
54 |
+
'index' => 'executed_at'
|
55 |
+
));
|
56 |
+
$this->addColumn('finished_at', array (
|
57 |
+
'header' => 'Finished',
|
58 |
+
'index' => 'finished_at'
|
59 |
+
));
|
60 |
+
$this->addColumn('messages', array (
|
61 |
+
'header' =>'Messages',
|
62 |
+
'index' => 'messages'
|
63 |
+
));
|
64 |
+
$this->addColumn('status', array (
|
65 |
+
'header' => 'Status',
|
66 |
+
'index' => 'status',
|
67 |
+
'frame_callback' => array($this, 'decorateStatus')
|
68 |
+
));
|
69 |
+
|
70 |
+
|
71 |
+
return parent::_prepareColumns();
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Dodaje do kolumny z nazwa zadania
|
77 |
+
* nazwe wywoluwanej metody
|
78 |
+
*/
|
79 |
+
public function decorateCode($value) {
|
80 |
+
$return = '';
|
81 |
+
if (!empty($value)) {
|
82 |
+
$return .= '<b>'.$value.'</b>';
|
83 |
+
$return .= '<br />';
|
84 |
+
//pobiera dane o codzie z konfiga
|
85 |
+
$tmp = Mage::getModel('scheduler/crons')->getDataFromConfig($value);
|
86 |
+
$return .= $tmp[2];
|
87 |
+
$return .= "<br />";
|
88 |
+
$return .= $tmp[3];
|
89 |
+
}
|
90 |
+
return $return;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Decorate status values
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
*/
|
99 |
+
public function decorateStatus($status) {
|
100 |
+
switch ($status) {
|
101 |
+
case 'success':
|
102 |
+
$result = '<span class="bar-green"><span>'.$status.'</span></span>';
|
103 |
+
break;
|
104 |
+
case 'pending':
|
105 |
+
$result = '<span class="bar-lightgray"><span>'.$status.'</span></span>';
|
106 |
+
break;
|
107 |
+
case 'running':
|
108 |
+
$result = '<span class="bar-yellow"><span>'.$status.'</span></span>';
|
109 |
+
break;
|
110 |
+
case 'missed':
|
111 |
+
$result = '<span class="bar-orange"><span>'.$status.'</span></span>';
|
112 |
+
break;
|
113 |
+
case 'error':
|
114 |
+
$result = '<span class="bar-red"><span>'.$status.'</span></span>';
|
115 |
+
break;
|
116 |
+
default:
|
117 |
+
$result = $status;
|
118 |
+
break;
|
119 |
+
}
|
120 |
+
return $result;
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
}
|
app/code/local/Centerkom/Scheduler/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
}
|
app/code/local/Centerkom/Scheduler/Model/Crons.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Model_Crons extends Varien_Data_Collection {
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
public function loadData($printQuery = false, $logQuery = false) {
|
7 |
+
if ($this->_dataLoaded) {
|
8 |
+
return $this;
|
9 |
+
}
|
10 |
+
|
11 |
+
foreach ($this->getDataFromConfig() as $val)
|
12 |
+
{
|
13 |
+
$this->addItem(new Varien_Object(array('code' => $val[0],
|
14 |
+
'cron_expr' => $val[1],
|
15 |
+
'model' => $val[2],
|
16 |
+
'class' => $val[3])));
|
17 |
+
}
|
18 |
+
|
19 |
+
$this->_dataLoaded = true;
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
*
|
27 |
+
* Pobiera dane z konfigu zwraca w postaci tablicy
|
28 |
+
*/
|
29 |
+
public function getDataFromConfig($code = null)
|
30 |
+
{
|
31 |
+
$data = Array();
|
32 |
+
|
33 |
+
$config = Mage::getConfig()->getNode('crontab/jobs');
|
34 |
+
if ($config instanceof Mage_Core_Model_Config_Element) {
|
35 |
+
foreach ($config->children() as $key => $val) {
|
36 |
+
if (!isset($data[$key])) {
|
37 |
+
$data[$key][0] = $key;
|
38 |
+
$data[$key][1] = $val->schedule->cron_expr;
|
39 |
+
$data[$key][2] = $val->run->model;
|
40 |
+
$tmp = explode("::", $val->run->model);
|
41 |
+
$data[$key][3] = get_class(Mage::getConfig()->getModelInstance($tmp[0]));
|
42 |
+
};
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
$config = Mage::getConfig()->getNode('default/crontab/jobs');
|
47 |
+
if ($config instanceof Mage_Core_Model_Config_Element) {
|
48 |
+
foreach ($config->children() as $key => $val) {
|
49 |
+
if (!isset($data[$key])) {
|
50 |
+
$data[$key][0] = $key;
|
51 |
+
$data[$key][1] = $val->schedule->cron_expr;
|
52 |
+
$data[$key][2] = $val->run->model;
|
53 |
+
$data[$key][3] = get_class(Mage::getConfig()->getModelInstance($key));
|
54 |
+
$tmp = explode("::", $val->run->model);
|
55 |
+
$data[$key][3] = get_class(Mage::getConfig()->getModelInstance($tmp[0]));
|
56 |
+
};
|
57 |
+
}
|
58 |
+
}
|
59 |
+
if($code==null)
|
60 |
+
return $data;
|
61 |
+
else
|
62 |
+
{
|
63 |
+
return $data[$code];
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
app/code/local/Centerkom/Scheduler/Model/Mysql4/Scheduler.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Model_Mysql4_Scheduler extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
$this->_init('scheduler/scheduler', 'schedule_id');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Centerkom/Scheduler/Model/Mysql4/Scheduler/Collection.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Model_Mysql4_Scheduler_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('scheduler/scheduler');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Centerkom/Scheduler/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
|
3 |
+
}
|
4 |
+
?>
|
app/code/local/Centerkom/Scheduler/Model/Scheduler.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Centerkom_Scheduler_Model_Scheduler extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('scheduler/scheduler');
|
8 |
+
}
|
9 |
+
|
10 |
+
|
11 |
+
public function run()
|
12 |
+
{
|
13 |
+
$collection = $this->getCollection()
|
14 |
+
->addFieldToFilter('scheduled_at', array("lteq"=> date('Y-m-d H:i:s', Mage::getModel('core/date')->timestamp(time())) ))
|
15 |
+
->addFieldToFilter('executed_at', array("null"=>true));
|
16 |
+
//echo "ilosc : ".count($collection)." zap : ".$collection->getSelect();
|
17 |
+
|
18 |
+
foreach($collection as $key=>$item)
|
19 |
+
{
|
20 |
+
//var_dump($item->getData());
|
21 |
+
$item->setExecutedAt(date('Y-m-d H:i:s', Mage::getModel('core/date')->timestamp(time())));
|
22 |
+
$item->setStatus('running');
|
23 |
+
$item->save();
|
24 |
+
|
25 |
+
try
|
26 |
+
{
|
27 |
+
$success=eval( $item->getJobCode() );
|
28 |
+
if($success===false)
|
29 |
+
{
|
30 |
+
$item->setMessages ('Error: could not run expression.');
|
31 |
+
$item->setStatus('error');
|
32 |
+
}
|
33 |
+
else
|
34 |
+
{
|
35 |
+
$item->setMessages ($success);
|
36 |
+
$item->setStatus('success');
|
37 |
+
}
|
38 |
+
}
|
39 |
+
catch (Exception $e)
|
40 |
+
{
|
41 |
+
$item->setMessages($e->getMessage());
|
42 |
+
$item->setStatus('error');
|
43 |
+
}
|
44 |
+
|
45 |
+
$item->setFinishedAt(date('Y-m-d H:i:s', Mage::getModel('core/date')->timestamp(time())));
|
46 |
+
$item->save();
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
app/code/local/Centerkom/Scheduler/controllers/Adminhtml/ConfigController.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerkom_Scheduler_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction() {
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->_setActiveMenu('system');
|
9 |
+
|
10 |
+
$block = $this->getLayout()->createBlock('scheduler/adminhtml_config_list');
|
11 |
+
|
12 |
+
$this->_addContent($block);
|
13 |
+
|
14 |
+
$this->renderLayout();
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Centerkom/Scheduler/controllers/Adminhtml/MyschedulerController.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerkom_Scheduler_Adminhtml_MyschedulerController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction() {
|
7 |
+
|
8 |
+
$this->loadLayout();
|
9 |
+
$this->_setActiveMenu('system');
|
10 |
+
|
11 |
+
$block = $this->getLayout()->createBlock('scheduler/adminhtml_myscheduler_list');
|
12 |
+
|
13 |
+
$this->_addContent($block);
|
14 |
+
|
15 |
+
$this->renderLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function editAction() {
|
19 |
+
$this->loadLayout();
|
20 |
+
$this->_setActiveMenu('system');
|
21 |
+
|
22 |
+
$block = $this->getLayout()->createBlock('scheduler/adminhtml_myscheduler_edit');
|
23 |
+
|
24 |
+
$this->_addContent($block);
|
25 |
+
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function newAction() {
|
30 |
+
$this->loadLayout();
|
31 |
+
$this->_setActiveMenu('system');
|
32 |
+
|
33 |
+
$block = $this->getLayout()->createBlock('scheduler/adminhtml_myscheduler_edit');
|
34 |
+
|
35 |
+
$this->_addContent($block);
|
36 |
+
|
37 |
+
$this->renderLayout();
|
38 |
+
}
|
39 |
+
|
40 |
+
public function addAction() {
|
41 |
+
|
42 |
+
if ($data = $this->getRequest()->getPost()) {
|
43 |
+
$data['scheduled_at'] = $data['date']." ".$data['time'][0].":".$data['time'][1].":".$data['time'][2];
|
44 |
+
//var_dump($data);
|
45 |
+
$model = Mage::getModel('scheduler/scheduler');
|
46 |
+
$model->addData($data);
|
47 |
+
$model->save();
|
48 |
+
|
49 |
+
$session = Mage::getSingleton('adminhtml/session');
|
50 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('Added new job.'));
|
51 |
+
}
|
52 |
+
$this->_redirect('*/*/', array('_current' => array('section', 'website', 'store')));
|
53 |
+
}
|
54 |
+
|
55 |
+
public function saveAction() {
|
56 |
+
|
57 |
+
if ($data = $this->getRequest()->getPost()) {
|
58 |
+
$data['scheduled_at'] = $data['date']." ".$data['time'][0].":".$data['time'][1].":".$data['time'][2];
|
59 |
+
$data['schedule_id'] = $this->getRequest()->getParam('id');
|
60 |
+
//var_dump($data);
|
61 |
+
$model = Mage::getModel('scheduler/scheduler')
|
62 |
+
->getCollection()
|
63 |
+
->addFieldToFilter('schedule_id', $this->getRequest()->getParam('id'))
|
64 |
+
->getFirstItem();
|
65 |
+
|
66 |
+
$model->setData($data);
|
67 |
+
$model->save();
|
68 |
+
|
69 |
+
$session = Mage::getSingleton('adminhtml/session');
|
70 |
+
$session->addSuccess(Mage::helper('adminhtml')->__('Added new job.'));
|
71 |
+
}
|
72 |
+
$this->_redirect('*/*/', array('_current' => array('section', 'website', 'store')));
|
73 |
+
}
|
74 |
+
}
|
app/code/local/Centerkom/Scheduler/controllers/Adminhtml/SchedulerController.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Centerkom_Scheduler_Adminhtml_SchedulerController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction() {
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->_setActiveMenu('system');
|
9 |
+
|
10 |
+
$block = $this->getLayout()->createBlock('scheduler/adminhtml_scheduler_list');
|
11 |
+
|
12 |
+
$this->_addContent($block);
|
13 |
+
|
14 |
+
$this->renderLayout();
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Centerkom/Scheduler/etc/config.xml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Centerkom_Scheduler>
|
5 |
+
<version>0.2.0</version>
|
6 |
+
</Centerkom_Scheduler>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<scheduler>
|
11 |
+
<class>Centerkom_Scheduler_Block</class>
|
12 |
+
</scheduler>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<scheduler>
|
16 |
+
<class>Centerkom_Scheduler_Helper</class>
|
17 |
+
</scheduler>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<scheduler>
|
21 |
+
<class>Centerkom_Scheduler_Model</class>
|
22 |
+
<resourceModel>scheduler_mysql4</resourceModel>
|
23 |
+
</scheduler>
|
24 |
+
<scheduler_mysql4>
|
25 |
+
<class>Centerkom_Scheduler_Model_Mysql4</class>
|
26 |
+
<entities>
|
27 |
+
<scheduler>
|
28 |
+
<table>centerkom_scheduler</table>
|
29 |
+
</scheduler>
|
30 |
+
</entities>
|
31 |
+
</scheduler_mysql4>
|
32 |
+
</models>
|
33 |
+
<resources>
|
34 |
+
<scheduler>
|
35 |
+
<setup>
|
36 |
+
<module>Centerkom_Scheduler</module>
|
37 |
+
<class>Centerkom_Scheduler_Model_Resource_Setup</class>
|
38 |
+
</setup>
|
39 |
+
</scheduler>
|
40 |
+
<scheduler_write>
|
41 |
+
<connection>
|
42 |
+
<use>core_write</use>
|
43 |
+
</connection>
|
44 |
+
</scheduler_write>
|
45 |
+
<scheduler_read>
|
46 |
+
<connection>
|
47 |
+
<use>core_read</use>
|
48 |
+
</connection>
|
49 |
+
</scheduler_read>
|
50 |
+
</resources>
|
51 |
+
</global>
|
52 |
+
<admin>
|
53 |
+
<routers>
|
54 |
+
<scheduler>
|
55 |
+
<use>admin</use>
|
56 |
+
<args>
|
57 |
+
<module>Centerkom_Scheduler</module>
|
58 |
+
<frontName>scheduler</frontName>
|
59 |
+
</args>
|
60 |
+
</scheduler>
|
61 |
+
</routers>
|
62 |
+
</admin>
|
63 |
+
<adminhtml>
|
64 |
+
<menu>
|
65 |
+
<system>
|
66 |
+
<children>
|
67 |
+
<scheduler_adminform translate="title" module="scheduler">
|
68 |
+
<title>Scheduler</title>
|
69 |
+
<children>
|
70 |
+
<scheduler_adminform_cron translate="title">
|
71 |
+
<title>System jobs View</title>
|
72 |
+
<sort_order>20</sort_order>
|
73 |
+
<action>scheduler/adminhtml_scheduler</action>
|
74 |
+
</scheduler_adminform_cron>
|
75 |
+
<scheduler_adminform_user translate="title">
|
76 |
+
<title>User jobs View</title>
|
77 |
+
<sort_order>20</sort_order>
|
78 |
+
<action>scheduler/adminhtml_myscheduler</action>
|
79 |
+
</scheduler_adminform_user>
|
80 |
+
<scheduler_adminform_config translate="title">
|
81 |
+
<title>System cron list</title>
|
82 |
+
<sort_order>20</sort_order>
|
83 |
+
<action>scheduler/adminhtml_config</action>
|
84 |
+
</scheduler_adminform_config>
|
85 |
+
</children>
|
86 |
+
</scheduler_adminform>
|
87 |
+
</children>
|
88 |
+
</system>
|
89 |
+
</menu>
|
90 |
+
<acl>
|
91 |
+
<resources>
|
92 |
+
<admin>
|
93 |
+
<children>
|
94 |
+
<system>
|
95 |
+
<children>
|
96 |
+
<scheduler_adminform>
|
97 |
+
<title>Scheduler</title>
|
98 |
+
</scheduler_adminform>
|
99 |
+
</children>
|
100 |
+
</system>
|
101 |
+
</children>
|
102 |
+
</admin>
|
103 |
+
</resources>
|
104 |
+
</acl>
|
105 |
+
</adminhtml>
|
106 |
+
|
107 |
+
<crontab>
|
108 |
+
<jobs>
|
109 |
+
<scheduler_run>
|
110 |
+
<schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
|
111 |
+
<run><model>scheduler/scheduler::run</model></run>
|
112 |
+
</scheduler_run>
|
113 |
+
</jobs>
|
114 |
+
</crontab>
|
115 |
+
</config>
|
app/code/local/Centerkom/Scheduler/sql/scheduler/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
$installer->startSetup();
|
4 |
+
$installer->run("
|
5 |
+
CREATE TABLE IF NOT EXISTS `centerkom_scheduler` (
|
6 |
+
`schedule_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Schedule Id',
|
7 |
+
`job_name` varchar(255) NOT NULL DEFAULT '0' COMMENT 'Job Code',
|
8 |
+
`job_code` text,
|
9 |
+
`status` varchar(7) NOT NULL DEFAULT 'pending' COMMENT 'Status',
|
10 |
+
`messages` text COMMENT 'Messages',
|
11 |
+
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Created At',
|
12 |
+
`scheduled_at` timestamp NULL DEFAULT NULL COMMENT 'Scheduled At',
|
13 |
+
`scheduled_regularly` varchar(100) DEFAULT NULL,
|
14 |
+
`executed_at` timestamp NULL DEFAULT NULL COMMENT 'Executed At',
|
15 |
+
`finished_at` timestamp NULL DEFAULT NULL COMMENT 'Finished At',
|
16 |
+
PRIMARY KEY (`schedule_id`),
|
17 |
+
KEY `IDX_CRON_SCHEDULE_JOB_CODE` (`job_name`),
|
18 |
+
KEY `IDX_CRON_SCHEDULE_SCHEDULED_AT_STATUS` (`scheduled_at`,`status`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Cron Schedule' AUTO_INCREMENT=1 ;
|
20 |
+
");
|
21 |
+
$installer->endSetup();
|
app/etc/modules/Centerkom_Scheduler.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Centerkom_Scheduler>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Centerkom_Scheduler>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>centerkom_scheduler</name>
|
4 |
+
<version>0.2.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>View list your scheduler/cron tasks and add your simple task. </summary>
|
10 |
+
<description>This extension allows you to manage your scheduler task. You get simple tool to show scheduler and cron from magento. And if you have add simple code to execute at specific time you can do it with our tool.</description>
|
11 |
+
<notes>View list your scheduler/cron tasks and add your simple task. 4543543</notes>
|
12 |
+
<authors><author><name>Jaroslaw</name><user>Herisz</user><email>jarek@herisz.pl</email></author></authors>
|
13 |
+
<date>2012-10-07</date>
|
14 |
+
<time>12:58:27</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Centerkom"><dir name="Scheduler"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="List"><file name="Grid.php" hash="3d01a4d924667f492d7b3ee3a97b158a"/></dir><file name="List.php" hash="61a7e75b15c43146567bc9578d43c864"/></dir><dir name="Myscheduler"><dir name="Edit"><file name="Form.php" hash="7142503765d8e9fb35a862e1ec09886f"/></dir><file name="Edit.php" hash="ba7bb90cdcd898b4ecc7e88454f94ced"/><dir name="List"><file name="Grid.php" hash="87ab5549f2fc22d372a32c6703729775"/></dir><file name="List.php" hash="2964e79d79b130eee47e18ff646d0297"/></dir><dir name="Scheduler"><dir name="List"><file name="Grid.php" hash="14f9aa12ca7ec38df9ee1839d63584bd"/></dir><file name="List.php" hash="4d7357e7c4ade93ebbf79b96a02577f9"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="1fb059af4d0941c03216d2e7b08f9925"/></dir><dir name="Model"><file name="Crons.php" hash="85d87ce47b449df45b415477fd07dffe"/><dir name="Mysql4"><dir name="Scheduler"><file name="Collection.php" hash="2ec63c663d767da1ae2fbf623a2343fb"/></dir><file name="Scheduler.php" hash="e78ebcc348598d7942a36dd71135cb0f"/></dir><dir name="Resource"><file name="Setup.php" hash="9d178d8f1462bfca322a5cfdde8a520c"/></dir><file name="Scheduler.php" hash="40f9dbb6c69a5323d4011e955c687c5e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="86ae08637c897fbc1dfdd0d5053155f1"/><file name="MyschedulerController.php" hash="96f3b155fa94a6dbebf402b14e85708d"/><file name="SchedulerController.php" hash="584eb8ab1ed9ca4754a5adb23c34e4eb"/></dir></dir><dir name="etc"><file name="config.xml" hash="f39a85b712de5f36613b2f9ebd4dda9b"/></dir><dir name="sql"><dir name="scheduler"><file name="mysql4-install-0.1.0.php" hash="26175d6f2f8452b8a88d50b32a5789a0"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Centerkom_Scheduler.xml" hash="e4a0e0cc1d41ddc60c0d52e904212552"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.3.0</max></php></required></dependencies>
|
18 |
+
</package>
|