concrete/src/User/Login/LoginAttemptService.php
public function pruneAttempts(DateTime $before = null)
    {
        if (!$before) {
            $duration = (int) $this->config->get('concrete.user.deactivation.authentication_failure.duration');
            $before = Carbon::now('UTC')->subSeconds($duration);
        }

        // Load our repository and get entries before our date
        $repository = $this->entityManager->getRepository(LoginAttempt::class);
        $results = $repository->before($before);

        // Loop through and remove those entries
        $batch = [];
        $max = 50;

        foreach ($results as $result) {
            $this->entityManager->remove($result);
            $batch[] = $result;

            // Handle the batch
            $batch = $this->manageBatch($batch, $max);
        }

        // Close off the batch
        $this->manageBatch($batch);
    }
public function pruneAttempts(DateTime $before = null)
    {
        if (!$before) {
            $duration = (int) $this->config->get('concrete.user.deactivation.authentication_failure.duration');
            $before = Carbon::now('UTC')->subSeconds($duration);
        }

        // Load our repository and get entries before our date
        $repository = $this->entityManager->getRepository(LoginAttempt::class);
        $results = $repository->before($before);

        // Loop through and remove those entries
        $batch = [];
        $max = 50;

        foreach ($results as $result) {
            $this->entityManager->remove($result);
            $batch[] = $result;

            // Handle the batch
            $batch = $this->manageBatch($batch, $max);
        }

        // Close off the batch
        $this->manageBatch($batch);
    }
public function pruneAttempts ( DateTime $ before = null ) { if ( ! $ before ) { $ duration = ( int ) $ this -> config -> get ( 'concrete.user.deactivation.authentication_failure.duration' ) ; $ before = Carbon :: now ( 'UTC' ) -> subSeconds ( $ duration ) ; } // Load our repository and get entries before our date $ repository = $ this -> entityManager -> getRepository ( LoginAttempt :: class ) ; $ results = $ repository -> before ( $ before ) ; // Loop through and remove those entries $ batch = [ ] ; $ max = 50 ; foreach ( $ results as $ result ) { $ this -> entityManager -> remove ( $ result ) ; $ batch [ ] = $ result ; // Handle the batch $ batch = $ this -> manageBatch ( $ batch , $ max ) ; } // Close off the batch $ this -> manageBatch ( $ batch ) ; }
Prune old login attempts

@param \DateTime|null $before The date to prune before. This MUST be in UTC, if not passed this value is derived
from config
Prune old login attempts