Delete this block instance.

@param bool $forceDelete If this is an alias block, should we delete all the block instances in addition to the alias?

@return bool|null Returns false if the block is not valid
322535
public function deleteBlock($forceDelete = false)
    {
        $db = Loader::db();

        $bID = $this->getBlockID();
        if ($bID < 1) {
            return false;
        }

        $cID = $this->getBlockCollectionID();
        $c = $this->getBlockCollectionObject();
        $cvID = $c->getVersionID();
        $arHandle = $this->getAreaHandle();

        // if this block is located in a master collection, we're going to delete all the instances of the block,
        // regardless
        if (($c instanceof \Concrete\Core\Page\Page && $c->isMasterCollection() && !$this->isAlias()) || $forceDelete) {
            // forceDelete is used by the administration console

            // this is an original. We're deleting it, and everything else having to do with it
            $q = 'delete from CollectionVersionBlocks where bID = ?';
            $r = $db->query($q, [$bID]);

            $q = 'delete from BlockPermissionAssignments where bID = ?';
            $r = $db->query($q, [$bID]);

            $q = 'delete from CollectionVersionBlockStyles where bID = ?';
            $r = $db->query($q, [$bID]);

            $q = 'delete from CollectionVersionBlocksCacheSettings where bID = ?';
            $r = $db->query($q, [$bID]);
        } else {
            $q = 'delete from CollectionVersionBlocks where cID = ? and (cvID = ? or cbIncludeAll=1) and bID = ? and arHandle = ?';
            $r = $db->query($q, [$cID, $cvID, $bID, $arHandle]);

            // next, we delete the groups instance of this block
            $q = 'delete from BlockPermissionAssignments where bID = ? and cvID = ? and cID = ?';
            $r = $db->query($q, [$bID, $cvID, $cID]);

            $q = 'delete from CollectionVersionBlockStyles where cID = ? and cvID = ? and bID = ? and arHandle = ?';
            $r = $db->query($q, [$cID, $cvID, $bID, $arHandle]);

            $q = 'delete from CollectionVersionBlocksCacheSettings where cID = ? and cvID = ? and bID = ? and arHandle = ?';
            $r = $db->query($q, [$cID, $cvID, $bID, $arHandle]);
        }

        // delete any feature assignments that have been attached to this block to the collection version
        $faIDs = $db->GetCol(
            'select faID from BlockFeatureAssignments where cID = ? and cvID = ? and bID = ?',
            [
                $cID,
                $cvID,
                $bID,
            ]
            );
        foreach ($faIDs as $faID) {
            $fa = FeatureAssignment::getByID($faID, $c);
            $fa->delete();
        }

        //then, we see whether or not this block is aliased to anything else
        $totalBlocks = $db->GetOne('select count(*) from CollectionVersionBlocks where bID = ?', [$bID]);
        $totalBlocks += $db->GetOne('select count(*) from btCoreScrapbookDisplay where bOriginalID = ?', [$bID]);
        if ($totalBlocks < 1) {
            // this block is not referenced in the system any longer, so we delete the entry in the blocks table, as well as the entries in the corresponding
            // sub-blocks table

            $v = [$bID];

            // so, first we delete the block's sub content
            $bt = BlockType::getByID($this->getBlockTypeID());
            if ($bt && method_exists($bt, 'getBlockTypeClass')) {
                $class = $bt->getBlockTypeClass();
                $app = Facade::getFacadeApplication();
                $bc = $app->build($class, [$this]);
                $bc->delete();
            }

            // now that the block's subcontent delete() method has been run, we delete the block from the Blocks table
            $q = 'delete from Blocks where bID = ?';
            $r = $db->query($q, $v);

            // Aaaand then we delete all scrapbooked blocks to this entry
            $r = $db->Execute(
                'select cID, cvID, CollectionVersionBlocks.bID, arHandle from CollectionVersionBlocks inner join btCoreScrapbookDisplay on CollectionVersionBlocks.bID = btCoreScrapbookDisplay.bID where bOriginalID = ?',
                [$bID]
                );
            while ($row = $r->FetchRow()) {
                $c = Page::getByID($row['cID'], $row['cvID']);
                $b = self::getByID($row['bID'], $c, $row['arHandle']);
                $b->delete();
            }
        }
    }
