пометить как удаленный. при сбросе лимитов
@return bool
@throws \Exception
487160
public function deleteModel(): bool
    {
        $this->getFromForm();
        $this->is_deleted = true;
        if (!$this->save()) {
            throw new \Exception(\Yii::t('app', 'Ошибка при удалении кода'));
        }
        return true;
    }
1166385
public function delete()
    {
        if (!file_exists($this->path)) {
            throw new \Exception(
                "Can't delete something unexisting : " . $this->path,
                1
            );
        }

        if (is_dir($this->path)){
            $iterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator(
                    $this->path,
                    \RecursiveDirectoryIterator::SKIP_DOTS
                ),
                \RecursiveIteratorIterator::CHILD_FIRST
            );

            foreach ($iterator as $file) {
                if ($file->isDir()) {
                    rmdir($file->getPathname());
                    continue;
                }
                unlink($file->getPathname());
            }
            rmdir($this->path);
            return;
        }

        unlink($this->path);
    }
1200815
final public function truncate()
    {
        if (!$this->DB) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        $table = $this->getTable();
        $sql = "truncate table " . $table;
        $this->sql = $sql;
        /**
         * 只获取sql
         */
        if ($this->justSql) {
            return true;
        }
        return $this->DB->execute($sql);
    }
890069
public function delete() {
    if ($this->isNew()) {
      throw new \Exception('ID is not setted for Delete');
    }

    $this->db()->delete($this->table, $this->identifier());
    $this->isDeleted = TRUE;

    return $this;
  }
671563
public function delete()
    {
        try {
            parent::delete();
            $query = 'DELETE FROM ' . $this->table . ' WHERE userID = ?';
            $stmt = $this->pdo->prepare($query);
            $stmt->execute(array($this->userID));
            return $stmt->rowCount() > 0;
        } catch(\PDOException $e) {
            return false;
        }
    }
684227
public function delete(){
        if($this->beforeDelete()){
            $pkConditions = $this->buildPKConditions();
            if(false !== $rst = ($this->isNew() || $this->_db->builder()->delete($this->getTable(), $pkConditions[0], $pkConditions[1]))){
                $this->_data = array();
                $this->_dirty = array();
                $this->afterDelete();
                
                return $rst;
            }
        }
        
        return false;
    }
115729
final public function isDeleted()
    {
        $column = static::SOFT_DELETE;
        if ($column) {
            $value = $this->__get($column);
            switch (static::SOFT_DELETE_MODE) {
                case 'deleted':
                    $result = (int) $value === 1;
                    break;

                case 'active':
                    $result = (int) $value === 0;
                    break;

                case 'stamp':
                    $result = $value !== null;
                    break;

                default:
                    throw new \LogicException(sprintf(
                        "%s has invalid SOFT_DELETE_MODE mode: '%s'",
                        static::class,
                        static::SOFT_DELETE_MODE
                    ));
                    break;
            }
            return $result;
        }
        return false;
    }
1055361
public function clean()
    {
        if (null === $this->primaryModel->pk) {
            throw new Exception('Unable to clean models: the primary key of '.get_class($this->primaryModel).' is null.');
        }
        $db = $this->primaryModel->getConnection();
        $builder = QueryBuilderFactory::getQueryBuilder($db);

        return $db->delete($builder->getQuotedName(TableNameResolver::getTableName($this->relatedTable)), [$this->primaryModelColumn => $this->primaryModel->pk]);
    }
976334
public function delete()
    {
        static::checkReadOnly();

        $column = static::SOFT_DELETE;
        if ($column) {
            switch (static::SOFT_DELETE_MODE) {
                case 'deleted':
                    $value = 1;
                    break;

                case 'active':
                    $value = 0;
                    break;

                case 'stamp':
                    $value = static::getCurrentTimestamp();
                    break;

                default:
                    throw new \LogicException(sprintf(
                        "%s has invalid SOFT_DELETE_MODE mode: '%s'",
                        static::class,
                        static::SOFT_DELETE_MODE
                    ));
                    break;
            }
            $this->__set($column, $value);
            if ($this->isFresh()) {
                return true;
            }
            return $this->update($column);
        }

        $database = self::getDatabase();
        $stmt = $database->delete(static::TABLE, $this->getPrimaryKey());
        if ($stmt->rowCount() > 0) {
            ModelManager::remove($this);
            $this->reset();
            return true;
        }

        return false;
    }
