Deletes a specific tracking failure
@param int $idSite
@param int $idFailure
183647
public function deleteTrackingFailure($idSite, $idFailure)
    {
        $idSite = (int) $idSite;
        Piwik::checkUserHasAdminAccess($idSite);

        $this->trackingFailures->deleteTrackingFailure($idSite, $idFailure);
    }
651481
protected void doDelete(int n) throws CorruptIndexException, IOException {
        if (transientDeletions) {
            deletedDocs.add(n);
            modCount.incrementAndGet(); // doDelete won't be executed, so incrementing modCount
        } else {
            super.doDelete(n);
            modCount.incrementAndGet();
        }
    }
242757
public function recordWebsiteDataInCache(&$array, $idSite)
    {
        $idSite = (int) $idSite;

        $website = API::getInstance()->getSiteFromId($idSite);
        $urls = API::getInstance()->getSiteUrlsFromId($idSite);

        // add the 'hosts' entry in the website array
        $array['urls']  = $urls;
        $array['hosts'] = $this->getTrackerHosts($urls);

        $array['exclude_unknown_urls'] = $website['exclude_unknown_urls'];
        $array['excluded_ips'] = $this->getTrackerExcludedIps($website);
        $array['excluded_parameters'] = self::getTrackerExcludedQueryParameters($website);
        $array['excluded_user_agents'] = self::getExcludedUserAgents($website);
        $array['keep_url_fragment'] = self::shouldKeepURLFragmentsFor($website);
        $array['sitesearch'] = $website['sitesearch'];
        $array['sitesearch_keyword_parameters'] = $this->getTrackerSearchKeywordParameters($website);
        $array['sitesearch_category_parameters'] = $this->getTrackerSearchCategoryParameters($website);
        $array['timezone'] = $this->getTimezoneFromWebsite($website);
        $array['ts_created'] = $website['ts_created'];
        $array['type'] = $website['type'];
    }
1259008
public function onWebmasterRemove(SiteEvent $event)
    {
        $site = $event->getSite();
        $uid  = $event->getArgument('webmaster_id');

        $this->service->deleteSubscriptionsFor($uid, ['site:' . $site->getId()]);
    }
557803
public function AddArticleIdToNoticeList($iArticleId, $iAmount = 1)
    {
        $dNewAmountOnList = 0;

        if (is_null($this->aNoticeList)) {
            $this->GetNoticeListArticles();
        }
        // check if the item being pushed is already in the end of the queue
        $iMaxQueueLength = 1000;

        $queNotEmpty = (count($this->aNoticeList) > 0);

        if (array_key_exists($iArticleId, $this->aNoticeList)) {
            // we do not allow placing an article more than once on the notice list
            $dNewAmountOnList = false;
        } else {
            $oNoticeListItem = TdbShopUserNoticeList::GetNewInstance();
            /** @var $oNoticeListItem TdbShopUserNoticeList */
            $aData = array('shop_article_id' => $iArticleId, 'date_added' => date('Y-m-d H:i:s'), 'data_extranet_user_id' => $this->id, 'amount' => $iAmount);
            $oNoticeListItem->LoadFromRow($aData);
            if (!is_null($this->id) && $this->IsLoggedIn()) {
                $oNoticeListItem->Save();
            }
            $this->aNoticeList[$oNoticeListItem->fieldShopArticleId] = $oNoticeListItem->sqlData;
        }

        if (false !== $dNewAmountOnList) {
            // remove item if amount drops to zero
            if ($this->aNoticeList[$iArticleId]['amount'] <= 0) {
                unset($this->aNoticeList[$iArticleId]);
            } else {
                $dNewAmountOnList = $this->aNoticeList[$iArticleId]['amount'];
            }

            // if the list is full, remove last item
            if (count($this->aNoticeList) > $iMaxQueueLength) {
                array_pop($this->aNoticeList);
            }

            // save list to cookie for users not signed in
            if (!$this->IsLoggedIn()) {
                $this->CommitNoticeListToCookie();
            }
        }

        return $dNewAmountOnList;
    }
263221
protected function deleteIndexDocuments($table, $uid)
    {
        // record can be indexed for multiple sites
        $indexQueueItems = $this->queue->getItems($table, $uid);
        foreach ($indexQueueItems as $indexQueueItem) {
            $site = $indexQueueItem->getSite();
            $enableCommitsSetting = $site->getSolrConfiguration()->getEnableCommits();
            $siteHash = $site->getSiteHash();
            // a site can have multiple connections (cores / languages)
            $solrConnections = $this->connectionManager->getConnectionsBySite($site);
            $this->deleteRecordInAllSolrConnections($table, $uid, $solrConnections, $siteHash, $enableCommitsSetting);
        }
    }
