@@ -28,16 +28,16 @@ class script extends eqLogic {
2828
2929 /* * ***********************Méthodes statiques*************************** */
3030
31- public static function cron () {
32- $ dateRun = new DateTime ();
33- foreach (eqLogic::byType ('script ' ) as $ eqLogic ) {
31+ public static function cronUpdate () {
32+ foreach (eqLogic::byType ('script ' , true ) as $ eqLogic ) {
3433 $ autorefresh = $ eqLogic ->getConfiguration ('autorefresh ' );
35- if ($ eqLogic -> getIsEnable () == 1 && $ autorefresh != '' ) {
34+ if ($ autorefresh != '' ) {
3635 try {
37- $ c = new Cron \CronExpression ($ autorefresh , new Cron \FieldFactory );
36+ $ c = new Cron \CronExpression (checkAndFixCron ( $ autorefresh) , new Cron \FieldFactory );
3837 if ($ c ->isDue ($ dateRun )) {
3938 try {
40- $ eqLogic ->refresh ();
39+ log:add ('script ' ,'debug ' ,__ ('Mise à jour des valeurs pour : ' , __FILE__ ).$ eqLogic ->getHumanName ());
40+ $ eqLogic ->refreshAllInfo ();
4141 } catch (Exception $ exc ) {
4242 log::add ('script ' , 'error ' , __ ('Erreur pour ' , __FILE__ ) . $ eqLogic ->getHumanName () . ' : ' . $ exc ->getMessage ());
4343 }
@@ -58,17 +58,18 @@ public function postSave() {
5858 $ refresh ->setLogicalId ('refresh ' );
5959 $ refresh ->setIsVisible (1 );
6060 $ refresh ->setName (__ ('Rafraichir ' , __FILE__ ));
61+ $ refresh ->setType ('action ' );
62+ $ refresh ->setSubType ('other ' );
63+ $ refresh ->setEqLogic_id ($ this ->getId ());
64+ $ refresh ->save ();
6165 }
62- $ refresh ->setType ('action ' );
63- $ refresh ->setSubType ('other ' );
64- $ refresh ->setEqLogic_id ($ this ->getId ());
65- $ refresh ->save ();
6666 }
6767
68- public function refresh () {
68+ public function refreshAllInfo () {
69+ /** @var scriptCmd */
6970 foreach ($ this ->getCmd ('info ' ) as $ cmd ) {
7071 try {
71- $ cmd ->refresh ();
72+ $ cmd ->refreshInfo ();
7273 } catch (Exception $ exc ) {
7374 log::add ('script ' , 'error ' , __ ('Erreur pour ' , __FILE__ ) . $ cmd ->getHumanName () . ' : ' . $ exc ->getMessage ());
7475 }
@@ -92,7 +93,7 @@ public function dontRemoveCmd() {
9293 return false ;
9394 }
9495
95- public function refresh () {
96+ public function refreshInfo () {
9697 if ($ this ->getType () != 'info ' || trim ($ this ->getConfiguration ('request ' )) == '' ) {
9798 return ;
9899 }
@@ -118,7 +119,7 @@ public function postSave() {
118119 if ($ this ->getLogicalId () == 'refresh ' || $ this ->getEqlogic ()->getIsEnable () != 1 ) {
119120 return ;
120121 }
121- $ this ->refresh ();
122+ $ this ->refreshInfo ();
122123 }
123124
124125 private function replaceTags ($ request ) {
@@ -133,7 +134,7 @@ private function replaceTags($request) {
133134
134135 public function execute ($ _options = null ) {
135136 if ($ this ->getLogicalId () == 'refresh ' ) {
136- $ this ->getEqLogic ()->refresh ();
137+ $ this ->getEqLogic ()->refreshAllInfo ();
137138 return ;
138139 }
139140 $ result = false ;
@@ -389,7 +390,7 @@ public function execute($_options = null) {
389390 if ($ this ->getEqLogic ()->getConfiguration ('delayBeforeRefrehInfo ' ) != '' ) {
390391 usleep ($ this ->getEqLogic ()->getConfiguration ('delayBeforeRefrehInfo ' ) * 1000000 );
391392 }
392- $ this ->getEqLogic ()->refresh ();
393+ $ this ->getEqLogic ()->refreshAllInfo ();
393394 }
394395 }
395396
0 commit comments