public function flag_expired_contexts() : array {
        $this->trace->output('Checking requirements');
        if (!$this->check_requirements()) {
            $this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
            return [0, 0];
        }

        // Clear old and stale records first.
        $this->trace->output('Clearing obselete records.', 0);
        static::clear_old_records();
        $this->trace->output('Done.', 1);

        $this->trace->output('Calculating potential course expiries.', 0);
        $data = static::get_nested_expiry_info_for_courses();

        $coursecount = 0;
        $this->trace->output('Updating course expiry data.', 0);
        foreach ($data as $expiryrecord) {
            if ($this->update_from_expiry_info($expiryrecord)) {
                $coursecount++;
            }
        }
        $this->trace->output('Done.', 1);

        $this->trace->output('Calculating potential user expiries.', 0);
        $data = static::get_nested_expiry_info_for_user();

        $usercount = 0;
        $this->trace->output('Updating user expiry data.', 0);
        foreach ($data as $expiryrecord) {
            if ($this->update_from_expiry_info($expiryrecord)) {
                $usercount++;
            }
        }
        $this->trace->output('Done.', 1);

        return [$coursecount, $usercount];
    }
public function flag_expired_contexts() : array {
        $this->trace->output('Checking requirements');
        if (!$this->check_requirements()) {
            $this->trace->output('Requirements not met. Cannot process expired retentions.', 1);
            return [0, 0];
        }

        // Clear old and stale records first.
        $this->trace->output('Clearing obselete records.', 0);
        static::clear_old_records();
        $this->trace->output('Done.', 1);

        $this->trace->output('Calculating potential course expiries.', 0);
        $data = static::get_nested_expiry_info_for_courses();

        $coursecount = 0;
        $this->trace->output('Updating course expiry data.', 0);
        foreach ($data as $expiryrecord) {
            if ($this->update_from_expiry_info($expiryrecord)) {
                $coursecount++;
            }
        }
        $this->trace->output('Done.', 1);

        $this->trace->output('Calculating potential user expiries.', 0);
        $data = static::get_nested_expiry_info_for_user();

        $usercount = 0;
        $this->trace->output('Updating user expiry data.', 0);
        foreach ($data as $expiryrecord) {
            if ($this->update_from_expiry_info($expiryrecord)) {
                $usercount++;
            }
        }
        $this->trace->output('Done.', 1);

        return [$coursecount, $usercount];
    }
public function flag_expired_contexts ( ) : array { $ this -> trace -> output ( 'Checking requirements' ) ; if ( ! $ this -> check_requirements ( ) ) { $ this -> trace -> output ( 'Requirements not met. Cannot process expired retentions.' , 1 ) ; return [ 0 , 0 ] ; } // Clear old and stale records first. $ this -> trace -> output ( 'Clearing obselete records.' , 0 ) ; static :: clear_old_records ( ) ; $ this -> trace -> output ( 'Done.' , 1 ) ; $ this -> trace -> output ( 'Calculating potential course expiries.' , 0 ) ; $ data = static :: get_nested_expiry_info_for_courses ( ) ; $ coursecount = 0 ; $ this -> trace -> output ( 'Updating course expiry data.' , 0 ) ; foreach ( $ data as $ expiryrecord ) { if ( $ this -> update_from_expiry_info ( $ expiryrecord ) ) { $ coursecount ++ ; } } $ this -> trace -> output ( 'Done.' , 1 ) ; $ this -> trace -> output ( 'Calculating potential user expiries.' , 0 ) ; $ data = static :: get_nested_expiry_info_for_user ( ) ; $ usercount = 0 ; $ this -> trace -> output ( 'Updating user expiry data.' , 0 ) ; foreach ( $ data as $ expiryrecord ) { if ( $ this -> update_from_expiry_info ( $ expiryrecord ) ) { $ usercount ++ ; } } $ this -> trace -> output ( 'Done.' , 1 ) ; return [ $ coursecount , $ usercount ] ; }
Flag expired contexts as expired.

@return  int[]   The number of contexts flagged as expired for courses, and users.
Flag expired contexts as expired .