public function actionStop($id)
    {
        if (!$this->module->canExecStop) {
            throw new ForbiddenHttpException(Module::t('notice', 'Stop is forbidden.'));
        }

        $record = $this->findRecord($id);

        if ($record->isStopped()) {
            return $this
                ->error(Module::t('notice', 'The job is already stopped.'))
                ->redirect(['view-details', 'id' => $record->id]);
        }

        if (!$record->canStop()) {
            return $this
                ->error(Module::t('notice', 'The job is already done.'))
                ->redirect(['view-attempts', 'id' => $record->id]);
        }

        $record->stop();

        return $this
            ->success(Module::t('notice', 'The job will be stopped.'))
            ->redirect(['view-details', 'id' => $record->id]);
    }
public function actionStop($id)
    {
        if (!$this->module->canExecStop) {
            throw new ForbiddenHttpException(Module::t('notice', 'Stop is forbidden.'));
        }

        $record = $this->findRecord($id);

        if ($record->isStopped()) {
            return $this
                ->error(Module::t('notice', 'The job is already stopped.'))
                ->redirect(['view-details', 'id' => $record->id]);
        }

        if (!$record->canStop()) {
            return $this
                ->error(Module::t('notice', 'The job is already done.'))
                ->redirect(['view-attempts', 'id' => $record->id]);
        }

        $record->stop();

        return $this
            ->success(Module::t('notice', 'The job will be stopped.'))
            ->redirect(['view-details', 'id' => $record->id]);
    }
public function actionStop ( $ id ) { if ( ! $ this -> module -> canExecStop ) { throw new ForbiddenHttpException ( Module :: t ( 'notice' , 'Stop is forbidden.' ) ) ; } $ record = $ this -> findRecord ( $ id ) ; if ( $ record -> isStopped ( ) ) { return $ this -> error ( Module :: t ( 'notice' , 'The job is already stopped.' ) ) -> redirect ( [ 'view-details' , 'id' => $ record -> id ] ) ; } if ( ! $ record -> canStop ( ) ) { return $ this -> error ( Module :: t ( 'notice' , 'The job is already done.' ) ) -> redirect ( [ 'view-attempts' , 'id' => $ record -> id ] ) ; } $ record -> stop ( ) ; return $ this -> success ( Module :: t ( 'notice' , 'The job will be stopped.' ) ) -> redirect ( [ 'view-details' , 'id' => $ record -> id ] ) ; }
Stop a job

@param int $id
@throws
@return mixed
Stop a job