Aoe_Scheduler - Version 0.2.2

Version Notes

Added heartbeat.
Fixed acl bug.

Check http://www.fabrizio-branca.de/magento-cron-scheduler.html for a summary of new features and bugfixes

Download this release

Release Info

Developer Magento Core Team
Extension Aoe_Scheduler
Version 0.2.2
Comparing to
See all releases


Code changes from version 0.2.1 to 0.2.2

app/code/local/Aoe/Scheduler/Model/Collection/Crons.php CHANGED
@@ -12,8 +12,8 @@ class Aoe_Scheduler_Model_Collection_Crons extends Varien_Data_Collection {
12
  /**
13
  * Load data
14
  *
15
- * @param (not used)
16
- * @param (not used)
17
  * @return Aoe_Scheduler_Model_Collection_Crons
18
  */
19
  public function loadData($printQuery = false, $logQuery = false) {
12
  /**
13
  * Load data
14
  *
15
+ * @param bool $printQuery
16
+ * @param bool $logQuery
17
  * @return Aoe_Scheduler_Model_Collection_Crons
18
  */
19
  public function loadData($printQuery = false, $logQuery = false) {
app/code/local/Aoe/Scheduler/Model/HeartbeatTask.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Aoe_Scheduler_Model_HeartbeatTask {
4
+
5
+ public function run() {
6
+ return true;
7
+ }
8
+
9
+ }
app/code/local/Aoe/Scheduler/Model/Schedule.php CHANGED
@@ -50,7 +50,7 @@ class Aoe_Scheduler_Model_Schedule extends Mage_Cron_Model_Schedule {
50
  }
51
  $this->setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
52
 
53
- $messages = call_user_func_array($callback, array());
54
 
55
  // added by Fabrizio to also save messages when no exception was thrown
56
  if (!empty($messages)) {
50
  }
51
  $this->setExecutedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
52
 
53
+ $messages = call_user_func_array($callback, array($this));
54
 
55
  // added by Fabrizio to also save messages when no exception was thrown
56
  if (!empty($messages)) {
app/code/local/Aoe/Scheduler/etc/adminhtml.xml CHANGED
@@ -35,8 +35,22 @@
35
  <system>
36
  <children>
37
  <aoe_scheduler translate="title" module="aoe_scheduler">
38
- <title>Scheduler</title>
39
  <sort_order>1</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  </aoe_scheduler>
41
  </children>
42
  </system>
35
  <system>
36
  <children>
37
  <aoe_scheduler translate="title" module="aoe_scheduler">
38
+ <title>AOE Scheduler</title>
39
  <sort_order>1</sort_order>
40
+ <children>
41
+ <aoe_scheduler_cron translate="title">
42
+ <title>Schedule Configuration</title>
43
+ <sort_order>10</sort_order>
44
+ </aoe_scheduler_cron>
45
+ <aoe_scheduler_scheduler translate="title">
46
+ <title>List View</title>
47
+ <sort_order>20</sort_order>
48
+ </aoe_scheduler_scheduler>
49
+ <aoe_scheduler_timeline translate="title">
50
+ <title>Timeline View</title>
51
+ <sort_order>30</sort_order>
52
+ </aoe_scheduler_timeline>
53
+ </children>
54
  </aoe_scheduler>
55
  </children>
56
  </system>
app/code/local/Aoe/Scheduler/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Aoe_Scheduler>
5
- <version>0.2.1</version>
6
  </Aoe_Scheduler>
7
  </modules>
8
 
@@ -64,19 +64,25 @@
64
  </layout>
65
  </adminhtml>
66
 
67
- <!-- <crontab>
68
  <jobs>
69
- <aoescheduler_testtask>
70
  <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
71
  <run><model>aoe_scheduler/testTask::run</model></run>
72
- </aoescheduler_testtask>
 
 
 
 
 
73
  </jobs>
74
- </crontab> -->
75
 
76
  <default>
77
  <system>
78
  <cron>
79
  <max_running_time>120</max_running_time>
 
80
  </cron>
81
  </system>
82
  </default>
2
  <config>
3
  <modules>
4
  <Aoe_Scheduler>
5
+ <version>0.2.2</version>
6
  </Aoe_Scheduler>
7
  </modules>
8
 
64
  </layout>
65
  </adminhtml>
66
 
67
+ <crontab>
68
  <jobs>
69
+ <!-- <aoescheduler_testtask>
70
  <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
71
  <run><model>aoe_scheduler/testTask::run</model></run>
72
+ </aoescheduler_testtask> -->
73
+
74
+ <aoescheduler_heartbeat>
75
+ <schedule><config_path>system/cron/scheduler_cron_expr_heartbeat</config_path></schedule>
76
+ <run><model>aoe_scheduler/heartbeatTask::run</model></run>
77
+ </aoescheduler_heartbeat>
78
  </jobs>
79
+ </crontab>
80
 
81
  <default>
82
  <system>
83
  <cron>
84
  <max_running_time>120</max_running_time>
85
+ <scheduler_cron_expr_heartbeat>*/5 * * * *</scheduler_cron_expr_heartbeat>
86
  </cron>
87
  </system>
88
  </default>
app/code/local/Aoe/Scheduler/etc/system.xml CHANGED
@@ -22,6 +22,14 @@
22
  <show_in_website>0</show_in_website>
23
  <show_in_store>0</show_in_store>
24
  </max_running_time>
 
 
 
 
 
 
 
 
25
  </fields>
26
  </cron>
27
  </groups>
22
  <show_in_website>0</show_in_website>
23
  <show_in_store>0</show_in_store>
24
  </max_running_time>
25
+ <scheduler_cron_expr_heartbeat>
26
+ <label>Heartbeat task schedule (cron syntax)</label>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>110</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>0</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </scheduler_cron_expr_heartbeat>
33
  </fields>
34
  </cron>
35
  </groups>
package.xml CHANGED
@@ -1,20 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Aoe_Scheduler</name>
4
- <version>0.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Scheduler / Cron Management</summary>
10
  <description>This extension allows you to manage your scheduler task. Schedules can be disabled. From version 0.1.0 this extension also comes with a graphical timeline view.</description>
11
- <notes>Bugfix release.&#xD;
 
12
  &#xD;
13
  Check http://www.fabrizio-branca.de/magento-cron-scheduler.html for a summary of new features and bugfixes</notes>
14
  <authors><author><name>Fabrizio Branca</name><user>auto-converted</user><email>magento@fabrizio-branca.de</email></author></authors>
15
- <date>2011-12-15</date>
16
- <time>21:39:04</time>
17
- <contents><target name="magelocal"><dir name="Aoe"><dir name="Scheduler"><dir name="Block"><dir name="Adminhtml"><dir name="Cron"><file name="Grid.php" hash="794200ea4a6885a19b86c972d06b3693"/></dir><dir name="Scheduler"><file name="Grid.php" hash="73eb69714d3ec1a6b3e5ceb566067ad1"/></dir><file name="Cron.php" hash="f3fe20d102c7ddff6c1a4f72c14ab95f"/><file name="Scheduler.php" hash="a9d0f50f2a66532f76746cc311ad1b09"/><file name="Timeline.php" hash="4febff14b58b081b3df00871a3ce0d8e"/><file name="TimelineDetail.php" hash="0cdc46705c070dee76c6938175586c6a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9ba5f7c21da1a226e531162b9e9622d2"/></dir><dir name="Model"><dir name="Collection"><file name="Crons.php" hash="733ae06d490b4b371d70ee275bd3a3a9"/></dir><file name="Api.php" hash="2f674c989ec27b19f2f5530fcf698c0c"/><file name="Configuration.php" hash="1c21f0c4fa50cd4980fe1bdb7e4956f3"/><file name="Observer.php" hash="e16ed30761103862660a771915d6577f"/><file name="Schedule.php" hash="299b3bca57e6aa16e3be6f834d103413"/><file name="TestTask.php" hash="96ac1c00c24cf959cbef452dd57900e4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AbstractController.php" hash="4435f29815e4253eb47f15221b5c0d43"/><file name="CronController.php" hash="fdb5947cb2a45ba4e616cb78127a217a"/><file name="SchedulerController.php" hash="95ffe62214e872e566332de6a2141cab"/><file name="TimelineController.php" hash="c0ccb4163c8495c9b8b07a869e27563b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="42f04275451a6837516cdcef0a14c40b"/><file name="api.xml" hash="cc6cc05874a1277ba53e07c3450541c5"/><file name="config.xml" hash="bdf9556a60d441c99a4bb5d54b29320d"/><file name="system.xml" hash="eb17e005b5f9ea5617be7b728e5c7c8c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aoe_Scheduler.xml" hash="3fa179507d5b3b3f1cde3be281ee1a26"/></dir></target><target name="mage"><dir name="shell"><file name="scheduler.php" hash="1d9ab318d9cc13448cd93a99038f9b3b"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Aoe_Scheduler.csv" hash="f06c379c1170bc67f978b05943197601"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="aoe_scheduler"><file name="timeline.phtml" hash="9b8bf5864319542e8aa6ecc19efa5108"/><file name="timeline_detail.phtml" hash="d353689ad539f2adc0df97716ff7eb88"/></dir></dir><dir name="layout"><dir name="aoe_scheduler"><file name="aoe_scheduler.xml" hash="95be2d020b3281f3400a2edb809fce79"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="aoe_scheduler"><dir name="Images"><file name="bg_notifications.gif" hash="df73b8aa7e48bb56e0a644245aa3683f"/><file name="gradient.png" hash="17f6c6ef64b1682a06060950933561c9"/><file name="hour.gif" hash="91a63b82b2b41a046ca938aea3238a41"/></dir><dir name="JavaScript"><file name="common.js" hash="af6dadb7e3a18a2d4a882d9249f3f7a0"/><file name="jquery-1.6.2.min.js" hash="a1a8cb16a060f6280a767187fd22e037"/><file name="tooltip.dynamic.js" hash="c6737dd54890ca0cac816f3fecaf33d9"/><file name="tooltip.js" hash="d731eecbe152f86d3c702b55b4767fb1"/></dir><dir name="StyleSheet"><file name="bars.css" hash="c98df4a3611f628dba01b8cd0142f3d2"/><file name="timeline.css" hash="41510bd533aaeab5df46fa49210cfc9f"/></dir></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Aoe_Scheduler</name>
4
+ <version>0.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Scheduler / Cron Management</summary>
10
  <description>This extension allows you to manage your scheduler task. Schedules can be disabled. From version 0.1.0 this extension also comes with a graphical timeline view.</description>
11
+ <notes>Added heartbeat.&#xD;
12
+ Fixed acl bug.&#xD;
13
  &#xD;
14
  Check http://www.fabrizio-branca.de/magento-cron-scheduler.html for a summary of new features and bugfixes</notes>
15
  <authors><author><name>Fabrizio Branca</name><user>auto-converted</user><email>magento@fabrizio-branca.de</email></author></authors>
16
+ <date>2012-01-30</date>
17
+ <time>21:42:26</time>
18
+ <contents><target name="magelocal"><dir name="Aoe"><dir name="Scheduler"><dir name="Block"><dir name="Adminhtml"><dir name="Cron"><file name="Grid.php" hash="794200ea4a6885a19b86c972d06b3693"/></dir><dir name="Scheduler"><file name="Grid.php" hash="73eb69714d3ec1a6b3e5ceb566067ad1"/></dir><file name="Cron.php" hash="f3fe20d102c7ddff6c1a4f72c14ab95f"/><file name="Scheduler.php" hash="a9d0f50f2a66532f76746cc311ad1b09"/><file name="Timeline.php" hash="4febff14b58b081b3df00871a3ce0d8e"/><file name="TimelineDetail.php" hash="0cdc46705c070dee76c6938175586c6a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9ba5f7c21da1a226e531162b9e9622d2"/></dir><dir name="Model"><dir name="Collection"><file name="Crons.php" hash="9ec07bc98bf6ce69ba830490d224ea81"/></dir><file name="Api.php" hash="2f674c989ec27b19f2f5530fcf698c0c"/><file name="Configuration.php" hash="1c21f0c4fa50cd4980fe1bdb7e4956f3"/><file name="HeartbeatTask.php" hash="0c8e9cb7c28cb412b20062ee1d6647b5"/><file name="Observer.php" hash="e16ed30761103862660a771915d6577f"/><file name="Schedule.php" hash="6a9b0c469ccf667e1a8011e25492f2d0"/><file name="TestTask.php" hash="96ac1c00c24cf959cbef452dd57900e4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AbstractController.php" hash="4435f29815e4253eb47f15221b5c0d43"/><file name="CronController.php" hash="fdb5947cb2a45ba4e616cb78127a217a"/><file name="SchedulerController.php" hash="95ffe62214e872e566332de6a2141cab"/><file name="TimelineController.php" hash="c0ccb4163c8495c9b8b07a869e27563b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="40a0190b9c9e79f69c05fb6308b1310e"/><file name="api.xml" hash="cc6cc05874a1277ba53e07c3450541c5"/><file name="config.xml" hash="5fe36afc8a5d9112c06aa7c462d64d73"/><file name="system.xml" hash="0aa6a79823460c3aeb5a955f5123f3c0"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aoe_Scheduler.xml" hash="3fa179507d5b3b3f1cde3be281ee1a26"/></dir></target><target name="mage"><dir name="shell"><file name="scheduler.php" hash="126f850a96a163db7fa8e82c16998507"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Aoe_Scheduler.csv" hash="f06c379c1170bc67f978b05943197601"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="aoe_scheduler"><file name="timeline.phtml" hash="9b8bf5864319542e8aa6ecc19efa5108"/><file name="timeline_detail.phtml" hash="d353689ad539f2adc0df97716ff7eb88"/></dir></dir><dir name="layout"><dir name="aoe_scheduler"><file name="aoe_scheduler.xml" hash="95be2d020b3281f3400a2edb809fce79"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="aoe_scheduler"><dir name="Images"><file name="bg_notifications.gif" hash="df73b8aa7e48bb56e0a644245aa3683f"/><file name="gradient.png" hash="17f6c6ef64b1682a06060950933561c9"/><file name="hour.gif" hash="91a63b82b2b41a046ca938aea3238a41"/></dir><dir name="JavaScript"><file name="common.js" hash="af6dadb7e3a18a2d4a882d9249f3f7a0"/><file name="jquery-1.6.2.min.js" hash="a1a8cb16a060f6280a767187fd22e037"/><file name="tooltip.dynamic.js" hash="c6737dd54890ca0cac816f3fecaf33d9"/><file name="tooltip.js" hash="d731eecbe152f86d3c702b55b4767fb1"/></dir><dir name="StyleSheet"><file name="bars.css" hash="c98df4a3611f628dba01b8cd0142f3d2"/><file name="timeline.css" hash="41510bd533aaeab5df46fa49210cfc9f"/></dir></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies/>
21
  </package>
shell/scheduler.php CHANGED
@@ -3,7 +3,7 @@
3
  require_once 'abstract.php';
4
 
5
  class Aoe_Scheduler_Shell_Scheduler extends Mage_Shell_Abstract {
6
-
7
  /**
8
  * Run script
9
  *
@@ -15,26 +15,26 @@ class Aoe_Scheduler_Shell_Scheduler extends Mage_Shell_Abstract {
15
  echo $this->usageHelp();
16
  } else {
17
  $actionMethodName = $action.'Action';
18
- if (method_exists($this, $actionMethodName)) {
19
- $this->$actionMethodName();
20
- } else {
21
- echo "Action $action not found!\n";
22
- echo $this->usageHelp();
23
- exit(1);
24
- }
25
  }
26
  }
27
-
28
-
29
-
30
- /**
31
- * Retrieve Usage Help Message
32
- *
33
- * @return string
34
- */
35
- public function usageHelp() {
36
- $help = 'Available actions: ' . "\n";
37
- $methods = get_class_methods($this);
38
  foreach ($methods as $method) {
39
  if (substr($method, -6) == 'Action') {
40
  $help .= ' -action ' . substr($method, 0, -6);
@@ -45,85 +45,132 @@ class Aoe_Scheduler_Shell_Scheduler extends Mage_Shell_Abstract {
45
  $help .= "\n";
46
  }
47
  }
48
- return $help;
49
- }
50
-
51
-
52
-
53
- /**
54
- * List all availables codes / jobs
55
- *
56
- * @return void
57
- */
58
- public function listAllCodesAction() {
59
- $collection = Mage::getModel('aoe_scheduler/collection_crons');
60
- foreach ($collection as $configuration) { /* @var $configuration Aoe_Scheduler_Model_Configuration */
61
- echo sprintf("%-50s %-20s %s\n", $configuration->getId(), $configuration->getCronExpr(), $configuration->getStatus());
62
- }
63
- }
64
-
65
-
66
-
67
- /**
68
- * Schedule a job now
69
- *
70
- * @return void
71
- */
72
- public function scheduleNowAction() {
73
- $code = $this->getArg('code');
74
- if (empty($code)) {
75
- echo "\nNo code found!\n\n";
76
- echo $this->usageHelp();
77
- exit(1);
78
- }
79
- $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
80
- $schedule->setJobCode($code);
81
- $schedule->scheduleNow();
82
- $schedule->save();
83
- }
84
-
85
-
86
-
87
- /**
88
- * Display extra help
89
- *
90
- * @return string
91
- */
92
- public function scheduleNowActionHelp() {
93
- return " -code <code> Schedule a job to be executed as soon as possible";
94
- }
95
-
96
-
97
-
98
- /**
99
- * Run a job now
100
- *
101
- * @return void
102
- */
103
- public function runNowAction() {
104
- $code = $this->getArg('code');
105
- if (empty($code)) {
106
- echo "\nNo code found!\n\n";
107
- echo $this->usageHelp();
108
- exit(1);
109
- }
110
- $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
111
- $schedule->setJobCode($code);
112
- $schedule->runNow();
113
- $schedule->save();
114
- }
115
-
116
-
117
-
118
- /**
119
- * Display extra help
120
- *
121
- * @return string
122
- */
123
- public function runNowActionHelp() {
124
- return " -code <code> Run a job directly";
125
- }
126
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
  $shell = new Aoe_Scheduler_Shell_Scheduler();
3
  require_once 'abstract.php';
4
 
5
  class Aoe_Scheduler_Shell_Scheduler extends Mage_Shell_Abstract {
6
+
7
  /**
8
  * Run script
9
  *
15
  echo $this->usageHelp();
16
  } else {
17
  $actionMethodName = $action.'Action';
18
+ if (method_exists($this, $actionMethodName)) {
19
+ $this->$actionMethodName();
20
+ } else {
21
+ echo "Action $action not found!\n";
22
+ echo $this->usageHelp();
23
+ exit(1);
24
+ }
25
  }
26
  }
27
+
28
+
29
+
30
+ /**
31
+ * Retrieve Usage Help Message
32
+ *
33
+ * @return string
34
+ */
35
+ public function usageHelp() {
36
+ $help = 'Available actions: ' . "\n";
37
+ $methods = get_class_methods($this);
38
  foreach ($methods as $method) {
39
  if (substr($method, -6) == 'Action') {
40
  $help .= ' -action ' . substr($method, 0, -6);
45
  $help .= "\n";
46
  }
47
  }
48
+ return $help;
49
+ }
50
+
51
+
52
+
53
+ /**
54
+ * List all availables codes / jobs
55
+ *
56
+ * @return void
57
+ */
58
+ public function listAllCodesAction() {
59
+ $collection = Mage::getModel('aoe_scheduler/collection_crons');
60
+ foreach ($collection as $configuration) { /* @var $configuration Aoe_Scheduler_Model_Configuration */
61
+ echo sprintf("%-50s %-20s %s\n", $configuration->getId(), $configuration->getCronExpr(), $configuration->getStatus());
62
+ }
63
+ }
64
+
65
+
66
+
67
+ /**
68
+ * Returns the timestamp of the last run of a given job
69
+ *
70
+ * @return void
71
+ */
72
+ public function lastRunAction() {
73
+
74
+ $code = $this->getArg('code');
75
+ if (empty($code)) {
76
+ echo "\nNo code found!\n\n";
77
+ echo $this->usageHelp();
78
+ exit(1);
79
+ }
80
+
81
+ $collection = Mage::getModel('cron/schedule')->getCollection(); /* @var $collection Mage_Cron_Model_Resource_Schedule_Collection */
82
+ $collection->addFieldToFilter('job_code', $code)
83
+ ->addFieldToFilter('status', Mage_Cron_Model_Schedule::STATUS_SUCCESS)
84
+ ->addOrder('finished_at', Varien_Data_Collection_Db::SORT_ORDER_DESC)
85
+ ->getSelect()->limit(1);
86
+ $schedule = $collection->getFirstItem(); /* @var $schedule Aoe_Scheduler_Model_Schedule */
87
+ if (!$schedule || !$schedule->getId()) {
88
+ echo "\nNo schedule found\n\n";
89
+ exit(1);
90
+ }
91
+
92
+ $time = strtotime($schedule->getFinishedAt());
93
+
94
+ if ($this->getArg('secondsFromNow')) {
95
+ $time = time() - $time;
96
+ }
97
+
98
+ echo $time . PHP_EOL;
99
+ }
100
+
101
+
102
+
103
+ /**
104
+ * Display extra help
105
+ *
106
+ * @return string
107
+ */
108
+ public function lastRunActionHelp() {
109
+ return " -code <code> [-secondsFromNow] Get the timestamp of the last successful run of a job for a given code";
110
+ }
111
+
112
+
113
+
114
+ /**
115
+ * Schedule a job now
116
+ *
117
+ * @return void
118
+ */
119
+ public function scheduleNowAction() {
120
+ $code = $this->getArg('code');
121
+ if (empty($code)) {
122
+ echo "\nNo code found!\n\n";
123
+ echo $this->usageHelp();
124
+ exit(1);
125
+ }
126
+ $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
127
+ $schedule->setJobCode($code);
128
+ $schedule->scheduleNow();
129
+ $schedule->save();
130
+ }
131
+
132
+
133
+
134
+ /**
135
+ * Display extra help
136
+ *
137
+ * @return string
138
+ */
139
+ public function scheduleNowActionHelp() {
140
+ return " -code <code> Schedule a job to be executed as soon as possible";
141
+ }
142
+
143
+
144
+
145
+ /**
146
+ * Run a job now
147
+ *
148
+ * @return void
149
+ */
150
+ public function runNowAction() {
151
+ $code = $this->getArg('code');
152
+ if (empty($code)) {
153
+ echo "\nNo code found!\n\n";
154
+ echo $this->usageHelp();
155
+ exit(1);
156
+ }
157
+ $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
158
+ $schedule->setJobCode($code);
159
+ $schedule->runNow();
160
+ $schedule->save();
161
+ }
162
+
163
+
164
+
165
+ /**
166
+ * Display extra help
167
+ *
168
+ * @return string
169
+ */
170
+ public function runNowActionHelp() {
171
+ return " -code <code> Run a job directly";
172
+ }
173
+
174
  }
175
 
176
  $shell = new Aoe_Scheduler_Shell_Scheduler();