public static function getDeleteTableLogTables() { $result = Common::prefixTables('log_conversion', 'log_link_visit_action', 'log_visit', 'log_conversion_item'); if (Db::isLockPrivilegeGranted()) { $result[] = Common::prefixTable('log_action'); } return $result; }
/** * Deletes all unused entries from the log_action table. This method uses a temporary table to store used * actions, and then deletes rows from log_action that are not in this temporary table. * * Table locking is required to avoid concurrency issues. * * @throws \Exception If table locking permission is not granted to the current MySQL user. */ public function deleteUnusedLogActions() { if (!Db::isLockPrivilegeGranted()) { throw new \Exception("RawLogDao.deleteUnusedLogActions() requires table locking permission in order to complete without error."); } // get current max ID in log tables w/ idaction references. $maxIds = $this->getMaxIdsInLogTables(); $this->createTempTableForStoringUsedActions(); // do large insert (inserting everything before maxIds) w/o locking tables... $this->insertActionsToKeep($maxIds, $deleteOlderThanMax = true); // ... then do small insert w/ locked tables to minimize the amount of time tables are locked. $this->lockLogTables(); $this->insertActionsToKeep($maxIds, $deleteOlderThanMax = false); // delete before unlocking tables so there's no chance a new log row that references an // unused action will be inserted. $this->deleteUnusedActions(); Db::unlockAllTables(); }
public function privacySettings() { Piwik::checkUserHasSomeAdminAccess(); $view = new View('@PrivacyManager/privacySettings'); if (Piwik::hasUserSuperUserAccess()) { $view->deleteData = $this->getDeleteDataInfo(); $view->anonymizeIP = $this->getAnonymizeIPInfo(); $view->dntSupport = DoNotTrackHeaderChecker::isActive(); $view->canDeleteLogActions = Db::isLockPrivilegeGranted(); $view->dbUser = PiwikConfig::getInstance()->database['username']; $view->deactivateNonce = Nonce::getNonce(self::DEACTIVATE_DNT_NONCE); $view->activateNonce = Nonce::getNonce(self::ACTIVATE_DNT_NONCE); } $view->language = LanguagesManager::getLanguageCodeForCurrentUser(); $this->setBasicVariablesView($view); return $view->render(); }
public function privacySettings() { Piwik::checkUserHasSomeAdminAccess(); $view = new View('@PrivacyManager/privacySettings'); if (Piwik::hasUserSuperUserAccess()) { $view->deleteData = $this->getDeleteDataInfo(); $view->anonymizeIP = $this->getAnonymizeIPInfo(); $dntChecker = new DoNotTrackHeaderChecker(); $view->dntSupport = $dntChecker->isActive(); $view->canDeleteLogActions = Db::isLockPrivilegeGranted(); $view->dbUser = PiwikConfig::getInstance()->database['username']; $view->deactivateNonce = Nonce::getNonce(self::DEACTIVATE_DNT_NONCE); $view->activateNonce = Nonce::getNonce(self::ACTIVATE_DNT_NONCE); $view->maskLengthOptions = array(array('key' => '1', 'value' => Piwik::translate('PrivacyManager_AnonymizeIpMaskLength', array("1", "192.168.100.xxx")), 'description' => ''), array('key' => '2', 'value' => Piwik::translate('PrivacyManager_AnonymizeIpMaskLength', array("2", "192.168.xxx.xxx")), 'description' => Piwik::translate('General_Recommended')), array('key' => '3', 'value' => Piwik::translate('PrivacyManager_AnonymizeIpMaskLength', array("3", "192.xxx.xxx.xxx")), 'description' => '')); $view->useAnonymizedIpForVisitEnrichmentOptions = array(array('key' => '1', 'value' => Piwik::translate('General_Yes'), 'description' => Piwik::translate('PrivacyManager_RecommendedForPrivacy')), array('key' => '0', 'value' => Piwik::translate('General_No'), 'description' => '')); $view->scheduleDeletionOptions = array(array('key' => '1', 'value' => Piwik::translate('Intl_PeriodDay')), array('key' => '7', 'value' => Piwik::translate('Intl_PeriodWeek')), array('key' => '30', 'value' => Piwik::translate('Intl_PeriodMonth'))); $view->doNotTrackOptions = array(array('key' => '1', 'value' => Piwik::translate('PrivacyManager_DoNotTrack_Enable'), 'description' => Piwik::translate('General_Recommended')), array('key' => '0', 'value' => Piwik::translate('PrivacyManager_DoNotTrack_Disable'), 'description' => Piwik::translate('General_NotRecommended'))); } $view->language = LanguagesManager::getLanguageCodeForCurrentUser(); $this->setBasicVariablesView($view); return $view->render(); }
public static function getDeleteTableLogTables() { $provider = StaticContainer::get('Piwik\\Plugin\\LogTablesProvider'); $result = array(); foreach ($provider->getAllLogTables() as $logTable) { if ($logTable->getColumnToJoinOnIdVisit()) { $result[] = Common::prefixTable($logTable->getName()); } } if (Db::isLockPrivilegeGranted()) { $result[] = Common::prefixTable('log_action'); } return $result; }
/** * Deletes all unused entries from the log_action table. This method uses a temporary table to store used * actions, and then deletes rows from log_action that are not in this temporary table. * * Table locking is required to avoid concurrency issues. * * @throws \Exception If table locking permission is not granted to the current MySQL user. */ public function deleteUnusedLogActions() { if (!Db::isLockPrivilegeGranted()) { throw new \Exception("RawLogDao.deleteUnusedLogActions() requires table locking permission in order to complete without error."); } $LogAction = Factory::getDAO('log_action'); $LogAction->purgeUnused($this->dimensionMetadataProvider); }