Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-08-12 18:23:38 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-08-21 12:48:31 +0300
commit500202b12aa8879c7deb09035792c9aab99f9da2 (patch)
tree47421d728fdb61a5ed09c1a0e943b9a074184e1f /core/DataAccess
parentaa8591b6e58fa5e9964cacc405493abe7bb80eaf (diff)
refs #8066 faster query to find websites with traffic since last successful archiving
Diffstat (limited to 'core/DataAccess')
-rw-r--r--core/DataAccess/RawLogDao.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/DataAccess/RawLogDao.php b/core/DataAccess/RawLogDao.php
index 184b33909f..7310267b44 100644
--- a/core/DataAccess/RawLogDao.php
+++ b/core/DataAccess/RawLogDao.php
@@ -11,7 +11,6 @@ namespace Piwik\DataAccess;
use Piwik\Common;
use Piwik\Container\StaticContainer;
use Piwik\Db;
-use Piwik\Piwik;
use Piwik\Plugin\Dimension\DimensionMetadataProvider;
/**
@@ -208,6 +207,26 @@ class RawLogDao
Db::unlockAllTables();
}
+
+ /**
+ * Returns the list of the website IDs that received some visits between the specified timestamp.
+ *
+ * @param string $fromDateTime
+ * @param string $toDateTime
+ * @return bool true if there are visits for this site between the given timeframe, false if not
+ */
+ public function hasSiteVisitsBetweenTimeframe($fromDateTime, $toDateTime, $idSite)
+ {
+ $sites = Db::fetchOne("SELECT 1
+ FROM " . Common::prefixTable('log_visit') . "
+ WHERE idsite = ?
+ AND visit_last_action_time > ?
+ AND visit_last_action_time < ?
+ LIMIT 1", array($idSite, $fromDateTime, $toDateTime));
+
+ return (bool) $sites;
+ }
+
/**
* @param array $columnsToSet
* @return string