The execution of cronjobs updates the state of the cronjob three times: from ready to pending, from pending to executing and from executing to ready. The problem is that during these updates, the state property of the cronjob object never changes which results in the problem, that during the last update, the cronjob object still believes its state is ready while it actually is executing. Since the last state update want to set the state to ready, the deleted lines stopped that update since the object state is also ready, so according to the deleted lines, there is no need for an update.
As you can see, though the original purpose of these lines might have been a good one (to save database queries), it can result in unexpected behavior that's hard to debug.
public function update(array $parameters = array()) {
if (empty($parameters)) return;
- // check whether any value changed or not
- $update = false;
- foreach ($parameters as $name => $value) {
- if ($this->__get($name) != $value) {
- $update = true;
- break;
- }
- }
-
- // there is no new data - break to avoid senseless sql queries
- if (!$update) return;
-
$updateSQL = '';
$statementParameters = array();
foreach ($parameters as $key => $value) {