Updates cronjob fail counter during manual cronjob execution
authorMatthias Schmidt <gravatronics@live.com>
Sun, 28 Apr 2013 08:12:45 +0000 (10:12 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 28 Apr 2013 08:12:45 +0000 (10:12 +0200)
…and disables failed cronjob if it failed too often

wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php

index ce1835b7ade2d685362263456012930ba56efb95..99996f272f923b133b75c86c6f0ce16cba032012 100644 (file)
@@ -158,6 +158,17 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio
                                        $data['isDisabled'] = 0;
                                }
                        }
+                       // cronjob failed
+                       else {
+                               if ($cronjob->failCount < Cronjob::MAX_FAIL_COUNT) {
+                                       $data['failCount'] = $cronjob->failCount + 1;
+                               }
+                               
+                               // cronjob failed too often: disable it
+                               if ($cronjob->failCount + 1 == Cronjob::MAX_FAIL_COUNT) {
+                                       $data['isDisabled'] = 1;
+                               }
+                       }
                        
                        $cronjob->update($data);