Skip to content

Commit

Permalink
update procedure, return codes, post action when renewing in same con…
Browse files Browse the repository at this point in the history
…tainer
  • Loading branch information
schorschii committed Jun 5, 2023
1 parent 1de6097 commit 100f19a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/CoreLogic.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,14 @@ public function renewFailedStaticJobsInJobContainer($renewJobContainerId, $renew
foreach($this->db->selectAllStaticJobByJobContainer($container->id) as $job) {
if(!empty($renewJobIds) && !in_array($job->id, $renewJobIds)) continue;
if($job->isFailed()) {
$this->db->renewStaticJob($job->id);
// use the current package procedure, return codes, post action
$package = $this->db->selectPackage($job->package_id);
$this->db->renewStaticJob($job->id,
empty($job->is_uninstall) ? $package->install_procedure : $package->uninstall_procedure,
empty($job->is_uninstall) ? $package->install_procedure_success_return_codes : $package->uninstall_procedure_success_return_codes,
$package->upgrade_behavior,
empty($job->is_uninstall) ? $package->install_procedure_post_action : $package->uninstall_procedure_post_action
);
}
}

Expand Down
15 changes: 12 additions & 3 deletions lib/DatabaseController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1747,11 +1747,20 @@ public function removeWolShutdownStaticJobInJobContainer($job_container_id, $job
':post_action' => $post_action,
])) return false;
}
public function renewStaticJob($id) {
public function renewStaticJob($id, $procedure, $success_return_codes, $upgrade_behavior, $post_action) {
$this->stmt = $this->dbh->prepare(
'UPDATE job_container_job SET state = 0, return_code = NULL, message = "", download_started = NULL, execution_started = NULL, execution_finished = NULL WHERE id = :id'
'UPDATE job_container_job
SET state = 0, return_code = NULL, message = "", download_started = NULL, execution_started = NULL, execution_finished = NULL,
`procedure` = :procedure, success_return_codes = :success_return_codes, upgrade_behavior = :upgrade_behavior, post_action = :post_action
WHERE id = :id'
);
return $this->stmt->execute([':id' => $id]);
return $this->stmt->execute([
':id' => $id,
':procedure' => $procedure,
':success_return_codes' => $success_return_codes,
':upgrade_behavior' => $upgrade_behavior,
':post_action' => $post_action,
]);
}
public function updateJobExecutionState($job) {
if($job instanceof Models\StaticJob) {
Expand Down

0 comments on commit 100f19a

Please sign in to comment.