models/log/Login.php
protected function deleteExpiredRecords()
    {
        try {
            $limit = (int)($this->limitDuration);
        } catch (\Exception $ex) {
            Yii::error($ex->getMessage(), __METHOD__);
            return 0;
        }
        $count = 0;
        $host = $this->host;
        /* @var $host \rhosocial\user\User */
        foreach (static::find()
                ->createdBy($host)
                ->andWhere(['<=', $this->createdAtAttribute, $this->offsetDatetime($this->currentUtcDatetime(), -$limit)])
                ->all() as $login) {
            /* @var $login static */
            $result = $login->delete();
            $count += $result;
            if (YII_ENV_DEV) {
                Yii::info($host->getReadableGUID() . ": ($result) login record created at (" . $login->getCreatedAt() . ") was just deleted.", __METHOD__);
            }
        }
        return $count;
    }
protected function deleteExpiredRecords()
    {
        try {
            $limit = (int)($this->limitDuration);
        } catch (\Exception $ex) {
            Yii::error($ex->getMessage(), __METHOD__);
            return 0;
        }
        $count = 0;
        $host = $this->host;
        /* @var $host \rhosocial\user\User */
        foreach (static::find()
                ->createdBy($host)
                ->andWhere(['<=', $this->createdAtAttribute, $this->offsetDatetime($this->currentUtcDatetime(), -$limit)])
                ->all() as $login) {
            /* @var $login static */
            $result = $login->delete();
            $count += $result;
            if (YII_ENV_DEV) {
                Yii::info($host->getReadableGUID() . ": ($result) login record created at (" . $login->getCreatedAt() . ") was just deleted.", __METHOD__);
            }
        }
        return $count;
    }
protected function deleteExpiredRecords ( ) { try { $ limit = ( int ) ( $ this -> limitDuration ) ; } catch ( \ Exception $ ex ) { Yii :: error ( $ ex -> getMessage ( ) , __METHOD__ ) ; return 0 ; } $ count = 0 ; $ host = $ this -> host ; /* @var $host \rhosocial\user\User */ foreach ( static :: find ( ) -> createdBy ( $ host ) -> andWhere ( [ '<=' , $ this -> createdAtAttribute , $ this -> offsetDatetime ( $ this -> currentUtcDatetime ( ) , - $ limit ) ] ) -> all ( ) as $ login ) { /* @var $login static */ $ result = $ login -> delete ( ) ; $ count += $ result ; if ( YII_ENV_DEV ) { Yii :: info ( $ host -> getReadableGUID ( ) . ": ($result) login record created at (" . $ login -> getCreatedAt ( ) . ") was just deleted." , __METHOD__ ) ; } } return $ count ; }
Delete expired records.
@return integer The total of rows deleted.
Delete expired records .