diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-07 08:59:17 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-07 08:59:31 +0300 |
commit | 59008a5c3f9c017487535b9534d890f21f34420d (patch) | |
tree | 395b1a9010a350ade1a69fa9263895474f9c075c /core | |
parent | e2cfb6128db69cb04209e3dedd01bae79009fa7e (diff) |
Refactoring tests & LocationFetcher (renamed to VisitorGeolocator and documented as service).
Diffstat (limited to 'core')
-rw-r--r-- | core/DataAccess/RawLogFetcher.php | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/core/DataAccess/RawLogFetcher.php b/core/DataAccess/RawLogFetcher.php index 1084c9a550..ec1f7d14ce 100644 --- a/core/DataAccess/RawLogFetcher.php +++ b/core/DataAccess/RawLogFetcher.php @@ -11,6 +11,9 @@ namespace Piwik\DataAccess; use Piwik\Common; use Piwik\Db; +/** + * DAO that queries log tables. + */ class RawLogFetcher { /** @@ -23,17 +26,15 @@ class RawLogFetcher */ public function getVisitsWithDatesLimit($from, $to, $fields = array(), $fromId = 0, $limit = 1000) { - $sql = array( - "SELECT " . implode(', ', $fields), - "FROM " . Common::prefixTable('log_visit'), - "WHERE visit_first_action_time >= ? AND visit_last_action_time < ?", - "AND idvisit > ?", - sprintf("LIMIT %d", $limit) - ); + $sql = "SELECT " . implode(', ', $fields) + . " FROM " . Common::prefixTable('log_visit') + . " WHERE visit_first_action_time >= ? AND visit_last_action_time < ?" + . " AND idvisit > ?" + . sprintf(" LIMIT %d", $limit); $bind = array($from, $to, $fromId); - return Db::get()->fetchAll(implode(' ', $sql), $bind); + return Db::fetchAll($sql, $bind); } /** @@ -43,14 +44,12 @@ class RawLogFetcher */ public function countVisitsWithDatesLimit($from, $to) { - $sql = array( - "SELECT COUNT(*) AS num_rows", - "FROM " . Common::prefixTable('log_visit'), - "WHERE visit_first_action_time >= ? AND visit_last_action_time < ?" - ); + $sql = "SELECT COUNT(*) AS num_rows" + . " FROM " . Common::prefixTable('log_visit') + . " WHERE visit_first_action_time >= ? AND visit_last_action_time < ?"; $bind = array($from, $to); - return (int) Db::get()->fetchOne(implode(' ', $sql), $bind); + return (int) Db::fetchOne($sql, $bind); } -} +}
\ No newline at end of file |