795322
public function remove()
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            $clearCache = false;
            if ($this->receiver_status == self::STATUS_NEW) {
                $clearCache = true;
            }
            $deleteParent = null;
            $this->scenario = 'remove';
            if ($this->message->sender_status != Message::STATUS_DELETED) {
                $this->receiver_status = self::STATUS_DELETED;
                if (!$this->save()) {
                    throw new Exception('Message status changing error!');
                }
                if ($clearCache) {
                    Podium::getInstance()->podiumCache->deleteElement('user.newmessages', $this->receiver_id);
                }
                $transaction->commit();
                return true;
            }
            if ($this->message->sender_status == Message::STATUS_DELETED && count($this->message->messageReceivers) == 1) {
                $deleteParent = $this->message;
            }
            if (!$this->delete()) {
                throw new Exception('Message removing error!');
            }
            if ($clearCache) {
                Podium::getInstance()->podiumCache->deleteElement('user.newmessages', $this->receiver_id);
            }
            if ($deleteParent) {
                if (!$deleteParent->delete()) {
                    throw new Exception('Sender message deleting error!');
                }
            }
            $transaction->commit();
            return true;
        } catch (Exception $e) {
            $transaction->rollBack();
            Log::error($e->getMessage(), $this->id, __METHOD__);
        }
        return false;
    }
669263
public static function destruct()
    {
        if (is_null(self::$_file) || !is_resource(self::$_file)) {
            return false;
        }

        try {
            fclose(self::$_file);
        } catch (Exception $e) {
            return false;
        }
        return true;
    }
849329
public function unblockUser(): bool
    {
        $this->activate();
        if (!$this->save()) {
            throw new Exception(\Yii::t('app', 'Ошибка при разблокировке пользователя'));
        }
        return true;
    }
