Removes all unused and expired authorization codes from the database.
510252
def prune_old_authorization_codes():
    

    from .compat import now
    from .models import AuthorizationCode
    
    AuthorizationCode.objects.with_expiration_before(now()).delete()
937676
public void clearAll() {
        this.auths.clear();
        this.authsByUser.clear();
        File[] auths = this.authStoreDir.listFiles(new AuthFilenameFilter());
        for (int i = 0; i < auths.length; i++) {
            auths[i].delete();
        }
    }
559936
def cleanup(self):
        
        remove = []
        for handle, assoc in self.assocs.items():
            if assoc.expiresIn == 0:
                remove.append(handle)
        for handle in remove:
            del self.assocs[handle]
        return len(remove), len(self.assocs)
112049
def clear_db():
    """"""
    cursor = '0'
    while cursor != 0:
        cursor, keys = DB.scan(cursor, match='*', count=5000)
        if keys:
            DB.delete(*keys)
1219070
private void clearAll(DBIDs ids, WritableDataStore<HashSetModifiableDBIDs> sets) {
    for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
      sets.get(it).clear();
    }
  }
1332668
public function deleteAllExpired()
    {
        $expiredBlacklistedTokens = $this->findAllExpired();

        foreach ($expiredBlacklistedTokens as $expiredBlacklistedToken)
        {
            $this->delete($expiredBlacklistedToken['id']);
        }
    }
566850
def delete_expired_locks(self):
        
        ttl_seconds = self.get_mutex_ttl_seconds()
        if ttl_seconds is not None:
            DBMutex.objects.filter(creation_time__lte=timezone.now() - timedelta(seconds=ttl_seconds)).delete()
547781
public function deleteExpired()
    {
        // General expirations. Maximum limiter is 1m.
        $oldest = new \DateTime('-1 month -1 day');
        $q      = $this->getEntityManager()->getConnection()->createQueryBuilder();
        $q->delete(MAUTIC_TABLE_PREFIX.$this->getTableName());
        $q->where(
            $q->expr()->lt('date_added', 'FROM_UNIXTIME(:oldest)')
        );
        $q->setParameter('oldest', (int) $oldest->getTimestamp());
        $q->execute();
    }
255555
def cleanup_full_hashes(self, keep_expired_for=(60 * 60 * 12)):
        """"""
        q = '''DELETE FROM full_hash WHERE expires_at < datetime(current_timestamp, '-{} SECONDS')
        '''
        log.info('Cleaning up full_hash entries expired more than {} seconds ago.'.format(keep_expired_for))
        with self.get_cursor() as dbc:
            dbc.execute(q.format(int(keep_expired_for)))
134498
public function removeExpiredRegistrations($conditions = []) {
		$defaults = [
			$this->_table->aliasField($this->_field('emailVerified')) => 0,
			$this->_table->aliasField($this->_field('emailTokenExpires')) . ' <' => date('Y-m-d H:i:s')
		];

		$conditions = Hash::merge($defaults, $conditions);
		$count = $this->_table
			->find()
			->where($conditions)
			->count();

		if ($count > 0) {
			$this->_table->deleteAll($conditions);
		}

		return $count;
	}
65275
def clean(self):
        ''''''
        cleaned_data = super(SetAccessControlsAction, self).clean()
        if 'admin_pass' in cleaned_data:
            if cleaned_data['admin_pass'] != cleaned_data.get(
                    'confirm_admin_pass', None):
                raise forms.ValidationError(_('Passwords do not match.'))
        return cleaned_data
922971
def cleanup(self):
        """"""
        expires = maybe_timedelta(self.expires)
        for model in self.TaskModel, self.TaskSetModel:
            model._default_manager.delete_expired(expires)
426360
public function removeAll()
    {
        $pdo = $this->entityManager->getConnection()->getWrappedConnection();
        $pdo->beginTransaction();

        try {

            $pdo->exec('SET FOREIGN_KEY_CHECKS=0');
            $pdo->exec('TRUNCATE role_permission');
            $pdo->exec('TRUNCATE role_hierarchy');
            $pdo->exec('TRUNCATE role');
            $pdo->exec('TRUNCATE permission');
            $pdo->exec('TRUNCATE user_role');
            $pdo->exec('SET FOREIGN_KEY_CHECKS=1');

            $pdo->commit();

        } catch (\Exception $e) {
            $pdo->rollBack();
            throw new DatabaseException($e->getMessage());
        }
    }
715954
private function _sweepExpiredTokens()
    {
        foreach ($this->_activeTokens as $scopeUri => $activeToken) {
            $currentDateTime = new \DateTime('now');
            if ($activeToken->getExpirationDateTime() < $currentDateTime) {
                unset($this->_activeTokens[$scopeUri]);
            }
        }
    }
998386
private function cleanupSlaveConnections()
    {
        foreach ($this->config['database']['connections'] as $name => $connection) {
            if (count($connection['slaves']) <= 0) {
                unset($this->config['database']['connections'][$name]['slaves']);
            }
        }
    }
543137
def cleanup(self):
        
        # Closes connections to all databases to avoid the long running process
        # from holding connections indefinitely.
        for alias in db.connections.databases:
            logger.info('Closing database connection: %s', alias)
            db.connections[alias].close()
445826
public function gc()
    {
        $expires = date('Y-m-d H:i:s');
        $tables  = array(
            'access_token_table',
            'refresh_token_table',
            'code_table',
        );
        foreach ($tables as $table) {
            $stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE expires < :expires', $this->config[$table]));
            $stmt->execute(compact('expires'));
        }
    }