1172665
@Override
    @GraphTransaction
    public void deleteTrait(String guid, String traitNameToBeDeleted) throws TraitNotFoundException, EntityNotFoundException, RepositoryException {
        LOG.debug("Deleting trait={} from entity={}", traitNameToBeDeleted, guid);
        GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);

        AtlasVertex instanceVertex = graphHelper.getVertexForGUID(guid);

        List<String> traitNames = GraphHelper.getTraitNames(instanceVertex);
        if (!traitNames.contains(traitNameToBeDeleted)) {
                throw new TraitNotFoundException(
                        "Could not find trait=" + traitNameToBeDeleted + " in the repository for entity: " + guid);
        }

        try {
            final String entityTypeName = GraphHelper.getTypeName(instanceVertex);
            String relationshipLabel = GraphHelper.getTraitLabel(entityTypeName, traitNameToBeDeleted);
            AtlasEdge edge = graphHelper.getEdgeForLabel(instanceVertex, relationshipLabel);
            if(edge != null) {
                deleteHandler.deleteEdgeReference(edge, DataTypes.TypeCategory.TRAIT, false, true);
            }

            // update the traits in entity once trait removal is successful
            traitNames.remove(traitNameToBeDeleted);
            updateTraits(instanceVertex, traitNames);
        } catch (Exception e) {
            throw new RepositoryException(e);
        }
    }
258244
public function deleteFailedLoginAttempts($maxAge = null)
    {
        $sql = 'DELETE FROM FailedLoginAttempts';
        if ($maxAge) {
            $platform = $this->connection->getDatabasePlatform();
            $sql .= ' WHERE flaTimestamp <= ' . $platform->getDateSubSecondsExpression($platform->getNowExpression(), (int) $maxAge);
        }

        return (int) $this->connection->executeQuery($sql)->rowCount();
    }
774970
public function deleteAll($idSite)
    {
        Piwik::checkUserHasSuperUserAccess();

        $this->checkSingleIdSite($idSite, $extraMessage = "Note: Cannot delete annotations from multiple sites.");

        $annotations = new AnnotationList($idSite);

        // remove the notes & save the list
        $annotations->removeAll($idSite);
        $annotations->save($idSite);
    }
766193
public function deleteSiteAliasUrls($idsite)
    {
        $db = $this->getDb();
        $db->query("DELETE FROM " . Common::prefixTable("site_url") . " WHERE idsite = ?", $idsite);
    }
449852
public function deleteDependents(Event $event, $ids, $count) {
        $pfk = $this->getPrimaryForeignKey();

        $this->getJunctionRepository()->deleteMany(function(Query $query) use ($pfk, $ids) {
            $query->where($pfk, $ids);
        });
    }
244287
public function get($idSite, $period, $date, $segment = false, $columns = false)
    {
        Piwik::checkUserHasViewAccess($idSite);

        $report = ReportsProvider::factory("Actions", "get");
        $archive = Archive::build($idSite, $period, $date, $segment);

        $requestedColumns = Piwik::getArrayFromApiParameter($columns);
        $columns = $report->getMetricsRequiredForReport($allColumns = null, $requestedColumns);

        $inDbColumnNames = array_map(function ($value) { return 'Actions_' . $value; }, $columns);
        $dataTable = $archive->getDataTableFromNumeric($inDbColumnNames);

        $dataTable->deleteColumns(array_diff($requestedColumns, $columns));

        $newNameMapping = array_combine($inDbColumnNames, $columns);
        $dataTable->filter('ReplaceColumnNames', array($newNameMapping));

        $columnsToShow = $requestedColumns ?: $report->getAllMetrics();
        $dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow));

        return $dataTable;
    }
804792
private function augmentAnnotationData($idSite, $idNote, &$annotation)
    {
        $annotation['idNote'] = $idNote;
        $annotation['canEditOrDelete'] = self::canUserModifyOrDelete($idSite, $annotation);

        // we don't supply user info if the current user is anonymous
        if (Piwik::isUserIsAnonymous()) {
            unset($annotation['user']);
        }
    }
230102
public function updateSiteCreatedTime($idSites, Date $minDate)
    {
        $idSites = Site::getIdSitesFromIdSitesString($idSites);
        Piwik::checkUserHasAdminAccess($idSites);

        $minDateSql = $minDate->subDay(1)->getDatetime();

        $this->getModel()->updateSiteCreatedTime($idSites, $minDateSql);
    }
1252333
public function removeIdxSiteContent(Site $site, AbstractClassContent $content)
    {
        $query = 'DELETE FROM idx_site_content WHERE site_uid = :site AND (content_uid IN '.
                '(SELECT content_uid FROM content_has_subcontent WHERE parent_uid = :content)'.
                'OR content_uid = :content)';

        $params = array(
            'site' => $site->getUid(),
            'content' => $content->getUid(),
        );

        return $this->executeUpdate($query, $params);
    }
646219
public function insertSiteUrl($idSite, $url)
    {
        $db = $this->getDb();
        $db->insert(Common::prefixTable("site_url"), array(
                'idsite' => (int) $idSite,
                'url'    => $url
            )
        );
    }
904674
function (entity, just) {
            _.each(
                systems,
                function (system) {
                    if (_.has(system, 'destroy')) {
                        _.each(system.destroy, function (func, id) {
                            if (entity.has(id)){
                                // Only remove from tracking systems.
                                if (!_.isUndefined(just)) {
                                    if (id !== just) {
                                        return;
                                    }
                                }
                                // Perform the remove.
                                func(entity);
                            }
                        });
                    }
                }
            );
        }