Standard\Controllers\Cron\CronController::deleteCronAction PHP Метод

deleteCronAction() публичный Метод

public deleteCronAction ( )
    public function deleteCronAction()
    {
        $id = $_POST['id'] ?? null;
        if ($id) {
            try {
                $cron = $this->cronsTable->get($id);
                if (($_POST['deleteLog'] ?? false) == $id && $cron->output) {
                    $logFile = $this->site['logFolder'] . '/' . $cron->output;
                    if (!unlink($logFile)) {
                        $this->flasher->error("Could not delete log file: " . $logFile);
                    }
                }
                $this->cronsTable->delete($cron);
                $this->flasher->success('Successfully deleted cron!');
            } catch (\Exception $e) {
                $this->flasher->error("Could not delete cron: " . $e->getMessage());
            }
            $this->redirect('/admin/crons');
        }
    }