214453
public function delete()
    {
        // we will NOT let you delete the admin user
        if ($this->getUserID() == USER_SUPER_ID) {
            return false;
        }

        // Dispatch an on_user_delete event, that every subscriber can cancel.
        $ue = new DeleteUserEvent($this);
        $ue = $this->getDirector()->dispatch('on_user_delete', $ue);
        if (!$ue->proceed()) {
            return false;
        }

        // Dispatch an on_user_deleted event: subscribers can't cancel this event.
        // This event could be at the end of this method, but let's keep it here so that subscribers
        // can get all the details of the user being deleted.
        $this->getDirector()->dispatch('on_user_deleted', new UserInfoEvent($this));

        $attributes = $this->attributeCategory->getAttributeValues($this->getEntityObject());
        foreach ($attributes as $attribute) {
            $this->attributeCategory->deleteValue($attribute);
        }

        $this->connection->executeQuery('DELETE FROM OauthUserMap WHERE user_id = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM Logs WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM UserSearchIndexAttributes WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM UserGroups WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM UserValidationHashes WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM Piles WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM ConfigStore WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM ConversationSubscriptions WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM PermissionAccessEntityUsers WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('DELETE FROM authTypeConcreteCookieMap WHERE uID = ?', [(int) $this->getUserID()]);

        // Conversation messages and ratings should be detached from the user
        $this->connection->executeQuery('UPDATE ConversationMessages SET uID = 0, cnvMessageAuthorName = NULL, cnvMessageAuthorEmail = NULL, cnvMessageAuthorWebsite = NULL, cnvMessageSubmitIP = NULL, cnvMessageSubmitUserAgent = NULL WHERE uID = ?', [(int) $this->getUserID()]);
        $this->connection->executeQuery('UPDATE ConversationMessageRatings SET cnvMessageRatingIP = NULL, uID = 0 WHERE uID = ?', [(int) $this->getUserID()]);

        // Public file sets should be detached from the user
        $this->connection->executeQuery('UPDATE FileSets SET uID = 0 WHERE uID = ? AND fsType = ?', [
            (int) $this->getUserID(),
            \Concrete\Core\File\Set\Set::TYPE_PUBLIC,
        ]);

        // Delete private file sets from this user
        foreach (\Concrete\Core\File\Set\Set::getOwnedSets($this) as $set) {
            $set->delete();
        }



        $this->connection->executeQuery('UPDATE Blocks set uID = ? WHERE uID = ?', [(int) USER_SUPER_ID, (int) $this->getUserID()]);
        $this->connection->executeQuery('UPDATE Pages set uID = ? WHERE uID = ?', [(int) USER_SUPER_ID, (int) $this->getUserID()]);
        $this->connection->executeQuery('UPDATE DownloadStatistics set uID = 0 WHERE uID = ?', [(int) $this->getUserID()]);

        // We need to clear out the doctrine proxies for userSignups or we will get a Doctrine Error
        /** @var \Concrete\Core\Entity\User\UserSignup[] $userSignups */
        $userSignups = $this->entityManager->getRepository(\Concrete\Core\Entity\User\UserSignup::class)->findBy(['createdBy'=>(int) $this->getUserID()]);
        $superAdminEntity = $this->entityManager->getRepository(UserEntity::class)->find((int) USER_SUPER_ID);

        foreach ($userSignups as $userSignup) {
            // If there is no SuperAdmin Just remove the relatedUserSignups
            if (is_object($superAdminEntity)) {
                $userSignup->setCreatedBy($superAdminEntity);
                $this->entityManager->persist($userSignup);
            } else {
                $this->entityManager->remove($userSignup);
            }

        }

        $this->entityManager->remove($this->entity);
        $this->entityManager->flush();

        return true;
    }
553335
protected function exceptionArray()
    {
        $exceptionArray = [$this->exceptionObject()];
        $previous = $this->previous;
        while ($previous) {
            $exceptionArray[] = $previous->exceptionObject();
            $previous = $previous->previous;
        }

        return $this->cleanupObj($exceptionArray, false);
    }
1034143
public function podiumDelete()
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            if (!$this->delete()) {
                throw new Exception('Post deleting error!');
            }
            $wholeThread = false;
            if ($this->thread->postsCount) {
                if (!$this->thread->updateCounters(['posts' => -1])) {
                    throw new Exception('Thread Post counter subtracting error!');
                }
                if (!$this->forum->updateCounters(['posts' => -1])) {
                    throw new Exception('Forum Post counter subtracting error!');
                }
            } else {
                $wholeThread = true;
                if (!$this->thread->delete()) {
                    throw new Exception('Thread deleting error!');
                }
                if (!$this->forum->updateCounters(['posts' => -1, 'threads' => -1])) {
                    throw new Exception('Forum Post and Thread counter subtracting error!');
                }
            }
            $transaction->commit();
            PodiumCache::clearAfter('postDelete');
            Log::info('Post deleted', !empty($this->id) ? $this->id : '', __METHOD__);
            return true;
        } catch (Exception $e) {
            $transaction->rollBack();
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
977337
public function delete()
    {
        if ($this->_id) {
            try {
                $this->_connection->delete($this->url() . '/' . $this->_id, []);

                return true;
            } catch (Exception $e) {
            }
        }

        return false;
    }
1124552
public function delete()
    {
        //usuwanie meta
        if (!parent::delete()) {
            return false;
        }
        //plik jest ciągle potrzebny (ma linki)
        if (0 != (new CmsFileQuery)->whereName()->equals($this->name)->count()) {
            return true;
        }
        //kasowanie z systemu plików
        (new \Cms\Model\FileSystemModel($this->name))->unlink();
        //usuwanie rekordu
        return true;
    }