src/Webtrees/Module/AdminTasks/Model/AbstractTask.php
public function execute(){
    
        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
            $this->is_running = false;
    
        if(!$this->is_running){
            $this->last_result = false;
            $this->is_running = true;
            $this->save();
    
            Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
            $this->last_result = $this->executeSteps();
            if($this->last_result){
                $this->last_updated = new \DateTime();
                if($this->nb_occurrences > 0){
                    $this->nb_occurrences--;
                    if($this->nb_occurrences == 0) $this->is_enabled = false;
                }
            }
            $this->is_running = false;
            $this->save();
            Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
        }
    }
public function execute(){
    
        if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime())
            $this->is_running = false;
    
        if(!$this->is_running){
            $this->last_result = false;
            $this->is_running = true;
            $this->save();
    
            Log::addDebugLog('Start execution of Admin task: '.$this->getTitle());
            $this->last_result = $this->executeSteps();
            if($this->last_result){
                $this->last_updated = new \DateTime();
                if($this->nb_occurrences > 0){
                    $this->nb_occurrences--;
                    if($this->nb_occurrences == 0) $this->is_enabled = false;
                }
            }
            $this->is_running = false;
            $this->save();
            Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure'));
        }
    }
public function execute ( ) { if ( $ this -> last_updated -> add ( new \ DateInterval ( 'PT' . self :: TASK_TIME_OUT . 'S' ) ) < new \ DateTime ( ) ) $ this -> is_running = false ; if ( ! $ this -> is_running ) { $ this -> last_result = false ; $ this -> is_running = true ; $ this -> save ( ) ; Log :: addDebugLog ( 'Start execution of Admin task: ' . $ this -> getTitle ( ) ) ; $ this -> last_result = $ this -> executeSteps ( ) ; if ( $ this -> last_result ) { $ this -> last_updated = new \ DateTime ( ) ; if ( $ this -> nb_occurrences > 0 ) { $ this -> nb_occurrences -- ; if ( $ this -> nb_occurrences == 0 ) $ this -> is_enabled = false ; } } $ this -> is_running = false ; $ this -> save ( ) ; Log :: addDebugLog ( 'Execution completed for Admin task: ' . $ this -> getTitle ( ) . ' - ' . ( $ this -> last_result ? 'Success' : 'Failure' ) ) ; } }
Execute the task, default skeleton
Execute the task default skeleton