527878
public function beforeDelete( $forced = false )
  {
    try {
        if($this->resourceLog) {
            $this->resourceLog->delete();
        }
    } catch(Execption $e) {}

    return true;
  }
995090
public function delete()
    {
        if (!$this->_canKept) {
            $this->forceDelete();
        } else {
            Query::table(static::$table)
            ->set('deleted_at', Time::current())
            ->where($this->_keyName, '=', $this->_keyValue)
            ->update();
        }
    }
172828
public function forceDelete()
    {
        // get records
        $affectedRecords = $this->getAffectedRecords()->toArray();
        $ids = array_map(function($record) {
            return $record->{$this->model->getKeyName()};
        }, $affectedRecords);

        // delete main table records
        if (! $this->query->delete()) {
            return false;
        }

        // delete version table records
        $db = $this->model->getConnection();
        return $db->table($this->model->getVersionTable())
            ->whereIn($this->model->getVersionKeyName(), $ids)
            ->delete();
    }
587917
public function deleteHlblockIfExists($hlblockName) {
        $item = $this->getHlblock($hlblockName);
        if (!$item) {
            return false;
        }

        return $this->deleteHlblock($item['ID']);
    }
1258920
public function destroy($regenerate = false)
    {
        $this->instance->unlock();
        $result = $this->instance->destroy();
        if ($regenerate == true) {
            session_regenerate_id(true);
        }
        return $result;
    }
25239
public function delete($force = false)
    {
        $this->getParent()->channelDelete($this->getId(), $force);

        unset($this);
    }
693908
public function isDelete($allowDelete = null)
    {
        if (null !== $allowDelete) {
            $this->allowDelete = $allowDelete;
        }

        return $this->allowDelete;
    }
678781
public function delete()
	{
		if ( ! $this->is_loaded() ) return false;

		$error = wp_delete_post( $this->attributes['ID'], $this->forceDelete );

		return $error !== false;
	}
1040740
protected function remove($filterOrName)
    {
        $name = $this->getNameByFilter($filterOrName);

        if ($this->has($name)) {
            unset($this->collection[$name]);

            return true;
        }

        return false;
    }
116295
public function getLoggingQueryRawDelete($defaultIfEmpty = false)
    {
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawDelete', $defaultIfEmpty);
        return $this->getBool($result);
    }
252020
public function delete($delete, $alias = null)
    {
        $this->type = self::DELETE;

        $this->from($delete, $alias);

        return $this;
    }
447936
public function exchangeDelete($exchange, $ifUnused = false, $nowait = false)
    {
        return $this->getClient()->exchangeDelete($this->getChannelId(), $exchange, $ifUnused, $nowait);
    }
579046
public function removeAction(Request $request)
    {
        $block = $this->findBlockByRequest($request);
        $row = $block->getRow();

        try {
            $this->getEditor()->getBlockManager()->delete($block);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        // Stores id for front removal
        $removedId = $this->getViewBuilder()->buildBlock($block)->getAttributes()->getId();

        $this->validate($row);
        $this->persist($row);

        $data = [
            'removed' => [$removedId],
            //'rows'    => [$this->getViewBuilder()->buildRow($row)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
798451
public function destroy($removeData = false)
    {
        if ($removeData) {
            if (!empty($this->sessionId)) {
                foreach ($this->memory as $key => $value) {
                    if (0 === strpos($key, $this->sessionId . '#')) {
                        unset($this->memory[$key]);
                    }
                }
            } else {
                $this->memory = [];
            }
        }

        $this->started = false;

        return true;
    }
925660
public function delete($force = false)
    {
        $this->getParent()->channelGroupDelete($this->getId(), $force);

        unset($this);
    }
47287
public static function flush_cacheblock_cache($force = false)
    {
        if (!self::$cacheblock_cache_flushed || $force) {
            $cache = Injector::inst()->get(CacheInterface::class . '.cacheblock');
            $cache->clear();


            self::$cacheblock_cache_flushed = true;
        }
    }