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:
authormattab <matthieu.aubry@gmail.com>2013-07-31 20:46:40 +0400
committermattab <matthieu.aubry@gmail.com>2013-07-31 20:46:40 +0400
commit11752942f0e6526a0d254af2bb2b101491238f29 (patch)
treeb3434b12326b5d84b42312c546c7ec4ee13ab10e
parentd9d4598084aa51d95bf3eab0e961d3c27161cbb8 (diff)
Refs #3741 PHP Namespace conversion continued: Tracker classes,
renaming Unzip to Uncompress, Renaming Tracker/Referer to Tracker/Referrer, and few more
-rw-r--r--core/API/DataTableManipulator/LabelFilter.php1
-rw-r--r--core/ArchiveProcessor/Rules.php4
-rw-r--r--core/Common.php4
-rw-r--r--core/DataAccess/LogAggregator.php6
-rw-r--r--core/DataArray.php10
-rw-r--r--core/DataFiles/SearchEngines.php2
-rw-r--r--core/DataTable.php6
-rw-r--r--core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php6
-rw-r--r--core/DataTable/Filter/ReplaceColumnNames.php6
-rw-r--r--core/FrontController.php4
-rw-r--r--core/IP.php1
-rw-r--r--core/Nonce.php9
-rw-r--r--core/Piwik.php26
-rw-r--r--core/ScheduledTime.php12
-rw-r--r--core/ScheduledTime/Daily.php7
-rw-r--r--core/ScheduledTime/Hourly.php7
-rw-r--r--core/ScheduledTime/Monthly.php7
-rw-r--r--core/ScheduledTime/Weekly.php7
-rw-r--r--core/Session.php4
-rw-r--r--core/Session/SaveHandler/DbTable.php8
-rw-r--r--core/Session/SessionNamespace.php (renamed from core/Session/Namespace.php)5
-rw-r--r--core/Tracker.php58
-rw-r--r--core/Tracker/Action.php129
-rw-r--r--core/Tracker/Cache.php14
-rw-r--r--core/Tracker/Config.php38
-rw-r--r--core/Tracker/Db.php17
-rw-r--r--core/Tracker/Db/DbException.php (renamed from core/Tracker/Db/Exception.php)6
-rw-r--r--core/Tracker/Db/Mysqli.php29
-rw-r--r--core/Tracker/Db/Pdo/Mysql.php22
-rw-r--r--core/Tracker/Db/Pdo/Pgsql.php9
-rw-r--r--core/Tracker/GoalManager.php74
-rw-r--r--core/Tracker/IgnoreCookie.php4
-rw-r--r--core/Tracker/Referrer.php (renamed from core/Tracker/Referer.php)14
-rw-r--r--core/Tracker/Request.php17
-rw-r--r--core/Tracker/Visit.php206
-rw-r--r--core/Tracker/VisitExcluded.php19
-rw-r--r--core/Unzip.php24
-rwxr-xr-xcore/Unzip/Gzip.php6
-rw-r--r--core/Unzip/PclZip.php7
-rwxr-xr-xcore/Unzip/Tar.php6
-rw-r--r--core/Unzip/UncompressInterface.php (renamed from core/Unzip/Interface.php)4
-rw-r--r--core/Unzip/ZipArchive.php58
-rw-r--r--core/Updates/0.2.34.php3
-rw-r--r--core/Updates/0.6.2.php3
-rw-r--r--core/functions.php2
-rw-r--r--libs/PiwikTracker/PiwikTracker.php2
-rw-r--r--misc/log-analytics/tests/logs/iis.log2
-rw-r--r--piwik.php9
-rw-r--r--plugins/API/API.php9
-rw-r--r--plugins/Actions/API.php15
-rw-r--r--plugins/Actions/Actions.php11
-rw-r--r--plugins/Actions/Archiver.php39
-rw-r--r--plugins/Actions/ArchivingHelper.php29
-rw-r--r--plugins/CoreAdminHome/Controller.php5
-rw-r--r--plugins/CoreAdminHome/CoreAdminHome.php5
-rw-r--r--plugins/CustomVariables/API.php3
-rw-r--r--plugins/CustomVariables/Archiver.php3
-rw-r--r--plugins/DBStats/DBStats.php3
-rw-r--r--plugins/Dashboard/Controller.php7
-rw-r--r--plugins/DoNotTrack/DoNotTrack.php6
-rw-r--r--plugins/Goals/API.php16
-rw-r--r--plugins/Goals/Archiver.php17
-rw-r--r--plugins/Goals/Goals.php5
-rw-r--r--plugins/Installation/Controller.php3
-rw-r--r--plugins/Live/API.php22
-rw-r--r--plugins/Live/Visitor.php3
-rw-r--r--plugins/Overlay/API.php3
-rw-r--r--plugins/Overlay/Controller.php5
-rw-r--r--plugins/PrivacyManager/PrivacyManager.php10
-rw-r--r--plugins/Proxy/Controller.php2
-rw-r--r--plugins/Referers/API.php2
-rw-r--r--plugins/Referers/Referers.php2
-rw-r--r--plugins/SitesManager/API.php17
-rw-r--r--plugins/Transitions/API.php29
-rw-r--r--plugins/UserCountry/API.php5
-rwxr-xr-xplugins/UserCountry/GeoIPAutoUpdater.php6
-rwxr-xr-xplugins/UserCountry/LocationProvider.php3
-rw-r--r--plugins/UserCountry/functions.php13
-rw-r--r--plugins/UserSettings/functions.php3
-rw-r--r--plugins/UsersManager/API.php9
-rw-r--r--plugins/UsersManager/Controller.php5
-rwxr-xr-xtests/LocalTracker.php3
-rw-r--r--tests/PHPUnit/Core/DataTableTest.php8
-rw-r--r--tests/PHPUnit/Core/ReleaseCheckListTest.php3
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/DailyTest.php26
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/HourlyTest.php16
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php32
-rw-r--r--tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php34
-rw-r--r--tests/PHPUnit/Core/TaskSchedulerTest.php5
-rw-r--r--tests/PHPUnit/Core/Tracker/ActionTest.php60
-rw-r--r--tests/PHPUnit/Core/Tracker/VisitTest.php12
-rw-r--r--tests/PHPUnit/Core/UnzipTest.php28
-rw-r--r--tests/PHPUnit/Core/UrlTest.php2
-rw-r--r--tests/PHPUnit/DatabaseTestCase.php3
-rw-r--r--tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php5
-rwxr-xr-xtests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php2
-rw-r--r--tests/PHPUnit/Integration/UrlNormalizationTest.php3
-rwxr-xr-xtests/PHPUnit/IntegrationTestCase.php5
-rw-r--r--tests/PHPUnit/Plugins/ActionsTest.php41
-rw-r--r--tests/PHPUnit/Plugins/PDFReportsTest.php10
-rwxr-xr-xtests/PHPUnit/Plugins/PrivacyManagerTest.php6
-rw-r--r--tests/PHPUnit/proxy/index.php3
-rwxr-xr-xtests/PHPUnit/proxy/piwik.php3
103 files changed, 837 insertions, 712 deletions
diff --git a/core/API/DataTableManipulator/LabelFilter.php b/core/API/DataTableManipulator/LabelFilter.php
index f8eb91ec6f..fdc5114c98 100644
--- a/core/API/DataTableManipulator/LabelFilter.php
+++ b/core/API/DataTableManipulator/LabelFilter.php
@@ -14,7 +14,6 @@ use Piwik\Common;
use Piwik\DataTable;
use Piwik\DataTable\Row;
use Piwik\API\DataTableManipulator;
-use false;
/**
* This class is responsible for handling the label parameter that can be
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index d58c7e5fb3..9b22d018bd 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -17,7 +17,7 @@ use Piwik\Common;
use Piwik\Segment;
use Piwik\Site;
use Piwik\Date;
-use Piwik_Tracker_Cache;
+use Piwik\Tracker\Cache;
/**
* This class contains Archiving rules/logic which are used in several places
@@ -232,6 +232,6 @@ class Rules
throw new Exception('Browser trigger archiving must be set to true or false.');
}
Piwik_SetOption(self::OPTION_BROWSER_TRIGGER_ARCHIVING, (int)$enabled, $autoLoad = true);
- Piwik_Tracker_Cache::clearCacheGeneral();
+ Cache::clearCacheGeneral();
}
} \ No newline at end of file
diff --git a/core/Common.php b/core/Common.php
index 4f40424c95..d947fc6fd7 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -13,7 +13,7 @@ namespace Piwik;
use Exception;
use Piwik\IP;
use Piwik\Tracker;
-use Piwik_Tracker_Cache;
+use Piwik\Tracker\Cache;
use Piwik_UserCountry_LocationProvider_Default;
/**
@@ -1551,7 +1551,7 @@ class Common
*/
public static function getCurrentLocationProviderId()
{
- $cache = Piwik_Tracker_Cache::getCacheGeneral();
+ $cache = Cache::getCacheGeneral();
return empty($cache['currentLocationProviderId'])
? Piwik_UserCountry_LocationProvider_Default::ID
: $cache['currentLocationProviderId'];
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php
index 0035c121dd..b05bd327cb 100644
--- a/core/DataAccess/LogAggregator.php
+++ b/core/DataAccess/LogAggregator.php
@@ -17,7 +17,7 @@ use Piwik\Date;
use Piwik\Segment;
use Piwik\Site;
use Piwik\RankingQuery;
-use Piwik_Tracker_GoalManager;
+use Piwik\Tracker\GoalManager;
use Zend_Registry;
/**
@@ -115,7 +115,7 @@ class LogAggregator
static public function getSqlRevenue($field)
{
- return "ROUND(" . $field . "," . Piwik_Tracker_GoalManager::REVENUE_PRECISION . ")";
+ return "ROUND(" . $field . "," . GoalManager::REVENUE_PRECISION . ")";
}
/**
@@ -321,7 +321,7 @@ class LogAggregator
" . self::getSqlRevenue('SUM(price)') . " as `" . Metrics::INDEX_ECOMMERCE_ITEM_PRICE . "`,
count(distinct idorder) as `" . Metrics::INDEX_ECOMMERCE_ORDERS . "`,
count(idvisit) as `" . Metrics::INDEX_NB_VISITS . "`,
- case idorder when '0' then " . Piwik_Tracker_GoalManager::IDGOAL_CART . " else " . Piwik_Tracker_GoalManager::IDGOAL_ORDER . " end as ecommerceType
+ case idorder when '0' then " . GoalManager::IDGOAL_CART . " else " . GoalManager::IDGOAL_ORDER . " end as ecommerceType
FROM " . Common::prefixTable('log_conversion_item') . "
LEFT JOIN " . Common::prefixTable('log_action') . "
ON $field = idaction
diff --git a/core/DataArray.php b/core/DataArray.php
index e9971997d2..5c2570392d 100644
--- a/core/DataArray.php
+++ b/core/DataArray.php
@@ -12,7 +12,7 @@ namespace Piwik;
use Exception;
use Piwik\Metrics;
-use Piwik_Tracker_GoalManager;
+use Piwik\Tracker\GoalManager;
/**
* The DataArray is a data structure used to aggregate datasets,
@@ -128,13 +128,13 @@ class DataArray
*/
protected static function makeEmptyGoalRow($idGoal)
{
- if ($idGoal > Piwik_Tracker_GoalManager::IDGOAL_ORDER) {
+ if ($idGoal > GoalManager::IDGOAL_ORDER) {
return array(Metrics::INDEX_GOAL_NB_CONVERSIONS => 0,
Metrics::INDEX_GOAL_NB_VISITS_CONVERTED => 0,
Metrics::INDEX_GOAL_REVENUE => 0,
);
}
- if ($idGoal == Piwik_Tracker_GoalManager::IDGOAL_ORDER) {
+ if ($idGoal == GoalManager::IDGOAL_ORDER) {
return array(Metrics::INDEX_GOAL_NB_CONVERSIONS => 0,
Metrics::INDEX_GOAL_NB_VISITS_CONVERTED => 0,
Metrics::INDEX_GOAL_REVENUE => 0,
@@ -145,7 +145,7 @@ class DataArray
Metrics::INDEX_GOAL_ECOMMERCE_ITEMS => 0,
);
}
- // idGoal == Piwik_Tracker_GoalManager::IDGOAL_CART
+ // idGoal == GoalManager::IDGOAL_CART
return array(Metrics::INDEX_GOAL_NB_CONVERSIONS => 0,
Metrics::INDEX_GOAL_NB_VISITS_CONVERTED => 0,
Metrics::INDEX_GOAL_REVENUE => 0,
@@ -276,7 +276,7 @@ class DataArray
$revenue = $conversions = 0;
foreach ($values[Metrics::INDEX_GOALS] as $idgoal => $goalValues) {
// Do not sum Cart revenue since it is a lost revenue
- if ($idgoal >= Piwik_Tracker_GoalManager::IDGOAL_ORDER) {
+ if ($idgoal >= GoalManager::IDGOAL_ORDER) {
$revenue += $goalValues[Metrics::INDEX_GOAL_REVENUE];
$conversions += $goalValues[Metrics::INDEX_GOAL_NB_CONVERSIONS];
}
diff --git a/core/DataFiles/SearchEngines.php b/core/DataFiles/SearchEngines.php
index 7df02fb1c0..1c438530ed 100644
--- a/core/DataFiles/SearchEngines.php
+++ b/core/DataFiles/SearchEngines.php
@@ -903,7 +903,7 @@ if (!isset($GLOBALS['Piwik_SearchEngines'])) {
'www.websearch.com' => array('WebSearch', array('qkw', 'q'), 'search/results2.aspx?q={k}'),
// Wedoo
- // 2011-02-15 - keyword no longer appears to be in Referer URL; candidate for removal?
+ // 2011-02-15 - keyword no longer appears to be in Referrer URL; candidate for removal?
'fr.wedoo.com' => array('Wedoo', 'keyword'),
'en.wedoo.com' => array('Wedoo'),
'es.wedoo.com' => array('Wedoo'),
diff --git a/core/DataTable.php b/core/DataTable.php
index 74d466cf5b..d5e2866730 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -142,8 +142,6 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
* [ keyword2, +1000% ]
* [ keyword3, -430% ]
*
- * @see Piwik_DataTable\Row A DataTable is composed of Piwik_DataTable\Row
- *
* @package Piwik
* @subpackage DataTable
*/
@@ -261,7 +259,7 @@ class DataTable
/**
* The operations that should be used when aggregating columns from multiple rows.
- * @see self::addDataTable() and Piwik_DataTable\Row::sumRow()
+ * @see self::addDataTable() and DataTable\Row::sumRow()
*/
protected $columnAggregationOperations = array();
@@ -1445,7 +1443,7 @@ class DataTable
/**
* Set the aggregation operation for a column, e.g. "min".
- * @see self::addDataTable() and Piwik_DataTable\Row::sumRow()
+ * @see self::addDataTable() and DataTable\Row::sumRow()
*
* @param string $columnName
* @param string $operation
diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
index 1ab8d92c93..32fc8df72b 100644
--- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
+++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
@@ -15,7 +15,7 @@ use Piwik\DataTable;
use Piwik\DataTable\Filter\AddColumnsProcessedMetrics;
use Piwik\Metrics;
use Piwik\Piwik;
-use Piwik_Tracker_GoalManager;
+use Piwik\Tracker\GoalManager;
/**
* @package Piwik
@@ -73,7 +73,7 @@ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics
{
// Add standard processed metrics
parent::filter($table);
- $roundingPrecision = Piwik_Tracker_GoalManager::REVENUE_PRECISION;
+ $roundingPrecision = GoalManager::REVENUE_PRECISION;
$expectedColumns = array();
foreach ($table->getRows() as $key => $row) {
$currentColumns = $row->getColumns();
@@ -89,7 +89,7 @@ class AddColumnsProcessedMetricsGoal extends AddColumnsProcessedMetrics
if ($goalId == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) {
continue;
}
- if ($goalId >= Piwik_Tracker_GoalManager::IDGOAL_ORDER
+ if ($goalId >= GoalManager::IDGOAL_ORDER
|| $goalId == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER
) {
$revenue += (int)$this->getColumn($columnValue, Metrics::INDEX_GOAL_REVENUE, Metrics::$mappingFromIdToNameGoal);
diff --git a/core/DataTable/Filter/ReplaceColumnNames.php b/core/DataTable/Filter/ReplaceColumnNames.php
index abf802b82a..0e1d40fe75 100644
--- a/core/DataTable/Filter/ReplaceColumnNames.php
+++ b/core/DataTable/Filter/ReplaceColumnNames.php
@@ -15,7 +15,7 @@ use Piwik\DataTable\Simple;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\DataTable;
-use Piwik_Tracker_GoalManager;
+use Piwik\Tracker\GoalManager;
/**
* This filter replaces column names using a mapping table that maps from the old name to the new name.
@@ -140,9 +140,9 @@ class ReplaceColumnNames extends Filter
$newSubColumns = array();
foreach ($columnValue as $idGoal => $goalValues) {
$mapping = Metrics::$mappingFromIdToNameGoal;
- if ($idGoal == Piwik_Tracker_GoalManager::IDGOAL_CART) {
+ if ($idGoal == GoalManager::IDGOAL_CART) {
$idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART;
- } elseif ($idGoal == Piwik_Tracker_GoalManager::IDGOAL_ORDER) {
+ } elseif ($idGoal == GoalManager::IDGOAL_ORDER) {
$idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER;
}
foreach ($goalValues as $id => $goalValue) {
diff --git a/core/FrontController.php b/core/FrontController.php
index fec59e2715..1e9e1ff681 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -186,7 +186,7 @@ class FrontController
*
* @return Exception
*/
- public function createConfigObject()
+ static public function createConfigObject()
{
$exceptionToThrow = false;
try {
@@ -233,7 +233,7 @@ class FrontController
Translate::getInstance()->loadEnglishTranslation();
- $exceptionToThrow = $this->createConfigObject();
+ $exceptionToThrow = self::createConfigObject();
if (Session::isFileBasedSessions()) {
Session::start();
diff --git a/core/IP.php b/core/IP.php
index e1fecf600d..e4a87cb9ee 100644
--- a/core/IP.php
+++ b/core/IP.php
@@ -13,7 +13,6 @@ namespace Piwik;
use Piwik\Config;
use Piwik\Common;
-use false;
/**
* Handling IP addresses (both IPv4 and IPv6).
diff --git a/core/Nonce.php b/core/Nonce.php
index ff6a97227b..8f876b1890 100644
--- a/core/Nonce.php
+++ b/core/Nonce.php
@@ -11,9 +11,8 @@
namespace Piwik;
use Piwik\Common;
-use Piwik_Session_Namespace;
+use Piwik\Session\SessionNamespace;
use Piwik\Url;
-use false;
/**
* Nonce class.
@@ -40,7 +39,7 @@ class Nonce
static public function getNonce($id, $ttl = 300)
{
// save session-dependent nonce
- $ns = new Piwik_Session_Namespace($id);
+ $ns = new SessionNamespace($id);
$nonce = $ns->nonce;
// re-use an unexpired nonce (a small deviation from the "used only once" principle, so long as we do not reset the expiration)
@@ -64,7 +63,7 @@ class Nonce
*/
static public function verifyNonce($id, $cnonce)
{
- $ns = new Piwik_Session_Namespace($id);
+ $ns = new SessionNamespace($id);
$nonce = $ns->nonce;
// validate token
@@ -97,7 +96,7 @@ class Nonce
*/
static public function discardNonce($id)
{
- $ns = new Piwik_Session_Namespace($id);
+ $ns = new SessionNamespace($id);
$ns->unsetAll();
}
diff --git a/core/Piwik.php b/core/Piwik.php
index 7f0a25e51d..7c70d2a5c0 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -21,9 +21,8 @@ use Piwik\Db\Adapter;
use Piwik\Db\Schema;
use Piwik\Session;
use Piwik\Tracker;
-use Piwik_Tracker_Cache;
-use Piwik_Tracker_Db;
-use Piwik_Tracker_GoalManager;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\GoalManager;
use Piwik\Url;
use Piwik_UsersManager_API;
use Piwik\View;
@@ -148,7 +147,7 @@ class Piwik
{
AssetManager::removeMergedAssets();
View::clearCompiledTemplates();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
}
/**
@@ -1094,20 +1093,19 @@ class Piwik
Piwik::log(sprintf("Total queries = %d (total sql time = %.2fs)", $queryCount, $totalTime));
}
+
+ static function maxSumMsFirst($a, $b)
+ {
+ return $a['sum_time_ms'] < $b['sum_time_ms'];
+ }
+
/**
* Print profiling report for the tracker
*
- * @param Piwik_Tracker_Db $db Tracker database object (or null)
+ * @param Db $db Tracker database object (or null)
*/
static public function printSqlProfilingReportTracker($db = null)
{
- if (!function_exists('maxSumMsFirst')) {
- function maxSumMsFirst($a, $b)
- {
- return $a['sum_time_ms'] < $b['sum_time_ms'];
- }
- }
-
if (is_null($db)) {
$db = Tracker::getDatabase();
}
@@ -1117,7 +1115,7 @@ class Piwik
if ($all === false) {
return;
}
- uasort($all, 'maxSumMsFirst');
+ uasort($all, 'self::maxSumMsFirst');
$infoIndexedByQuery = array();
foreach ($all as $infoQuery) {
@@ -1374,7 +1372,7 @@ class Piwik
// 0.0 => 0
$value = round($value);
} else {
- $precision = Piwik_Tracker_GoalManager::REVENUE_PRECISION;
+ $precision = GoalManager::REVENUE_PRECISION;
$value = sprintf("%01." . $precision . "f", $value);
}
}
diff --git a/core/ScheduledTime.php b/core/ScheduledTime.php
index b0c6b8b224..a2dd0bb7e5 100644
--- a/core/ScheduledTime.php
+++ b/core/ScheduledTime.php
@@ -12,9 +12,9 @@
namespace Piwik;
use Exception;
-use Piwik_ScheduledTime_Daily;
-use Piwik_ScheduledTime_Monthly;
-use Piwik_ScheduledTime_Weekly;
+use Piwik\ScheduledTime\Daily;
+use Piwik\ScheduledTime\Monthly;
+use Piwik\ScheduledTime\Weekly;
/**
* The ScheduledTime abstract class is used as a base class for different types of scheduling intervals.
@@ -52,11 +52,11 @@ abstract class ScheduledTime
{
switch ($period) {
case self::PERIOD_MONTH:
- return new Piwik_ScheduledTime_Monthly();
+ return new Monthly();
case self::PERIOD_WEEK:
- return new Piwik_ScheduledTime_Weekly();
+ return new Weekly();
case self::PERIOD_DAY:
- return new Piwik_ScheduledTime_Daily();
+ return new Daily();
default:
throw new Exception('period ' . $period . 'is undefined.');
diff --git a/core/ScheduledTime/Daily.php b/core/ScheduledTime/Daily.php
index 1783ddb160..83fe3ecfe8 100644
--- a/core/ScheduledTime/Daily.php
+++ b/core/ScheduledTime/Daily.php
@@ -8,16 +8,19 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\ScheduledTime;
+
+use Exception;
use Piwik\ScheduledTime;
/**
- * Piwik_ScheduledTime_Daily class is used to schedule tasks every day.
+ * Daily class is used to schedule tasks every day.
*
* @see Piwik_ScheduledTask
* @package Piwik
* @subpackage ScheduledTime
*/
-class Piwik_ScheduledTime_Daily extends ScheduledTime
+class Daily extends ScheduledTime
{
public function getRescheduledTime()
{
diff --git a/core/ScheduledTime/Hourly.php b/core/ScheduledTime/Hourly.php
index 142ce95868..102359be86 100644
--- a/core/ScheduledTime/Hourly.php
+++ b/core/ScheduledTime/Hourly.php
@@ -8,16 +8,19 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\ScheduledTime;
+
+use Exception;
use Piwik\ScheduledTime;
/**
- * Piwik_ScheduledTime_Hourly class is used to schedule tasks every hour.
+ * Hourly class is used to schedule tasks every hour.
*
* @see Piwik_ScheduledTask
* @package Piwik
* @subpackage ScheduledTime
*/
-class Piwik_ScheduledTime_Hourly extends ScheduledTime
+class Hourly extends ScheduledTime
{
public function getRescheduledTime()
{
diff --git a/core/ScheduledTime/Monthly.php b/core/ScheduledTime/Monthly.php
index c3e4d759da..d4e3335867 100644
--- a/core/ScheduledTime/Monthly.php
+++ b/core/ScheduledTime/Monthly.php
@@ -8,16 +8,19 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\ScheduledTime;
+
+use Exception;
use Piwik\ScheduledTime;
/**
- * Piwik_ScheduledTime_Monthly class is used to schedule tasks every month.
+ * Monthly class is used to schedule tasks every month.
*
* @see Piwik_ScheduledTask
* @package Piwik
* @subpackage ScheduledTime
*/
-class Piwik_ScheduledTime_Monthly extends ScheduledTime
+class Monthly extends ScheduledTime
{
/**
* Day of the week for scheduled time.
diff --git a/core/ScheduledTime/Weekly.php b/core/ScheduledTime/Weekly.php
index af8a78214f..497ca75d7e 100644
--- a/core/ScheduledTime/Weekly.php
+++ b/core/ScheduledTime/Weekly.php
@@ -8,16 +8,19 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\ScheduledTime;
+
+use Exception;
use Piwik\ScheduledTime;
/**
- * Piwik_ScheduledTime_Weekly class is used to schedule tasks every week.
+ * Weekly class is used to schedule tasks every week.
*
* @see Piwik_ScheduledTask
* @package Piwik
* @subpackage ScheduledTime
*/
-class Piwik_ScheduledTime_Weekly extends ScheduledTime
+class Weekly extends ScheduledTime
{
public function getRescheduledTime()
diff --git a/core/Session.php b/core/Session.php
index 5286d02bd3..16378607ed 100644
--- a/core/Session.php
+++ b/core/Session.php
@@ -14,7 +14,7 @@ use Exception;
use Piwik\Config;
use Piwik\Piwik;
use Piwik\Common;
-use Piwik_Session_SaveHandler_DbTable;
+use Piwik\Session\SaveHandler\DbTable;
use Zend_Registry;
use Zend_Session;
@@ -109,7 +109,7 @@ class Session extends Zend_Session
'db' => $db,
);
- $saveHandler = new Piwik_Session_SaveHandler_DbTable($config);
+ $saveHandler = new DbTable($config);
if ($saveHandler) {
self::setSaveHandler($saveHandler);
}
diff --git a/core/Session/SaveHandler/DbTable.php b/core/Session/SaveHandler/DbTable.php
index a8bedd44ef..ddff2c167f 100644
--- a/core/Session/SaveHandler/DbTable.php
+++ b/core/Session/SaveHandler/DbTable.php
@@ -9,13 +9,19 @@
* @package Piwik
*/
+namespace Piwik\Session\SaveHandler;
+
+use Zend_Session;
+use Zend_Session_SaveHandler_Interface;
+use true;
+
/**
* Database-backed session save handler
*
* @package Piwik
* @subpackage Session
*/
-class Piwik_Session_SaveHandler_DbTable implements Zend_Session_SaveHandler_Interface
+class DbTable implements Zend_Session_SaveHandler_Interface
{
protected $config;
protected $maxLifetime;
diff --git a/core/Session/Namespace.php b/core/Session/SessionNamespace.php
index d46ca799d7..63ede5f45e 100644
--- a/core/Session/Namespace.php
+++ b/core/Session/SessionNamespace.php
@@ -8,7 +8,10 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Session;
+
use Piwik\Common;
+use Zend_Session_Namespace;
/**
* Session namespace.
@@ -16,7 +19,7 @@ use Piwik\Common;
* @package Piwik
* @subpackage Session
*/
-class Piwik_Session_Namespace extends Zend_Session_Namespace
+class SessionNamespace extends Zend_Session_Namespace
{
/**
* @param string $namespace
diff --git a/core/Tracker.php b/core/Tracker.php
index 0f8185a438..4042524422 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -17,15 +17,13 @@ use Piwik\Common;
use Piwik\Access;
use Piwik\Translate;
use Piwik\TaskScheduler;
-use Piwik_Tracker_Cache;
-use Piwik_Tracker_Db;
-use Piwik_Tracker_Db_Exception;
-use Piwik_Tracker_Db_Mysqli;
-use Piwik_Tracker_Db_Pdo_Mysql;
-use Piwik_Tracker_Request;
-use Piwik_Tracker_Visit;
-use Piwik_Tracker_Visit_Excluded;
-use Piwik_Tracker_Visit_Interface;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\Db\DbException;
+use Piwik\Tracker\Db\Mysqli;
+use Piwik\Tracker\Db\Pdo\Mysql;
+use Piwik\Tracker\Request;
+use Piwik\Tracker\Visit;
+use Piwik\Tracker\VisitInterface;
use Zend_Registry;
/**
@@ -42,7 +40,7 @@ class Tracker
{
protected $stateValid = self::STATE_NOTHING_TO_NOTICE;
/**
- * @var Piwik_Tracker_Db
+ * @var Db
*/
protected static $db = null;
@@ -205,7 +203,7 @@ class Tracker
}
// a Bulk Tracking request that is not authenticated should fail
- if (!Piwik_Tracker_Request::authenticateSuperUserOrAdmin($tokenAuth, $idSiteForAuthentication)) {
+ if (!Request::authenticateSuperUserOrAdmin($tokenAuth, $idSiteForAuthentication)) {
throw new Exception(" token_auth specified is not valid for site " . intval($idSiteForAuthentication));
}
}
@@ -225,7 +223,7 @@ class Tracker
$isAuthenticated = false;
if (!empty($this->requests)) {
foreach ($this->requests as $params) {
- $request = new Piwik_Tracker_Request($params, $tokenAuth);
+ $request = new Request($params, $tokenAuth);
$this->init($request);
try {
@@ -244,10 +242,10 @@ class Tracker
} else {
Common::printDebug("The request is invalid: empty request, or maybe tracking is disabled in the config.ini.php via record_statistics=0");
}
- } catch (Piwik_Tracker_Db_Exception $e) {
+ } catch (DbException $e) {
Common::printDebug("<b>" . $e->getMessage() . "</b>");
$this->exitWithException($e, $isAuthenticated);
- } catch (Piwik_Tracker_Visit_Excluded $e) {
+ } catch (VisitExcluded $e) {
} catch (Exception $e) {
$this->exitWithException($e, $isAuthenticated);
}
@@ -269,7 +267,7 @@ class Tracker
$this->exitWithException($e);
}
} else {
- $this->handleEmptyRequest(new Piwik_Tracker_Request($_GET + $_POST));
+ $this->handleEmptyRequest(new Request($_GET + $_POST));
}
$this->end();
}
@@ -300,7 +298,7 @@ class Tracker
// If the user disabled browser archiving, he has already setup a cron
// To avoid parallel requests triggering the Scheduled Tasks,
// Get last time tasks started executing
- $cache = Piwik_Tracker_Cache::getCacheGeneral();
+ $cache = Cache::getCacheGeneral();
if ($minimumInterval <= 0
|| empty($cache['isBrowserTriggerArchivingEnabled'])
) {
@@ -313,7 +311,7 @@ class Tracker
|| $nextRunTime < $now
) {
$cache['lastTrackerCronRun'] = $now;
- Piwik_Tracker_Cache::setCacheGeneral($cache);
+ Cache::setCacheGeneral($cache);
self::initCorePiwikInTrackerMode();
Piwik_SetOption('lastTrackerCronRun', $cache['lastTrackerCronRun']);
Common::printDebug('-> Scheduled Tasks: Starting...');
@@ -424,7 +422,7 @@ class Tracker
/**
* Initialization
*/
- protected function init(Piwik_Tracker_Request $request)
+ protected function init(Request $request)
{
$this->handleTrackingApi($request);
$this->loadTrackerPlugins($request);
@@ -474,18 +472,18 @@ class Tracker
*
* @param array $configDb Database configuration
* @throws Exception
- * @return Piwik_Tracker_Db_Mysqli|Piwik_Tracker_Db_Pdo_Mysql
+ * @return \Piwik\Tracker\Db\Mysqli|\Piwik\Tracker\Db\Pdo\Mysql
*/
public static function factory($configDb)
{
switch ($configDb['adapter']) {
case 'PDO_MYSQL':
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Pdo/Mysql.php';
- return new Piwik_Tracker_Db_Pdo_Mysql($configDb);
+ return new Mysql($configDb);
case 'MYSQLI':
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Mysqli.php';
- return new Piwik_Tracker_Db_Mysqli($configDb);
+ return new Mysqli($configDb);
}
throw new Exception('Unsupported database adapter ' . $configDb['adapter']);
@@ -523,12 +521,12 @@ class Tracker
}
self::$db = $db;
} catch (Exception $e) {
- throw new Piwik_Tracker_Db_Exception($e->getMessage(), $e->getCode());
+ throw new DbException($e->getMessage(), $e->getCode());
}
}
/**
- * @return Piwik_Tracker_Db
+ * @return Db
*/
public static function getDatabase()
{
@@ -548,7 +546,7 @@ class Tracker
* This method can be overwritten to use a different Tracker_Visit object
*
* @throws Exception
- * @return Piwik_Tracker_Visit
+ * @return \Piwik\Tracker\Visit
*/
protected function getNewVisitObject()
{
@@ -556,9 +554,9 @@ class Tracker
Piwik_PostEvent('Tracker.getNewVisitObject', array(&$visit));
if (is_null($visit)) {
- $visit = new Piwik_Tracker_Visit();
- } elseif (!($visit instanceof Piwik_Tracker_Visit_Interface)) {
- throw new Exception("The Visit object set in the plugin must implement Piwik_Tracker_Visit_Interface");
+ $visit = new Visit();
+ } elseif (!($visit instanceof VisitInterface)) {
+ throw new Exception("The Visit object set in the plugin must implement VisitInterface");
}
return $visit;
}
@@ -602,7 +600,7 @@ class Tracker
$this->stateValid = $value;
}
- protected function loadTrackerPlugins(Piwik_Tracker_Request $request)
+ protected function loadTrackerPlugins(Request $request)
{
// Adding &dp=1 will disable the provider plugin, if token_auth is used (used to speed up bulk imports)
$disableProvider = $request->getParam('dp');
@@ -627,7 +625,7 @@ class Tracker
}
}
- protected function handleEmptyRequest(Piwik_Tracker_Request $request)
+ protected function handleEmptyRequest(Request $request)
{
$countParameters = $request->getParamsCount();
if ($countParameters == 0) {
@@ -659,7 +657,7 @@ class Tracker
* This method allows to set custom IP + server time + visitor ID, when using Tracking API.
* These two attributes can be only set by the Super User (passing token_auth).
*/
- protected function handleTrackingApi(Piwik_Tracker_Request $request)
+ protected function handleTrackingApi(Request $request)
{
if (!$request->isAuthenticated()) {
return;
diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php
index b7df4c0b1c..3d9e290876 100644
--- a/core/Tracker/Action.php
+++ b/core/Tracker/Action.php
@@ -8,44 +8,14 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Config;
+
+namespace Piwik\Tracker;
+use Exception;
use Piwik\Common;
+use Piwik\Config;
use Piwik\Tracker;
-
-/**
- * Interface of the Action object.
- * New Action classes can be defined in plugins and used instead of the default one.
- *
- * @package Piwik
- * @subpackage Tracker
- */
-interface Piwik_Tracker_Action_Interface
-{
- const TYPE_ACTION_URL = 1;
- const TYPE_OUTLINK = 2;
- const TYPE_DOWNLOAD = 3;
- const TYPE_ACTION_NAME = 4;
- const TYPE_ECOMMERCE_ITEM_SKU = 5;
- const TYPE_ECOMMERCE_ITEM_NAME = 6;
- const TYPE_ECOMMERCE_ITEM_CATEGORY = 7;
- const TYPE_SITE_SEARCH = 8;
-
- public function __construct(Piwik_Tracker_Request $request);
-
- public function getActionUrl();
-
- public function getActionName();
-
- public function getActionType();
-
- public function record($idVisit, $visitorIdCookie, $idRefererActionUrl, $idRefererActionName, $timeSpentRefererAction);
-
- public function getIdActionUrl();
-
- public function getIdActionName();
-
- public function getIdLinkVisitAction();
-}
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\Request;
/**
* Handles an action (page view, download or outlink) by the visitor.
@@ -54,10 +24,10 @@ interface Piwik_Tracker_Action_Interface
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
+class Action implements ActionInterface
{
/**
- * @var Piwik_Tracker_Request
+ * @var Request
*/
private $request;
@@ -151,8 +121,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
return $fullUrl;
}
-
- public function __construct(Piwik_Tracker_Request $request)
+ public function __construct(Request $request)
{
$this->request = $request;
$this->init();
@@ -184,12 +153,12 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
// we can add here action types for names of other actions than page views (like downloads, outlinks)
switch ($this->getActionType()) {
- case Piwik_Tracker_Action_Interface::TYPE_ACTION_URL:
- $actionNameType = Piwik_Tracker_Action_Interface::TYPE_ACTION_NAME;
+ case ActionInterface::TYPE_ACTION_URL:
+ $actionNameType = ActionInterface::TYPE_ACTION_NAME;
break;
- case Piwik_Tracker_Action_Interface::TYPE_SITE_SEARCH:
- $actionNameType = Piwik_Tracker_Action_Interface::TYPE_SITE_SEARCH;
+ case ActionInterface::TYPE_SITE_SEARCH:
+ $actionNameType = ActionInterface::TYPE_SITE_SEARCH;
break;
}
@@ -332,7 +301,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
*/
public static function shouldRemoveURLFragmentFor($idSite)
{
- $websiteAttributes = Piwik_Tracker_Cache::getCacheWebsiteAttributes($idSite);
+ $websiteAttributes = Cache::getCacheWebsiteAttributes($idSite);
return !$websiteAttributes['keep_url_fragment'];
}
@@ -383,7 +352,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
$campaignTrackingParameters[1] // campaign keyword parameters
);
- $website = Piwik_Tracker_Cache::getCacheWebsiteAttributes($idSite);
+ $website = Cache::getCacheWebsiteAttributes($idSite);
$excludedParameters = isset($website['excluded_parameters'])
? $website['excluded_parameters']
: array();
@@ -460,7 +429,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
static public function getSqlSelectActionId()
{
$sql = "SELECT idaction, type, name
- FROM " . Common::prefixTable('log_action')
+ FROM " . Common::prefixTable('log_action')
. " WHERE "
. " ( hash = CRC32(?) AND name = ? AND type = ? ) ";
return $sql;
@@ -492,7 +461,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
if ($i > 0) {
$sql .= " OR ( hash = CRC32(?) AND name = ? AND type = ? ) ";
}
- if ($type == Piwik_Tracker_Action::TYPE_ACTION_URL) {
+ if ($type == Tracker\Action::TYPE_ACTION_URL) {
// normalize urls by stripping protocol and www
$normalizedUrls[$index] = self::normalizeUrl($name);
$name = $normalizedUrls[$index]['url'];
@@ -615,8 +584,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
$url = $this->getActionUrl();
// this code is a mess, but basically, getActionType() returns SITE_SEARCH,
// but we do want to record the site search URL as an ACTION_URL
- if ($nameType == Piwik_Tracker_Action::TYPE_SITE_SEARCH) {
- $urlType = Piwik_Tracker_Action::TYPE_ACTION_URL;
+ if ($nameType == Tracker\Action::TYPE_SITE_SEARCH) {
+ $urlType = Tracker\Action::TYPE_ACTION_URL;
// By default, Site Search does not record the URL for the Search Result page, to slightly improve performance
if (empty(Config::getInstance()->Tracker['action_sitesearch_record_url'])) {
@@ -631,8 +600,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
foreach ($loadedActionIds as $loadedActionId) {
list($name, $type, $actionId) = $loadedActionId;
- if ($type == Piwik_Tracker_Action::TYPE_ACTION_NAME
- || $type == Piwik_Tracker_Action::TYPE_SITE_SEARCH
+ if ($type == Tracker\Action::TYPE_ACTION_NAME
+ || $type == Tracker\Action::TYPE_SITE_SEARCH
) {
$this->idActionName = $actionId;
} else {
@@ -655,13 +624,12 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
{
$this->loadIdActionNameAndUrl();
- $idActionName = in_array($this->getActionType(), array(Piwik_Tracker_Action::TYPE_ACTION_NAME,
- Piwik_Tracker_Action::TYPE_ACTION_URL,
- Piwik_Tracker_Action::TYPE_SITE_SEARCH))
+ $idActionName = in_array($this->getActionType(), array(Tracker\Action::TYPE_ACTION_NAME,
+ Tracker\Action::TYPE_ACTION_URL,
+ Tracker\Action::TYPE_SITE_SEARCH))
? (int)$this->getIdActionName()
: null;
-
$insert = array(
'idvisit' => $idVisit,
'idsite' => $this->request->getIdSite(),
@@ -725,7 +693,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
Common::printDebug("WARNING: Overwriting existing Custom Variable in slot " . self::CVAR_INDEX_SEARCH_CATEGORY . " for this page view");
}
$customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_CATEGORY] = self::CVAR_KEY_SEARCH_CATEGORY;
- $customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_CATEGORY] = Piwik_Tracker_Request::truncateCustomVariable($this->searchCategory);
+ $customVariables['custom_var_v' . self::CVAR_INDEX_SEARCH_CATEGORY] = Request::truncateCustomVariable($this->searchCategory);
}
if ($this->searchCount !== false) {
if (!empty($customVariables['custom_var_k' . self::CVAR_INDEX_SEARCH_COUNT])) {
@@ -832,7 +800,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
protected function detectSiteSearch($originalUrl)
{
- $website = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->request->getIdSite());
+ $website = Cache::getCacheWebsiteAttributes($this->request->getIdSite());
if (empty($website['sitesearch'])) {
Common::printDebug("Internal 'Site Search' tracking is not enabled for this site. ");
return false;
@@ -842,7 +810,6 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
$originalUrl = self::cleanupUrl($originalUrl);
-
// Detect Site search from Tracking API parameters rather than URL
$searchKwd = $this->request->getParam('search');
if (!empty($searchKwd)) {
@@ -903,7 +870,6 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
return is_numeric($count) && $count >= 0;
}
-
protected function setActionSearchMetadata($category, $count)
{
if (!empty($category)) {
@@ -992,7 +958,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
{
$generationTime = $this->request->getParam('gt_ms');
if ($generationTime > 0
- && $generationTime < self::GENERATION_TIME_MS_MAXIMUM) {
+ && $generationTime < self::GENERATION_TIME_MS_MAXIMUM
+ ) {
$this->timeGeneration = (int)$generationTime;
}
}
@@ -1020,8 +987,8 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
* charset of the page viewed and we can sometimes work around invalid data
* being stored.
*
- * @param array $queryParameters Name/value mapping of query parameters.
- * @param bool|string $encoding of the HTML page the URL is for. Used to workaround
+ * @param array $queryParameters Name/value mapping of query parameters.
+ * @param bool|string $encoding of the HTML page the URL is for. Used to workaround
* browser bugs & mis-coded webapps. See #3450.
*
* @return array
@@ -1062,3 +1029,39 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
return $value;
}
}
+
+
+/**
+ * Interface of the Action object.
+ * New Action classes can be defined in plugins and used instead of the default one.
+ *
+ * @package Piwik
+ * @subpackage Tracker
+ */
+interface ActionInterface
+{
+ const TYPE_ACTION_URL = 1;
+ const TYPE_OUTLINK = 2;
+ const TYPE_DOWNLOAD = 3;
+ const TYPE_ACTION_NAME = 4;
+ const TYPE_ECOMMERCE_ITEM_SKU = 5;
+ const TYPE_ECOMMERCE_ITEM_NAME = 6;
+ const TYPE_ECOMMERCE_ITEM_CATEGORY = 7;
+ const TYPE_SITE_SEARCH = 8;
+
+ public function __construct(Request $request);
+
+ public function getActionUrl();
+
+ public function getActionName();
+
+ public function getActionType();
+
+ public function record($idVisit, $visitorIdCookie, $idRefererActionUrl, $idRefererActionName, $timeSpentRefererAction);
+
+ public function getIdActionUrl();
+
+ public function getIdActionName();
+
+ public function getIdLinkVisitAction();
+} \ No newline at end of file
diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php
index b65cbc37bd..1e6423d8f6 100644
--- a/core/Tracker/Cache.php
+++ b/core/Tracker/Cache.php
@@ -8,11 +8,14 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker;
+
use Piwik\ArchiveProcessor\Rules;
use Piwik\Config;
use Piwik\Piwik;
use Piwik\CacheFile;
use Piwik\Tracker;
+use Piwik_UserCountry_LocationProvider;
/**
* Simple cache mechanism used in Tracker to avoid requesting settings from mysql on every request
@@ -20,7 +23,7 @@ use Piwik\Tracker;
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Cache
+class Cache
{
/**
* Public for tests only
@@ -51,7 +54,7 @@ class Piwik_Tracker_Cache
if (($cacheContent = $cache->get($idSite)) !== false) {
return $cacheContent;
}
-
+
Tracker::initCorePiwikInTrackerMode();
// save current user privilege and temporarily assume super user privilege
@@ -99,9 +102,9 @@ class Piwik_Tracker_Cache
Tracker::initCorePiwikInTrackerMode();
$cacheContent = array(
- 'isBrowserTriggerEnabled' => Rules::isBrowserTriggerEnabled(),
- 'lastTrackerCronRun' => Piwik_GetOption('lastTrackerCronRun'),
- 'currentLocationProviderId' => Piwik_UserCountry_LocationProvider::getCurrentProviderId(),
+ 'isBrowserTriggerEnabled' => Rules::isBrowserTriggerEnabled(),
+ 'lastTrackerCronRun' => Piwik_GetOption('lastTrackerCronRun'),
+ 'currentLocationProviderId' => Piwik_UserCountry_LocationProvider::getCurrentProviderId(),
);
self::setCacheGeneral($cacheContent);
return $cacheContent;
@@ -155,5 +158,4 @@ class Piwik_Tracker_Cache
{
self::getInstance()->deleteAll();
}
-
}
diff --git a/core/Tracker/Config.php b/core/Tracker/Config.php
deleted file mode 100644
index e3e35fd7e0..0000000000
--- a/core/Tracker/Config.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- * @category Piwik
- * @package Piwik
- */
-use Piwik\Config;
-
-/**
- * Backward compatibility layer
- * DO NOT USE
- *
- * Use this notation to fetch a config file value:
- * Piwik_Config::getInstance()->General['enable_browser_archiving_triggering']
- *
- * @todo remove this in 2.0
- * @since 1.7
- * @deprecated 1.7
- *
- * @package Piwik
- * @subpackage Piwik_Tracker_Config
- */
-class Piwik_Tracker_Config
-{
- /**
- * Returns the singleton Piwik_Config
- *
- * @return Config
- */
- static public function getInstance()
- {
- return Config::getInstance();
- }
-}
diff --git a/core/Tracker/Db.php b/core/Tracker/Db.php
index f917f3ed61..bfb92f34b5 100644
--- a/core/Tracker/Db.php
+++ b/core/Tracker/Db.php
@@ -8,8 +8,13 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker;
+
+use Exception;
+use PDOStatement;
use Piwik\Common;
use Piwik\Timer;
+use Piwik\Tracker\Db\DbException;
/**
* Simple database wrapper.
@@ -19,7 +24,7 @@ use Piwik\Timer;
* @package Piwik
* @subpackage Tracker
*/
-abstract class Piwik_Tracker_Db
+abstract class Db
{
protected static $profiling = false;
@@ -101,7 +106,7 @@ abstract class Piwik_Tracker_Db
$queryProfiling = "INSERT INTO " . Common::prefixTable('log_profiling') . "
(query,count,sum_time_ms) VALUES (?,$count,$time)
- ON DUPLICATE KEY
+ ON DUPLICATE KEY
UPDATE count=count+$count,sum_time_ms=sum_time_ms+$time";
$this->query($queryProfiling, array($query));
}
@@ -113,7 +118,7 @@ abstract class Piwik_Tracker_Db
/**
* Connects to the DB
*
- * @throws Piwik_Tracker_Db_Exception if there was an error connecting the DB
+ * @throws \Piwik\Tracker\Db\DbException if there was an error connecting the DB
*/
abstract public function connect();
@@ -131,7 +136,7 @@ abstract class Piwik_Tracker_Db
* @param string $query Query
* @param array $parameters Parameters to bind
* @see query()
- * @throws Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws \Piwik\Tracker\Db\DbException if an exception occurred
*/
abstract public function fetchAll($query, $parameters = array());
@@ -142,7 +147,7 @@ abstract class Piwik_Tracker_Db
* @param array $parameters Parameters to bind
* @see also query()
*
- * @throws Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws DbException if an exception occurred
*/
abstract public function fetch($query, $parameters = array());
@@ -201,7 +206,7 @@ abstract class Piwik_Tracker_Db
* @param array $parameters Parameters to bind array('idsite'=> 1)
*
* @return PDOStatement or false if failed
- * @throws Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws DbException if an exception occurred
*/
abstract public function query($query, $parameters = array());
diff --git a/core/Tracker/Db/Exception.php b/core/Tracker/Db/DbException.php
index 2368503790..620a461b70 100644
--- a/core/Tracker/Db/Exception.php
+++ b/core/Tracker/Db/DbException.php
@@ -9,12 +9,16 @@
* @package Piwik
*/
+namespace Piwik\Tracker\Db;
+
+use Exception;
+
/**
* Database Exception
*
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Db_Exception extends Exception
+class DbException extends Exception
{
}
diff --git a/core/Tracker/Db/Mysqli.php b/core/Tracker/Db/Mysqli.php
index 12ed3ed725..0fe9e4e7a1 100644
--- a/core/Tracker/Db/Mysqli.php
+++ b/core/Tracker/Db/Mysqli.php
@@ -8,6 +8,11 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker\Db;
+
+use Exception;
+use Piwik\Tracker\Db;
+use Piwik\Tracker\Db\DbException;
/**
* mysqli wrapper
@@ -15,7 +20,7 @@
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
+class Mysqli extends Db
{
protected $connection = null;
protected $host;
@@ -64,7 +69,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
/**
* Connects to the DB
*
- * @throws Exception|Piwik_Tracker_Db_Exception if there was an error connecting the DB
+ * @throws Exception|DbException if there was an error connecting the DB
*/
public function connect()
{
@@ -74,11 +79,11 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
$this->connection = mysqli_connect($this->host, $this->username, $this->password, $this->dbname, $this->port, $this->socket);
if (!$this->connection || mysqli_connect_errno()) {
- throw new Piwik_Tracker_Db_Exception("Connect failed: " . mysqli_connect_error());
+ throw new DbException("Connect failed: " . mysqli_connect_error());
}
if ($this->charset && !mysqli_set_charset($this->connection, $this->charset)) {
- throw new Piwik_Tracker_Db_Exception("Set Charset failed: " . mysqli_error($this->connection));
+ throw new DbException("Set Charset failed: " . mysqli_error($this->connection));
}
$this->password = '';
@@ -105,7 +110,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
* @param string $query Query
* @param array $parameters Parameters to bind
* @return array
- * @throws Exception|Piwik_Tracker_Db_Exception if an exception occured
+ * @throws Exception|DbException if an exception occured
*/
public function fetchAll($query, $parameters = array())
{
@@ -118,7 +123,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
$query = $this->prepare($query, $parameters);
$rs = mysqli_query($this->connection, $query);
if (is_bool($rs)) {
- throw new Piwik_Tracker_Db_Exception('fetchAll() failed: ' . mysqli_error($this->connection) . ' : ' . $query);
+ throw new DbException('fetchAll() failed: ' . mysqli_error($this->connection) . ' : ' . $query);
}
while ($row = mysqli_fetch_array($rs, MYSQLI_ASSOC)) {
@@ -131,7 +136,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
}
return $rows;
} catch (Exception $e) {
- throw new Piwik_Tracker_Db_Exception("Error query: " . $e->getMessage());
+ throw new DbException("Error query: " . $e->getMessage());
}
}
@@ -145,7 +150,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
*
* @return array
*
- * @throws Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws DbException if an exception occurred
*/
public function fetch($query, $parameters = array())
{
@@ -157,7 +162,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
$query = $this->prepare($query, $parameters);
$rs = mysqli_query($this->connection, $query);
if (is_bool($rs)) {
- throw new Piwik_Tracker_Db_Exception('fetch() failed: ' . mysqli_error($this->connection) . ' : ' . $query);
+ throw new DbException('fetch() failed: ' . mysqli_error($this->connection) . ' : ' . $query);
}
$row = mysqli_fetch_array($rs, MYSQLI_ASSOC);
@@ -168,7 +173,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
}
return $row;
} catch (Exception $e) {
- throw new Piwik_Tracker_Db_Exception("Error query: " . $e->getMessage());
+ throw new DbException("Error query: " . $e->getMessage());
}
}
@@ -179,7 +184,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
* @param array|string $parameters Parameters to bind array('idsite'=> 1)
*
* @return bool|resource false if failed
- * @throws Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws DbException if an exception occurred
*/
public function query($query, $parameters = array())
{
@@ -203,7 +208,7 @@ class Piwik_Tracker_Db_Mysqli extends Piwik_Tracker_Db
}
return $result;
} catch (Exception $e) {
- throw new Piwik_Tracker_Db_Exception("Error query: " . $e->getMessage() . "
+ throw new DbException("Error query: " . $e->getMessage() . "
In query: $query
Parameters: " . var_export($parameters, true));
}
diff --git a/core/Tracker/Db/Pdo/Mysql.php b/core/Tracker/Db/Pdo/Mysql.php
index de201fd511..da77824aab 100644
--- a/core/Tracker/Db/Pdo/Mysql.php
+++ b/core/Tracker/Db/Pdo/Mysql.php
@@ -8,6 +8,14 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker\Db\Pdo;
+
+use Exception;
+use PDO;
+use PDOException;
+use PDOStatement;
+use Piwik\Tracker\Db;
+use Piwik\Tracker\Db\DbException;
/**
* PDO MySQL wrapper
@@ -15,7 +23,7 @@
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
+class Mysql extends Db
{
protected $connection = null;
protected $dsn;
@@ -96,7 +104,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
* @param array $parameters Parameters to bind
* @return array|bool
* @see query()
- * @throws Exception|Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws Exception|DbException if an exception occurred
*/
public function fetchAll($query, $parameters = array())
{
@@ -107,7 +115,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
}
return $sth->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
- throw new Piwik_Tracker_Db_Exception("Error query: " . $e->getMessage());
+ throw new DbException("Error query: " . $e->getMessage());
}
}
@@ -118,7 +126,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
* @param array $parameters Parameters to bind
* @return bool|mixed
* @see query()
- * @throws Exception|Piwik_Tracker_Db_Exception if an exception occurred
+ * @throws Exception|DbException if an exception occurred
*/
public function fetch($query, $parameters = array())
{
@@ -129,7 +137,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
}
return $sth->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
- throw new Piwik_Tracker_Db_Exception("Error query: " . $e->getMessage());
+ throw new DbException("Error query: " . $e->getMessage());
}
}
@@ -139,7 +147,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
* @param string $query Query
* @param array|string $parameters Parameters to bind array('idsite'=> 1)
* @return PDOStatement|bool PDOStatement or false if failed
- * @throws Piwik_Tracker_Db_Exception if an exception occured
+ * @throws DbException if an exception occured
*/
public function query($query, $parameters = array())
{
@@ -163,7 +171,7 @@ class Piwik_Tracker_Db_Pdo_Mysql extends Piwik_Tracker_Db
}
return $sth;
} catch (PDOException $e) {
- throw new Piwik_Tracker_Db_Exception("Error query: " . $e->getMessage() . "
+ throw new DbException("Error query: " . $e->getMessage() . "
In query: $query
Parameters: " . var_export($parameters, true));
}
diff --git a/core/Tracker/Db/Pdo/Pgsql.php b/core/Tracker/Db/Pdo/Pgsql.php
index 52e04e27f4..ef43742d4c 100644
--- a/core/Tracker/Db/Pdo/Pgsql.php
+++ b/core/Tracker/Db/Pdo/Pgsql.php
@@ -9,13 +9,19 @@
* @package Piwik
*/
+namespace Piwik\Tracker\Db\Pdo;
+
+use Exception;
+use PDO;
+use Piwik\Tracker\Db\Pdo\Mysql;
+
/**
* PDO PostgreSQL wrapper
*
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Db_Pdo_Pgsql extends Piwik_Tracker_Db_Pdo_Mysql
+class Pgsql extends Mysql
{
/**
* Builds the DB object
@@ -39,7 +45,6 @@ class Piwik_Tracker_Db_Pdo_Pgsql extends Piwik_Tracker_Db_Pdo_Mysql
$timer = $this->initProfiler();
}
-
$this->connection = new PDO($this->dsn, $this->username, $this->password, $config = array());
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// we may want to setAttribute(PDO::ATTR_TIMEOUT ) to a few seconds (default is 60) in case the DB is locked
diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php
index 88e5057c09..aa87b58b91 100644
--- a/core/Tracker/GoalManager.php
+++ b/core/Tracker/GoalManager.php
@@ -8,15 +8,23 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker;
+
+use Exception;
use Piwik\Config;
use Piwik\Common;
use Piwik\Tracker;
+use Piwik\Tracker\Action;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\Referrer;
+use Piwik\Tracker\Request;
+use false;
/**
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_GoalManager
+class GoalManager
{
// log_visit.visit_goal_buyer
const TYPE_BUYER_NONE = 0;
@@ -39,18 +47,18 @@ class Piwik_Tracker_GoalManager
public $isGoalAnOrder;
/**
- * @var Piwik_Tracker_Action
+ * @var Action
*/
protected $action = null;
protected $convertedGoals = array();
protected $isThereExistingCartInVisit = false;
/**
- * @var Piwik_Tracker_Request
+ * @var Request
*/
protected $request;
protected $orderId;
- public function __construct(Piwik_Tracker_Request $request)
+ public function __construct(Request $request)
{
$this->request = $request;
$this->init();
@@ -64,12 +72,12 @@ class Piwik_Tracker_GoalManager
$this->requestIsEcommerce = ($this->idGoal == 0);
}
- function getBuyerType($existingType = Piwik_Tracker_GoalManager::TYPE_BUYER_NONE)
+ function getBuyerType($existingType = GoalManager::TYPE_BUYER_NONE)
{
// Was there a Cart for this visit prior to the order?
$this->isThereExistingCartInVisit = in_array($existingType,
- array(Piwik_Tracker_GoalManager::TYPE_BUYER_OPEN_CART,
- Piwik_Tracker_GoalManager::TYPE_BUYER_ORDERED_AND_OPEN_CART));
+ array(GoalManager::TYPE_BUYER_OPEN_CART,
+ GoalManager::TYPE_BUYER_ORDERED_AND_OPEN_CART));
if (!$this->requestIsEcommerce) {
return $existingType;
@@ -88,7 +96,7 @@ class Piwik_Tracker_GoalManager
static public function getGoalDefinitions($idSite)
{
- $websiteAttributes = Piwik_Tracker_Cache::getCacheWebsiteAttributes($idSite);
+ $websiteAttributes = Cache::getCacheWebsiteAttributes($idSite);
if (isset($websiteAttributes['goals'])) {
return $websiteAttributes['goals'];
}
@@ -120,7 +128,7 @@ class Piwik_Tracker_GoalManager
* Look at the URL or Page Title and sees if it matches any existing Goal definition
*
* @param int $idSite
- * @param Piwik_Tracker_Action $action
+ * @param Action $action
* @throws Exception
* @return int Number of goals matched
*/
@@ -136,9 +144,9 @@ class Piwik_Tracker_GoalManager
foreach ($goals as $goal) {
$attribute = $goal['match_attribute'];
// if the attribute to match is not the type of the current action
- if (($actionType == Piwik_Tracker_Action::TYPE_ACTION_URL && $attribute != 'url' && $attribute != 'title')
- || ($actionType == Piwik_Tracker_Action::TYPE_DOWNLOAD && $attribute != 'file')
- || ($actionType == Piwik_Tracker_Action::TYPE_OUTLINK && $attribute != 'external_website')
+ if (($actionType == Action::TYPE_ACTION_URL && $attribute != 'url' && $attribute != 'title')
+ || ($actionType == Action::TYPE_DOWNLOAD && $attribute != 'file')
+ || ($actionType == Action::TYPE_OUTLINK && $attribute != 'external_website')
|| ($attribute == 'manually')
) {
continue;
@@ -205,8 +213,8 @@ class Piwik_Tracker_GoalManager
$goal = $goals[$this->idGoal];
$url = $this->request->getParam('url');
- $goal['url'] = Piwik_Tracker_Action::excludeQueryParametersFromUrl($url, $idSite);
- $goal['revenue'] = $this->getRevenue( $this->request->getGoalRevenue($goal['revenue']));
+ $goal['url'] = Action::excludeQueryParametersFromUrl($url, $idSite);
+ $goal['revenue'] = $this->getRevenue($this->request->getGoalRevenue($goal['revenue']));
$this->convertedGoals[] = $goal;
return true;
}
@@ -214,9 +222,9 @@ class Piwik_Tracker_GoalManager
/**
* Records one or several goals matched in this request.
*
- * @param int $idSite
- * @param array $visitorInformation
- * @param array $visitCustomVariables
+ * @param int $idSite
+ * @param array $visitorInformation
+ * @param array $visitCustomVariables
* @param string $action
*/
public function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action)
@@ -298,10 +306,10 @@ class Piwik_Tracker_GoalManager
$time = $refererTimestamp;
} // 2) Referrer URL parsing
elseif (!empty($refererUrl)) {
- $referrer = new Piwik_Tracker_Referer();
+ $referrer = new Referrer();
$referrer = $referrer->getRefererInformation($refererUrl, $currentUrl = '', $idSite);
- // if the parsed referer is interesting enough, ie. website or search engine
+ // if the parsed referer is interesting enough, ie. website or search engine
if (in_array($referrer['referer_type'], array(Common::REFERER_TYPE_SEARCH_ENGINE, Common::REFERER_TYPE_WEBSITE))) {
$type = $referrer['referer_type'];
$name = $referrer['referer_name'];
@@ -363,7 +371,7 @@ class Piwik_Tracker_GoalManager
$goal['idgoal'] = self::IDGOAL_ORDER;
$goal['idorder'] = $this->orderId;
$goal['buster'] = $orderIdNumeric;
- $goal['revenue_subtotal'] = $this->getRevenue( $this->request->getParam('ec_st'));
+ $goal['revenue_subtotal'] = $this->getRevenue($this->request->getParam('ec_st'));
$goal['revenue_tax'] = $this->getRevenue($this->request->getParam('ec_tx'));
$goal['revenue_shipping'] = $this->getRevenue($this->request->getParam('ec_sh'));
$goal['revenue_discount'] = $this->getRevenue($this->request->getParam('ec_dt'));
@@ -375,7 +383,7 @@ class Piwik_Tracker_GoalManager
$goal['idgoal'] = self::IDGOAL_CART;
$debugMessage = 'The conversion is an Ecommerce Cart Update';
}
- $goal['revenue'] = $this->getRevenue($this->request->getGoalRevenue( $defaultRevenue = 0));
+ $goal['revenue'] = $this->getRevenue($this->request->getGoalRevenue($defaultRevenue = 0));
Common::printDebug($debugMessage . ':' . var_export($goal, true));
@@ -590,12 +598,12 @@ class Piwik_Tracker_GoalManager
foreach ($cleanedItems as $item) {
$actionsToLookup = array();
list($sku, $name, $category, $price, $quantity) = $item;
- $actionsToLookup[] = array(trim($sku), Piwik_Tracker_Action::TYPE_ECOMMERCE_ITEM_SKU);
- $actionsToLookup[] = array(trim($name), Piwik_Tracker_Action::TYPE_ECOMMERCE_ITEM_NAME);
+ $actionsToLookup[] = array(trim($sku), Action::TYPE_ECOMMERCE_ITEM_SKU);
+ $actionsToLookup[] = array(trim($name), Action::TYPE_ECOMMERCE_ITEM_NAME);
// Only one category
if (!is_array($category)) {
- $actionsToLookup[] = array(trim($category), Piwik_Tracker_Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
+ $actionsToLookup[] = array(trim($category), Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
} // Multiple categories
else {
$countCategories = 0;
@@ -608,17 +616,17 @@ class Piwik_Tracker_GoalManager
if ($countCategories > self::MAXIMUM_PRODUCT_CATEGORIES) {
break;
}
- $actionsToLookup[] = array($productCategory, Piwik_Tracker_Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
+ $actionsToLookup[] = array($productCategory, Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
}
}
// Ensure that each row has the same number of columns, fill in the blanks
for ($i = count($actionsToLookup); $i < $columnsInEachRow; $i++) {
- $actionsToLookup[] = array(false, Piwik_Tracker_Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
+ $actionsToLookup[] = array(false, Action::TYPE_ECOMMERCE_ITEM_CATEGORY);
}
$actionsToLookupAllItems = array_merge($actionsToLookupAllItems, $actionsToLookup);
}
- $actionsLookedUp = Piwik_Tracker_Action::loadActionId($actionsToLookupAllItems);
+ $actionsLookedUp = Action::loadActionId($actionsToLookupAllItems);
// Replace SKU, name & category by their ID action
foreach ($cleanedItems as $index => &$item) {
@@ -640,8 +648,8 @@ class Piwik_Tracker_GoalManager
* Updates the cart items in the DB
* that have been modified since the last cart update
*
- * @param array $goal
- * @param array $itemsToUpdate
+ * @param array $goal
+ * @param array $itemsToUpdate
*
* @return void
*/
@@ -664,7 +672,7 @@ class Piwik_Tracker_GoalManager
$sql = 'UPDATE ' . Common::prefixTable('log_conversion_item') . "
SET " . implode($updateParts, ', ') . "
WHERE idvisit = ?
- AND idorder = ?
+ AND idorder = ?
AND idaction_sku = ?";
$sqlBind[] = $newRow['idvisit'];
$sqlBind[] = $item['idorder_original_value'];
@@ -691,8 +699,8 @@ class Piwik_Tracker_GoalManager
Common::printDebug($itemsToInsert);
$sql = "INSERT INTO " . Common::prefixTable('log_conversion_item') . "
- (idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted,
- idorder, idsite, idvisitor, server_time, idvisit)
+ (idaction_sku, idaction_name, idaction_category, idaction_category2, idaction_category3, idaction_category4, idaction_category5, price, quantity, deleted,
+ idorder, idsite, idvisitor, server_time, idvisit)
VALUES ";
$i = 0;
$bind = array();
@@ -736,7 +744,7 @@ class Piwik_Tracker_GoalManager
* Records a standard non-Ecommerce goal in the DB (URL/Title matching),
* linking the conversion to the action that triggered it
* @param $goal
- * @param Piwik_Tracker_Action $action
+ * @param Action $action
* @param $visitorInformation
*/
protected function recordStandardGoals($goal, $action, $visitorInformation)
diff --git a/core/Tracker/IgnoreCookie.php b/core/Tracker/IgnoreCookie.php
index 38f1b96f66..6fcbfcf796 100644
--- a/core/Tracker/IgnoreCookie.php
+++ b/core/Tracker/IgnoreCookie.php
@@ -8,6 +8,8 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker;
+
use Piwik\Config;
use Piwik\Cookie;
@@ -17,7 +19,7 @@ use Piwik\Cookie;
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_IgnoreCookie
+class IgnoreCookie
{
/**
* Get tracking cookie
diff --git a/core/Tracker/Referer.php b/core/Tracker/Referrer.php
index 5b9765ecea..c288e0fbeb 100644
--- a/core/Tracker/Referer.php
+++ b/core/Tracker/Referrer.php
@@ -8,13 +8,16 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker;
+
use Piwik\Common;
+use Piwik\Tracker\Action;
/**
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Referer
+class Referrer
{
// @see detect*() referer methods
protected $typeRefererAnalyzed;
@@ -29,7 +32,6 @@ class Piwik_Tracker_Referer
// Used to prefix when a adsense referer is detected
const LABEL_PREFIX_ADSENSE_KEYWORD = '(adsense) ';
-
/**
* Returns an array containing the following information:
* - referer_type
@@ -71,7 +73,7 @@ class Piwik_Tracker_Referer
$refererUrl = '';
}
- $currentUrl = Piwik_Tracker_Action::cleanupUrl($currentUrl);
+ $currentUrl = Action::cleanupUrl($currentUrl);
$this->refererUrl = $refererUrl;
$this->refererUrlParse = @parse_url($this->refererUrl);
@@ -162,13 +164,13 @@ class Piwik_Tracker_Referer
// if the campaign keyword is empty, try to get a keyword from the referrer URL
if (empty($this->keywordRefererAnalyzed)) {
- // Set the Campaign keyword to the keyword found in the Referer URL if any
+ // Set the Campaign keyword to the keyword found in the Referrer URL if any
$referrerUrlInfo = Common::extractSearchEngineInformationFromUrl($this->refererUrl);
if (!empty($referrerUrlInfo['keywords'])) {
$this->keywordRefererAnalyzed = $referrerUrlInfo['keywords'];
}
- // Set the keyword, to the hostname found, in a Adsense Referer URL '&url=' parameter
+ // Set the keyword, to the hostname found, in a Adsense Referrer URL '&url=' parameter
if (empty($this->keywordRefererAnalyzed)
&& !empty($this->refererUrlParse['query'])
&& !empty($this->refererHost)
@@ -245,7 +247,7 @@ class Piwik_Tracker_Referer
return true;
}
}
- if (Piwik_Tracker_Visit::isHostKnownAliasHost($this->refererHost, $this->idsite)) {
+ if (Visit::isHostKnownAliasHost($this->refererHost, $this->idsite)) {
$this->typeRefererAnalyzed = Common::REFERER_TYPE_DIRECT_ENTRY;
return true;
}
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index bf878bb106..668d23fa1e 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -1,9 +1,14 @@
<?php
+namespace Piwik\Tracker;
+
+use Exception;
use Piwik\Config;
use Piwik\Common;
use Piwik\Cookie;
use Piwik\IP;
use Piwik\Tracker;
+use Piwik\Tracker\Cache;
+use Piwik_UserCountry_LocationProvider;
/**
* Piwik - Open source web analytics
@@ -15,7 +20,7 @@ use Piwik\Tracker;
* @package Piwik
*/
-class Piwik_Tracker_Request
+class Request
{
/**
* @var array
@@ -24,7 +29,7 @@ class Piwik_Tracker_Request
public function __construct($params, $tokenAuth = false)
{
- if(!is_array($params)) {
+ if (!is_array($params)) {
$params = array();
}
$this->params = $params;
@@ -32,13 +37,13 @@ class Piwik_Tracker_Request
$this->enforcedIp = false;
// When the 'url' and referer url parameter are not given, we might be in the 'Simple Image Tracker' mode.
- // The URL can default to the Referer, which will be in this case
+ // The URL can default to the Referrer, which will be in this case
// the URL of the page containing the Simple Image beacon
if (empty($this->params['urlref'])
&& empty($this->params['url'])
) {
$url = @$_SERVER['HTTP_REFERER'];
- if(!empty($url)) {
+ if (!empty($url)) {
$this->params['url'] = $url;
}
}
@@ -66,7 +71,7 @@ class Piwik_Tracker_Request
try {
$idSite = $this->getIdSite();
$this->isAuthenticated = $this->authenticateSuperUserOrAdmin($tokenAuth, $idSite);
- } catch(Exception $e) {
+ } catch (Exception $e) {
$this->isAuthenticated = false;
}
if (!$this->isAuthenticated) {
@@ -94,7 +99,7 @@ class Piwik_Tracker_Request
if (!empty($idSite)
&& $idSite > 0
) {
- $website = Piwik_Tracker_Cache::getCacheWebsiteAttributes($idSite);
+ $website = Cache::getCacheWebsiteAttributes($idSite);
$adminTokenAuth = $website['admin_token_auth'];
if (in_array($tokenAuth, $adminTokenAuth)) {
return true;
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index 97e398b0f2..3590b4c319 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -8,21 +8,33 @@
* @category Piwik
* @package Piwik
*/
-use Piwik\Config;
-use Piwik\Common;
-use Piwik\IP;
-use Piwik\Tracker;
+namespace Piwik\Tracker;
/**
* @package Piwik
* @subpackage Tracker
*/
-interface Piwik_Tracker_Visit_Interface
+interface VisitInterface
{
- function setRequest(Piwik_Tracker_Request $request);
+ function setRequest(Request $request);
+
function handle();
}
+use Piwik\Config;
+use Piwik\Common;
+use Piwik\IP;
+use Piwik\Tracker;
+use Piwik\Tracker\Action;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\GoalManager;
+use Piwik\Tracker\Request;
+use Piwik\Tracker\Referrer;
+use Exception;
+use Piwik\Tracker\VisitExcluded;
+use Piwik_UserCountry_LocationProvider;
+use UserAgentParser;
+
/**
* Class used to handle a Visit.
* A visit is either NEW or KNOWN.
@@ -37,17 +49,17 @@ interface Piwik_Tracker_Visit_Interface
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
+class Visit implements Tracker\VisitInterface
{
const UNKNOWN_CODE = 'xx';
/**
- * @var Piwik_Tracker_GoalManager
+ * @var GoalManager
*/
protected $goalManager;
/**
- * @var Piwik_Tracker_Request
+ * @var Request
*/
protected $request;
@@ -56,7 +68,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
protected $visitorCustomVariables = array();
protected $visitorKnown;
- function setRequest(Piwik_Tracker_Request $request)
+ function setRequest(Request $request)
{
$this->request = $request;
}
@@ -87,7 +99,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$ip = $this->request->getIp();
$this->visitorInfo['location_ip'] = $ip;
- $excluded = new Piwik_Tracker_VisitExcluded($this->request, $ip);
+ $excluded = new VisitExcluded($this->request, $ip);
if ($excluded->isExcluded()) {
return;
}
@@ -101,7 +113,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
Common::printDebug($this->visitorCustomVariables);
}
- $this->goalManager = new Piwik_Tracker_GoalManager($this->request);
+ $this->goalManager = new GoalManager($this->request);
$visitIsConverted = false;
$idActionUrl = $idActionName = $actionType = false;
@@ -134,10 +146,10 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
Common::printDebug("INFO: The outlink URL host is one of the known host for this website. ");
}
if (isset($GLOBALS['PIWIK_TRACKER_DEBUG']) && $GLOBALS['PIWIK_TRACKER_DEBUG']) {
- $type = Piwik_Tracker_Action::getActionTypeName($action->getActionType());
+ $type = Action::getActionTypeName($action->getActionType());
Common::printDebug("Action is a $type,
- Action name = " . $action->getActionName() . ",
- Action URL = " . $action->getActionUrl());
+ Action name = " . $action->getActionName() . ",
+ Action URL = " . $action->getActionUrl());
}
$someGoalsConverted = $this->goalManager->detectGoalsMatchingUrl($this->request->getIdSite(), $action);
$visitIsConverted = $someGoalsConverted;
@@ -181,7 +193,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$this->visitorInfo['time_spent_ref_action']
);
}
- } catch (Piwik_Tracker_Visit_VisitorNotFoundInDatabase $e) {
+ } catch (VisitorNotFoundInDatabase $e) {
// There is an edge case when:
// - two manual goal conversions happen in the same second
@@ -247,7 +259,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
* @param $idActionName
* @param $actionType
* @param $visitIsConverted
- * @throws Piwik_Tracker_Visit_VisitorNotFoundInDatabase
+ * @throws VisitorNotFoundInDatabase
*/
protected function handleKnownVisit($idActionUrl, $idActionName, $actionType, $visitIsConverted)
{
@@ -263,7 +275,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$valuesToUpdate['visit_exit_idaction_url'] = $idActionUrl;
$incrementActions = true;
}
- if ($actionType == Piwik_Tracker_Action::TYPE_SITE_SEARCH) {
+ if ($actionType == Action::TYPE_SITE_SEARCH) {
$sqlActionUpdate .= "visit_total_searches = visit_total_searches + 1, ";
$incrementActions = true;
}
@@ -321,9 +333,9 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$sqlBind[] = $value;
}
$sqlQuery = "UPDATE " . Common::prefixTable('log_visit') . "
- SET $sqlActionUpdate " . implode($updateParts, ', ') . "
- WHERE idsite = ?
- AND idvisit = ?";
+ SET $sqlActionUpdate " . implode($updateParts, ', ') . "
+ WHERE idsite = ?
+ AND idvisit = ?";
array_push($sqlBind, $this->request->getIdSite(), (int)$this->visitorInfo['idvisit']);
$result = Tracker::getDatabase()->query($sqlQuery, $sqlBind);
@@ -340,7 +352,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
Common::printDebug("Visitor with this idvisit wasn't found in the DB.");
Common::printDebug("$sqlQuery --- ");
Common::printDebug($sqlBind);
- throw new Piwik_Tracker_Visit_VisitorNotFoundInDatabase(
+ throw new VisitorNotFoundInDatabase(
"The visitor with idvisitor=" . bin2hex($this->visitorInfo['idvisitor']) . " and idvisit=" . $this->visitorInfo['idvisit']
. " wasn't found in the DB, we fallback to a new visitor");
}
@@ -384,7 +396,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$daysSinceLastOrder = $this->request->getDaysSinceLastOrder();
$isReturningCustomer = ($daysSinceLastOrder !== false);
- if($daysSinceLastOrder === false) {
+ if ($daysSinceLastOrder === false) {
$daysSinceLastOrder = 0;
}
@@ -392,7 +404,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$userInfo = $this->getUserSettingsInformation();
// Referrer data
- $referrer = new Piwik_Tracker_Referer();
+ $referrer = new Referrer();
$refererUrl = $this->request->getParam('urlref');
$currentUrl = $this->request->getParam('url');
$refererInfo = $referrer->getRefererInformation($refererUrl, $currentUrl, $this->request->getIdSite());
@@ -423,12 +435,12 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
'visit_exit_idaction_url' => (int)$idActionUrl,
'visit_exit_idaction_name' => (int)$idActionName,
'visit_total_actions' => in_array($actionType,
- array(Piwik_Tracker_Action::TYPE_ACTION_URL,
- Piwik_Tracker_Action::TYPE_DOWNLOAD,
- Piwik_Tracker_Action::TYPE_OUTLINK,
- Piwik_Tracker_Action::TYPE_SITE_SEARCH))
+ array(Action::TYPE_ACTION_URL,
+ Action::TYPE_DOWNLOAD,
+ Action::TYPE_OUTLINK,
+ Action::TYPE_SITE_SEARCH))
? 1 : 0, // if visit starts with something else (e.g. ecommerce order), don't record as an action
- 'visit_total_searches' => $actionType == Piwik_Tracker_Action::TYPE_SITE_SEARCH ? 1 : 0,
+ 'visit_total_searches' => $actionType == Action::TYPE_SITE_SEARCH ? 1 : 0,
'visit_total_time' => self::cleanupVisitTotalTime($defaultTimeOnePageVisit),
'visit_goal_converted' => $visitIsConverted ? 1 : 0,
'visit_goal_buyer' => $this->goalManager->getBuyerType(),
@@ -478,7 +490,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
static private function cleanupVisitTotalTime($t)
{
$t = (int)$t;
- if($t < 0) {
+ if ($t < 0) {
$t = 0;
}
$smallintMysqlLimit = 65534;
@@ -654,37 +666,37 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
// No custom var were found in the request, so let's copy the previous one in a potential conversion later
if (!$this->visitorCustomVariables) {
$selectCustomVariables = ',
- custom_var_k1, custom_var_v1,
- custom_var_k2, custom_var_v2,
- custom_var_k3, custom_var_v3,
- custom_var_k4, custom_var_v4,
- custom_var_k5, custom_var_v5';
+ custom_var_k1, custom_var_v1,
+ custom_var_k2, custom_var_v2,
+ custom_var_k3, custom_var_v3,
+ custom_var_k4, custom_var_v4,
+ custom_var_k5, custom_var_v5';
}
$select = "SELECT idvisitor,
- visit_last_action_time,
- visit_first_action_time,
- idvisit,
- visit_exit_idaction_url,
- visit_exit_idaction_name,
- visitor_returning,
- visitor_days_since_first,
- visitor_days_since_order,
- location_country,
- location_region,
- location_city,
- location_latitude,
- location_longitude,
- referer_name,
- referer_keyword,
- referer_type,
- visitor_count_visits,
- visit_goal_buyer
- $selectCustomVariables
- ";
+ visit_last_action_time,
+ visit_first_action_time,
+ idvisit,
+ visit_exit_idaction_url,
+ visit_exit_idaction_name,
+ visitor_returning,
+ visitor_days_since_first,
+ visitor_days_since_order,
+ location_country,
+ location_region,
+ location_city,
+ location_latitude,
+ location_longitude,
+ referer_name,
+ referer_keyword,
+ referer_type,
+ visitor_count_visits,
+ visit_goal_buyer
+ $selectCustomVariables
+ ";
$from = "FROM " . Common::prefixTable('log_visit');
- list($timeLookBack,$timeLookAhead) = $this->getWindowLookupThisVisit();
+ list($timeLookBack, $timeLookAhead) = $this->getWindowLookupThisVisit();
$shouldMatchOneFieldOnly = $this->shouldLookupOneVisitorFieldOnly($isVisitorIdToLookup);
@@ -713,12 +725,11 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
}
$sql = "$select
- $from
- WHERE " . $whereCommon . "
- ORDER BY visit_last_action_time DESC
- LIMIT 1";
- }
- // We have a config_id AND a visitor_id. We match on either of these.
+ $from
+ WHERE " . $whereCommon . "
+ ORDER BY visit_last_action_time DESC
+ LIMIT 1";
+ } // We have a config_id AND a visitor_id. We match on either of these.
// Why do we also match on config_id?
// we do not trust the visitor ID only. Indeed, some browsers, or browser addons,
// cause the visitor id from the 1st party cookie to be different on each page view!
@@ -730,12 +741,12 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$where = ' AND config_id = ?';
$bindSql[] = $configId;
$sqlConfigId = "$select ,
- 0 as priority
- $from
- WHERE $whereCommon $where
- ORDER BY visit_last_action_time DESC
- LIMIT 1
- ";
+ 0 as priority
+ $from
+ WHERE $whereCommon $where
+ ORDER BY visit_last_action_time DESC
+ LIMIT 1
+ ";
// will use INDEX index_idsite_idvisitor (idsite, idvisitor)
$bindSql[] = $timeLookBack;
@@ -744,29 +755,28 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$where = ' AND idvisitor = ?';
$bindSql[] = $this->visitorInfo['idvisitor'];
$sqlVisitorId = "$select ,
- 1 as priority
- $from
- WHERE $whereCommon $where
- ORDER BY visit_last_action_time DESC
- LIMIT 1
- ";
+ 1 as priority
+ $from
+ WHERE $whereCommon $where
+ ORDER BY visit_last_action_time DESC
+ LIMIT 1
+ ";
// We join both queries and favor the one matching the visitor_id if it did match
$sql = " ( $sqlConfigId )
- UNION
- ( $sqlVisitorId )
- ORDER BY priority DESC
- LIMIT 1";
+ UNION
+ ( $sqlVisitorId )
+ ORDER BY priority DESC
+ LIMIT 1";
}
-
$visitRow = Tracker::getDatabase()->fetch($sql, $bindSql);
$isNewVisitForced = $this->request->getParam('new_visit');
$isNewVisitForced = !empty($isNewVisitForced);
$newVisitEnforcedAPI = $isNewVisitForced
- && ($this->request->isAuthenticated()
- || !Config::getInstance()->Tracker['new_visit_api_requires_admin']);
+ && ($this->request->isAuthenticated()
+ || !Config::getInstance()->Tracker['new_visit_api_requires_admin']);
$enforceNewVisit = $newVisitEnforcedAPI || Config::getInstance()->Debug['tracker_always_new_visitor'];
if (!$enforceNewVisit
@@ -793,7 +803,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$this->visitorInfo['location_latitude'] = $visitRow['location_latitude'];
$this->visitorInfo['location_longitude'] = $visitRow['location_longitude'];
- // Referer information will be potentially used for Goal Conversion attribution
+ // Referrer information will be potentially used for Goal Conversion attribution
$this->visitorInfo['referer_name'] = $visitRow['referer_name'];
$this->visitorInfo['referer_keyword'] = $visitRow['referer_keyword'];
$this->visitorInfo['referer_type'] = $visitRow['referer_type'];
@@ -816,11 +826,11 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$this->visitorKnown = true;
Common::printDebug("The visitor is known (idvisitor = " . bin2hex($this->visitorInfo['idvisitor']) . ",
- config_id = " . bin2hex($configId) . ",
- idvisit = {$this->visitorInfo['idvisit']},
- last action = " . date("r", $this->visitorInfo['visit_last_action_time']) . ",
- first action = " . date("r", $this->visitorInfo['visit_first_action_time']) . ",
- visit_goal_buyer' = " . $this->visitorInfo['visit_goal_buyer'] . ")");
+ config_id = " . bin2hex($configId) . ",
+ idvisit = {$this->visitorInfo['idvisit']},
+ last action = " . date("r", $this->visitorInfo['visit_last_action_time']) . ",
+ first action = " . date("r", $this->visitorInfo['visit_first_action_time']) . ",
+ visit_goal_buyer' = " . $this->visitorInfo['visit_goal_buyer'] . ")");
} else {
Common::printDebug("The visitor was not matched with an existing visitor...");
}
@@ -855,7 +865,6 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
return array($timeLookBack, $timeLookAhead);
}
-
protected function shouldLookupOneVisitorFieldOnly($isVisitorIdToLookup)
{
// This setting would be enabled for Intranet websites, to ensure that visitors using all the same computer config, same IP
@@ -963,7 +972,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
* Plugins can return an override Action that for example, does not record the action in the DB
*
* @throws Exception
- * @return Piwik_Tracker_Action child or fake but with same public interface
+ * @return Action child or fake but with same public interface
*/
protected function newAction()
{
@@ -971,9 +980,9 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
Piwik_PostEvent('Tracker.newAction', array(&$action));
if (is_null($action)) {
- $action = new Piwik_Tracker_Action($this->request);
- } elseif (!($action instanceof Piwik_Tracker_Action_Interface)) {
- throw new Exception("The Action object set in the plugin must implement the interface Piwik_Tracker_Action_Interface");
+ $action = new Action($this->request);
+ } elseif (!($action instanceof ActionInterface)) {
+ throw new Exception("The Action object set in the plugin must implement the interface ActionInterface");
}
return $action;
}
@@ -981,12 +990,12 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
/**
* Detect whether action is an outlink given host aliases
*
- * @param Piwik_Tracker_Action_Interface $action
+ * @param ActionInterface $action
* @return bool true if the outlink the visitor clicked on points to one of the known hosts for this website
*/
- protected function detectActionIsOutlinkOnAliasHost(Piwik_Tracker_Action_Interface $action)
+ protected function detectActionIsOutlinkOnAliasHost(ActionInterface $action)
{
- if ($action->getActionType() != Piwik_Tracker_Action_Interface::TYPE_OUTLINK) {
+ if ($action->getActionType() != ActionInterface::TYPE_OUTLINK) {
return false;
}
$decodedActionUrl = $action->getActionUrl();
@@ -994,7 +1003,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
if (!isset($actionUrlParsed['host'])) {
return false;
}
- return Piwik_Tracker_Visit::isHostKnownAliasHost($actionUrlParsed['host'], $this->request->getIdSite());
+ return Tracker\Visit::isHostKnownAliasHost($actionUrlParsed['host'], $this->request->getIdSite());
}
/**
@@ -1040,7 +1049,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
// is the referer host any of the registered URLs for this website?
static public function isHostKnownAliasHost($urlHost, $idSite)
{
- $websiteData = Piwik_Tracker_Cache::getCacheWebsiteAttributes($idSite);
+ $websiteData = Cache::getCacheWebsiteAttributes($idSite);
if (isset($websiteData['hosts'])) {
$canonicalHosts = array();
foreach ($websiteData['hosts'] as $host) {
@@ -1055,11 +1064,12 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
}
}
+
/**
* @package Piwik
* @subpackage Tracker
*/
-class Piwik_Tracker_Visit_VisitorNotFoundInDatabase extends Exception
+class VisitorNotFoundInDatabase extends Exception
{
}
diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php
index 70d8d23e0b..c7a43ddda6 100644
--- a/core/Tracker/VisitExcluded.php
+++ b/core/Tracker/VisitExcluded.php
@@ -8,24 +8,29 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Tracker;
+
use Piwik\Common;
use Piwik\IP;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\IgnoreCookie;
+use Piwik\Tracker\Request;
/**
* This class contains the logic to exclude some visitors from being tracked as per user settings
*/
-class Piwik_Tracker_VisitExcluded
+class VisitExcluded
{
- public function __construct(Piwik_Tracker_Request $request, $ip = false, $userAgent = false)
+ public function __construct(Request $request, $ip = false, $userAgent = false)
{
if ($ip === false) {
$ip = $request->getIp();
}
-
+
if ($userAgent === false) {
$userAgent = $request->getUserAgent();
}
-
+
$this->request = $request;
$this->idSite = $request->getIdSite();
$this->userAgent = $userAgent;
@@ -167,7 +172,7 @@ class Piwik_Tracker_VisitExcluded
*/
protected function isIgnoreCookieFound()
{
- if (Piwik_Tracker_IgnoreCookie::isIgnoreCookieFound()) {
+ if (IgnoreCookie::isIgnoreCookieFound()) {
Common::printDebug('Piwik ignore cookie was found, visit not tracked.');
return true;
}
@@ -181,7 +186,7 @@ class Piwik_Tracker_VisitExcluded
*/
protected function isVisitorIpExcluded()
{
- $websiteAttributes = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->idSite);
+ $websiteAttributes = Cache::getCacheWebsiteAttributes($this->idSite);
if (!empty($websiteAttributes['excluded_ips'])) {
if (IP::isIpInRange($this->ip, $websiteAttributes['excluded_ips'])) {
Common::printDebug('Visitor IP ' . IP::N2P($this->ip) . ' is excluded from being tracked');
@@ -202,7 +207,7 @@ class Piwik_Tracker_VisitExcluded
*/
protected function isUserAgentExcluded()
{
- $websiteAttributes = Piwik_Tracker_Cache::getCacheWebsiteAttributes($this->idSite);
+ $websiteAttributes = Cache::getCacheWebsiteAttributes($this->idSite);
if (!empty($websiteAttributes['excluded_user_agents'])) {
foreach ($websiteAttributes['excluded_user_agents'] as $excludedUserAgent) {
// if the excluded user agent string part is in this visit's user agent, this visit should be excluded
diff --git a/core/Unzip.php b/core/Unzip.php
index 003b37a9e0..705eee93a1 100644
--- a/core/Unzip.php
+++ b/core/Unzip.php
@@ -11,11 +11,11 @@
namespace Piwik;
-use Piwik_Unzip_Gzip;
-use Piwik_Unzip_Interface;
-use Piwik_Unzip_PclZip;
-use Piwik_Unzip_Tar;
-use Piwik_Unzip_ZipArchive;
+use Piwik\Unzip\Gzip;
+use Piwik\Unzip\UncompressInterface;
+use Piwik\Unzip\PclZip;
+use Piwik\Unzip\Tar;
+use Piwik\Unzip\ZipArchive;
/**
* Unzip wrapper around ZipArchive and PclZip
@@ -29,28 +29,28 @@ class Unzip
*
* @param string $name Name of unarchiver
* @param string $filename Name of .zip archive
- * @return Piwik_Unzip_Interface
+ * @return \Piwik\Unzip\UncompressInterface
*/
static public function factory($name, $filename)
{
switch ($name) {
case 'ZipArchive':
if (class_exists('ZipArchive', false))
- return new Piwik_Unzip_ZipArchive($filename);
+ return new ZipArchive($filename);
break;
case 'tar.gz':
- return new Piwik_Unzip_Tar($filename, 'gz');
+ return new Tar($filename, 'gz');
case 'tar.bz2':
- return new Piwik_Unzip_Tar($filename, 'bz2');
+ return new Tar($filename, 'bz2');
case 'gz':
if (function_exists('gzopen'))
- return new Piwik_Unzip_Gzip($filename);
+ return new Gzip($filename);
break;
case 'PclZip':
default:
- return new Piwik_Unzip_PclZip($filename);
+ return new PclZip($filename);
}
- return new Piwik_Unzip_PclZip($filename);
+ return new PclZip($filename);
}
}
diff --git a/core/Unzip/Gzip.php b/core/Unzip/Gzip.php
index 86d7bace14..0e0e80d01b 100755
--- a/core/Unzip/Gzip.php
+++ b/core/Unzip/Gzip.php
@@ -9,13 +9,17 @@
* @package Piwik
*/
+namespace Piwik\Unzip;
+
+use Piwik\Unzip\UncompressInterface;
+
/**
* Unzip implementation for .gz files.
*
* @package Piwik
* @subpackage Unzip
*/
-class Piwik_Unzip_Gzip implements Piwik_Unzip_Interface
+class Gzip implements UncompressInterface
{
/**
* Name of .gz file.
diff --git a/core/Unzip/PclZip.php b/core/Unzip/PclZip.php
index 043f77925c..ad92555ab2 100644
--- a/core/Unzip/PclZip.php
+++ b/core/Unzip/PclZip.php
@@ -8,6 +8,9 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Unzip;
+
+use Piwik\Unzip\UncompressInterface;
/**
* @see libs/PclZip
@@ -20,7 +23,7 @@ require_once PIWIK_INCLUDE_PATH . '/libs/PclZip/pclzip.lib.php';
* @package Piwik
* @subpackage Unzip
*/
-class Piwik_Unzip_PclZip implements Piwik_Unzip_Interface
+class PclZip implements UncompressInterface
{
/**
* @var PclZip
@@ -38,7 +41,7 @@ class Piwik_Unzip_PclZip implements Piwik_Unzip_Interface
*/
public function __construct($filename)
{
- $this->pclzip = new PclZip($filename);
+ $this->pclzip = new \PclZip($filename);
$this->filename = $filename;
}
diff --git a/core/Unzip/Tar.php b/core/Unzip/Tar.php
index e243cbeffb..3e1bac6364 100755
--- a/core/Unzip/Tar.php
+++ b/core/Unzip/Tar.php
@@ -8,6 +8,10 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Unzip;
+
+use Archive_Tar;
+use Piwik\Unzip\UncompressInterface;
/**
* @see libs/Archive_Tar
@@ -20,7 +24,7 @@ require_once PIWIK_INCLUDE_PATH . '/libs/Archive_Tar/Tar.php';
* @package Piwik
* @subpackage Unzip
*/
-class Piwik_Unzip_Tar implements Piwik_Unzip_Interface
+class Tar implements UncompressInterface
{
/**
* Archive_Tar instance.
diff --git a/core/Unzip/Interface.php b/core/Unzip/UncompressInterface.php
index bd20ddec0b..36a95143d2 100644
--- a/core/Unzip/Interface.php
+++ b/core/Unzip/UncompressInterface.php
@@ -9,13 +9,15 @@
* @package Piwik
*/
+namespace Piwik\Unzip;
+
/**
* Unzip interface
*
* @package Piwik
* @subpackage Unzip
*/
-interface Piwik_Unzip_Interface
+interface UncompressInterface
{
/**
* Constructor
diff --git a/core/Unzip/ZipArchive.php b/core/Unzip/ZipArchive.php
index fdb1aa8cfd..1e95872cb7 100644
--- a/core/Unzip/ZipArchive.php
+++ b/core/Unzip/ZipArchive.php
@@ -8,6 +8,10 @@
* @category Piwik
* @package Piwik
*/
+namespace Piwik\Unzip;
+
+use Exception;
+use Piwik\Unzip\UncompressInterface;
/**
* Unzip wrapper around ZipArchive
@@ -15,10 +19,10 @@
* @package Piwik
* @subpackage Unzip
*/
-class Piwik_Unzip_ZipArchive implements Piwik_Unzip_Interface
+class ZipArchive implements UncompressInterface
{
/**
- * @var ZipArchive
+ * @var \ZipArchive
*/
private $ziparchive;
/**
@@ -35,7 +39,7 @@ class Piwik_Unzip_ZipArchive implements Piwik_Unzip_Interface
public function __construct($filename)
{
$this->filename = $filename;
- $this->ziparchive = new ZipArchive;
+ $this->ziparchive = new \ZipArchive;
if ($this->ziparchive->open($filename) !== true) {
throw new Exception('Error opening ' . $filename);
}
@@ -97,30 +101,30 @@ class Piwik_Unzip_ZipArchive implements Piwik_Unzip_Interface
public function errorInfo()
{
static $statusStrings = array(
- ZIPARCHIVE::ER_OK => 'No error',
- ZIPARCHIVE::ER_MULTIDISK => 'Multi-disk zip archives not supported',
- ZIPARCHIVE::ER_RENAME => 'Renaming temporary file failed',
- ZIPARCHIVE::ER_CLOSE => 'Closing zip archive failed',
- ZIPARCHIVE::ER_SEEK => 'Seek error',
- ZIPARCHIVE::ER_READ => 'Read error',
- ZIPARCHIVE::ER_WRITE => 'Write error',
- ZIPARCHIVE::ER_CRC => 'CRC error',
- ZIPARCHIVE::ER_ZIPCLOSED => 'Containing zip archive was closed',
- ZIPARCHIVE::ER_NOENT => 'No such file',
- ZIPARCHIVE::ER_EXISTS => 'File already exists',
- ZIPARCHIVE::ER_OPEN => 'Can\'t open file',
- ZIPARCHIVE::ER_TMPOPEN => 'Failure to create temporary file',
- ZIPARCHIVE::ER_ZLIB => 'Zlib error',
- ZIPARCHIVE::ER_MEMORY => 'Malloc failure',
- ZIPARCHIVE::ER_CHANGED => 'Entry has been changed',
- ZIPARCHIVE::ER_COMPNOTSUPP => 'Compression method not supported',
- ZIPARCHIVE::ER_EOF => 'Premature EOF',
- ZIPARCHIVE::ER_INVAL => 'Invalid argument',
- ZIPARCHIVE::ER_NOZIP => 'Not a zip archive',
- ZIPARCHIVE::ER_INTERNAL => 'Internal error',
- ZIPARCHIVE::ER_INCONS => 'Zip archive inconsistent',
- ZIPARCHIVE::ER_REMOVE => 'Can\'t remove file',
- ZIPARCHIVE::ER_DELETED => 'Entry has been deleted',
+ \ZIPARCHIVE::ER_OK => 'No error',
+ \ZIPARCHIVE::ER_MULTIDISK => 'Multi-disk zip archives not supported',
+ \ZIPARCHIVE::ER_RENAME => 'Renaming temporary file failed',
+ \ZIPARCHIVE::ER_CLOSE => 'Closing zip archive failed',
+ \ZIPARCHIVE::ER_SEEK => 'Seek error',
+ \ZIPARCHIVE::ER_READ => 'Read error',
+ \ZIPARCHIVE::ER_WRITE => 'Write error',
+ \ZIPARCHIVE::ER_CRC => 'CRC error',
+ \ZIPARCHIVE::ER_ZIPCLOSED => 'Containing zip archive was closed',
+ \ZIPARCHIVE::ER_NOENT => 'No such file',
+ \ZIPARCHIVE::ER_EXISTS => 'File already exists',
+ \ZIPARCHIVE::ER_OPEN => 'Can\'t open file',
+ \ZIPARCHIVE::ER_TMPOPEN => 'Failure to create temporary file',
+ \ZIPARCHIVE::ER_ZLIB => 'Zlib error',
+ \ZIPARCHIVE::ER_MEMORY => 'Malloc failure',
+ \ZIPARCHIVE::ER_CHANGED => 'Entry has been changed',
+ \ZIPARCHIVE::ER_COMPNOTSUPP => 'Compression method not supported',
+ \ZIPARCHIVE::ER_EOF => 'Premature EOF',
+ \ZIPARCHIVE::ER_INVAL => 'Invalid argument',
+ \ZIPARCHIVE::ER_NOZIP => 'Not a zip archive',
+ \ZIPARCHIVE::ER_INTERNAL => 'Internal error',
+ \ZIPARCHIVE::ER_INCONS => 'Zip archive inconsistent',
+ \ZIPARCHIVE::ER_REMOVE => 'Can\'t remove file',
+ \ZIPARCHIVE::ER_DELETED => 'Entry has been deleted',
);
if (isset($statusStrings[$this->ziparchive->status])) {
diff --git a/core/Updates/0.2.34.php b/core/Updates/0.2.34.php
index b49b8cd28c..785627f875 100644
--- a/core/Updates/0.2.34.php
+++ b/core/Updates/0.2.34.php
@@ -9,6 +9,7 @@
* @package Updates
*/
use Piwik\Piwik;
+use Piwik\Tracker\Cache;
use Piwik\Updates;
/**
@@ -21,6 +22,6 @@ class Piwik_Updates_0_2_34 extends Updates
// force regeneration of cache files following #648
Piwik::setUserIsSuperUser();
$allSiteIds = Piwik_SitesManager_API::getInstance()->getAllSitesId();
- Piwik_Tracker_Cache::regenerateCacheWebsiteAttributes($allSiteIds);
+ Cache::regenerateCacheWebsiteAttributes($allSiteIds);
}
}
diff --git a/core/Updates/0.6.2.php b/core/Updates/0.6.2.php
index 38847b6b8b..74bbe6b6b6 100644
--- a/core/Updates/0.6.2.php
+++ b/core/Updates/0.6.2.php
@@ -9,6 +9,7 @@
* @package Updates
*/
use Piwik\Piwik;
+use Piwik\Tracker\Cache;
use Piwik\Updates;
/**
@@ -39,6 +40,6 @@ class Piwik_Updates_0_6_2 extends Updates
// force regeneration of cache files
Piwik::setUserIsSuperUser();
$allSiteIds = Piwik_SitesManager_API::getInstance()->getAllSitesId();
- Piwik_Tracker_Cache::regenerateCacheWebsiteAttributes($allSiteIds);
+ Cache::regenerateCacheWebsiteAttributes($allSiteIds);
}
}
diff --git a/core/functions.php b/core/functions.php
index ba9caceee8..25dfaedf9b 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -257,7 +257,7 @@ namespace {
}
// Bridge between pre Piwik2 serialized format and namespaced classes
- // Do not define these classes in tracker or archive
+ // Do not need to define these classes in tracker or archive
if(empty($GLOBALS['PIWIK_TRACKER_MODE'])
&& !defined('PIWIK_MODE_ARCHIVE')) {
class Piwik_DataTable_Row_DataTableSummary extends \Piwik\DataTable\Row\DataTableSummaryRow {
diff --git a/libs/PiwikTracker/PiwikTracker.php b/libs/PiwikTracker/PiwikTracker.php
index 4402d9138e..78874d9996 100644
--- a/libs/PiwikTracker/PiwikTracker.php
+++ b/libs/PiwikTracker/PiwikTracker.php
@@ -780,7 +780,7 @@ class PiwikTracker
* This function will only work if the user is initiating the current request, and his cookies
* can be read by PHP from the $_COOKIE array.
*
- * @return string JSON Encoded string containing the Referer information for Goal conversion attribution.
+ * @return string JSON Encoded string containing the Referrer information for Goal conversion attribution.
* Will return false if the cookie could not be found
* @see Piwik.js getAttributionInfo()
*/
diff --git a/misc/log-analytics/tests/logs/iis.log b/misc/log-analytics/tests/logs/iis.log
index ae2726fd7d..0ec7bf504f 100644
--- a/misc/log-analytics/tests/logs/iis.log
+++ b/misc/log-analytics/tests/logs/iis.log
@@ -1,5 +1,5 @@
#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2012-04-01 00:00:13
-#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
+#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2012-04-01 00:00:13 W3SVC834221556 PXQD1 1.2.3.4 GET /foo/bar topCat1=divinity&submit=Search 80 - 5.6.7.8 HTTP/1.1 Mozilla/5.0+(X11;+U;+Linux+i686;+en-US;+rv:1.9.2.7)+Gecko/20100722+Firefox/3.6.7 - - example.com 200 0 0 27028 214 1687
diff --git a/piwik.php b/piwik.php
index f0f7389ad9..1301c3a05f 100644
--- a/piwik.php
+++ b/piwik.php
@@ -10,6 +10,7 @@
use Piwik\Piwik;
use Piwik\Timer;
use Piwik\Tracker;
+use Piwik\Common;
$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
$GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
@@ -45,13 +46,13 @@ require_once PIWIK_INCLUDE_PATH . '/core/Config.php';
require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Cache.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db.php';
-require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/Exception.php';
+require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Db/DbException.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/IgnoreCookie.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Visit.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/GoalManager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Action.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Request.php';
-require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Referer.php';
+require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Referrer.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/VisitExcluded.php';
require_once PIWIK_INCLUDE_PATH . '/core/CacheFile.php';
require_once PIWIK_INCLUDE_PATH . '/core/Cookie.php';
@@ -70,8 +71,8 @@ if ($GLOBALS['PIWIK_TRACKER_DEBUG'] === true) {
set_error_handler('Piwik_ErrorHandler');
set_exception_handler('Piwik_ExceptionHandler');
Common::printDebug("Debug enabled - Input parameters: <br/>" . var_export($_GET, true));
- Piwik_Tracker_Db::enableProfiling();
- Piwik::createConfigObject();
+ \Piwik\Tracker\Db::enableProfiling();
+ \Piwik\FrontController::createConfigObject();
\Piwik\Log::make();
}
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 0650e67099..d1ea3c6eb8 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -18,6 +18,7 @@ use Piwik\Common;
use Piwik\Config;
use Piwik\Date;
use Piwik\DataTable;
+use Piwik\Tracker\GoalManager;
use Piwik\Version;
use Piwik\Plugin;
use Piwik\Translate;
@@ -255,10 +256,10 @@ class Piwik_API_API
}
static protected $visitEcommerceStatus = array(
- Piwik_Tracker_GoalManager::TYPE_BUYER_NONE => 'none',
- Piwik_Tracker_GoalManager::TYPE_BUYER_ORDERED => 'ordered',
- Piwik_Tracker_GoalManager::TYPE_BUYER_OPEN_CART => 'abandonedCart',
- Piwik_Tracker_GoalManager::TYPE_BUYER_ORDERED_AND_OPEN_CART => 'orderedThenAbandonedCart',
+ GoalManager::TYPE_BUYER_NONE => 'none',
+ GoalManager::TYPE_BUYER_ORDERED => 'ordered',
+ GoalManager::TYPE_BUYER_OPEN_CART => 'abandonedCart',
+ GoalManager::TYPE_BUYER_ORDERED_AND_OPEN_CART => 'orderedThenAbandonedCart',
);
/**
diff --git a/plugins/Actions/API.php b/plugins/Actions/API.php
index b40afb87e2..263e3e4a6b 100644
--- a/plugins/Actions/API.php
+++ b/plugins/Actions/API.php
@@ -14,6 +14,7 @@ use Piwik\Piwik;
use Piwik\Common;
use Piwik\Date;
use Piwik\DataTable;
+use Piwik\Tracker\Action;
/**
* The Actions API lets you request reports for all your Visitor Actions: Page URLs, Page titles (Piwik Events),
@@ -200,7 +201,7 @@ class Piwik_Actions_API
public function getPageUrl($pageUrl, $idSite, $period, $date, $segment = false)
{
$callBackParameters = array('Actions_actions_url', $idSite, $period, $date, $segment, $expanded = false, $idSubtable = false);
- $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $pageUrl, Piwik_Tracker_Action::TYPE_ACTION_URL);
+ $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $pageUrl, Action::TYPE_ACTION_URL);
$this->filterPageDatatable($dataTable);
$this->filterActionsDataTable($dataTable);
return $dataTable;
@@ -241,7 +242,7 @@ class Piwik_Actions_API
public function getPageTitle($pageName, $idSite, $period, $date, $segment = false)
{
$callBackParameters = array('Actions_actions', $idSite, $period, $date, $segment, $expanded = false, $idSubtable = false);
- $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $pageName, Piwik_Tracker_Action::TYPE_ACTION_NAME);
+ $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $pageName, Action::TYPE_ACTION_NAME);
$this->filterPageDatatable($dataTable);
$this->filterActionsDataTable($dataTable);
return $dataTable;
@@ -257,7 +258,7 @@ class Piwik_Actions_API
public function getDownload($downloadUrl, $idSite, $period, $date, $segment = false)
{
$callBackParameters = array('Actions_downloads', $idSite, $period, $date, $segment, $expanded = false, $idSubtable = false);
- $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $downloadUrl, Piwik_Tracker_Action::TYPE_DOWNLOAD);
+ $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $downloadUrl, Action::TYPE_DOWNLOAD);
$this->filterActionsDataTable($dataTable);
return $dataTable;
}
@@ -272,7 +273,7 @@ class Piwik_Actions_API
public function getOutlink($outlinkUrl, $idSite, $period, $date, $segment = false)
{
$callBackParameters = array('Actions_outlink', $idSite, $period, $date, $segment, $expanded = false, $idSubtable = false);
- $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $outlinkUrl, Piwik_Tracker_Action::TYPE_OUTLINK);
+ $dataTable = $this->getFilterPageDatatableSearch($callBackParameters, $outlinkUrl, Action::TYPE_OUTLINK);
$this->filterActionsDataTable($dataTable);
return $dataTable;
}
@@ -329,7 +330,7 @@ class Piwik_Actions_API
Piwik_Actions::checkCustomVariablesPluginEnabled();
$customVariables = Piwik_CustomVariables_API::getInstance()->getCustomVariables($idSite, $period, $date, $segment, $expanded = false, $_leavePiwikCoreVariables = true);
- $customVarNameToLookFor = Piwik_Tracker_Action::CVAR_KEY_SEARCH_CATEGORY;
+ $customVarNameToLookFor = Action::CVAR_KEY_SEARCH_CATEGORY;
$dataTable = new DataTable();
// Handle case where date=last30&period=day
@@ -372,12 +373,12 @@ class Piwik_Actions_API
{
if ($searchTree === false) {
// build the query parts that are searched inside the tree
- if ($actionType == Piwik_Tracker_Action::TYPE_ACTION_NAME) {
+ if ($actionType == Action::TYPE_ACTION_NAME) {
$searchedString = Common::unsanitizeInputValue($search);
} else {
$idSite = $callBackParameters[1];
try {
- $searchedString = Piwik_Tracker_Action::excludeQueryParametersFromUrl($search, $idSite);
+ $searchedString = Action::excludeQueryParametersFromUrl($search, $idSite);
} catch (Exception $e) {
$searchedString = $search;
}
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index f7bcef4b1f..fdd116c671 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -12,6 +12,7 @@ use Piwik\API\Request;
use Piwik\ArchiveProcessor;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Tracker\Action;
use Piwik\ViewDataTable;
use Piwik\WidgetsList;
use Piwik\Plugin;
@@ -147,7 +148,7 @@ class Piwik_Actions extends Plugin
{
$actionType = $this->guessActionTypeFromSegment($segmentName);
- if ($actionType == Piwik_Tracker_Action::TYPE_ACTION_URL) {
+ if ($actionType == Action::TYPE_ACTION_URL) {
// for urls trim protocol and www because it is not recorded in the db
$valueToMatch = preg_replace('@^http[s]?://(www\.)?@i', '', $valueToMatch);
}
@@ -158,7 +159,7 @@ class Piwik_Actions extends Plugin
if ($matchType == SegmentExpression::MATCH_EQUAL
|| $matchType == SegmentExpression::MATCH_NOT_EQUAL
) {
- $sql = Piwik_Tracker_Action::getSqlSelectActionId();
+ $sql = Action::getSqlSelectActionId();
$bind = array($valueToMatch, $valueToMatch, $actionType);
$idAction = Db::fetchOne($sql, $bind);
// if the action is not found, we hack -100 to ensure it tries to match against an integer
@@ -614,13 +615,13 @@ class Piwik_Actions extends Plugin
protected function guessActionTypeFromSegment($segmentName)
{
if (stripos($segmentName, 'pageurl') !== false) {
- $actionType = Piwik_Tracker_Action::TYPE_ACTION_URL;
+ $actionType = Action::TYPE_ACTION_URL;
return $actionType;
} elseif (stripos($segmentName, 'pagetitle') !== false) {
- $actionType = Piwik_Tracker_Action::TYPE_ACTION_NAME;
+ $actionType = Action::TYPE_ACTION_NAME;
return $actionType;
} elseif (stripos($segmentName, 'sitesearch') !== false) {
- $actionType = Piwik_Tracker_Action::TYPE_SITE_SEARCH;
+ $actionType = Action::TYPE_SITE_SEARCH;
return $actionType;
} else {
throw new Exception(" The segment $segmentName has an unexpected value.");
diff --git a/plugins/Actions/Archiver.php b/plugins/Actions/Archiver.php
index dc6242dd95..f3dfa31138 100644
--- a/plugins/Actions/Archiver.php
+++ b/plugins/Actions/Archiver.php
@@ -15,6 +15,7 @@ use Piwik\Metrics;
use Piwik\DataTable;
use Piwik\RankingQuery;
use Piwik\PluginsArchiver;
+use Piwik\Tracker\Action;
/**
* Class encapsulating logic to process Day/Period Archiving for the Actions reports
@@ -53,11 +54,11 @@ class Piwik_Actions_Archiver extends PluginsArchiver
);
public static $actionTypes = array(
- Piwik_Tracker_Action::TYPE_ACTION_URL,
- Piwik_Tracker_Action::TYPE_OUTLINK,
- Piwik_Tracker_Action::TYPE_DOWNLOAD,
- Piwik_Tracker_Action::TYPE_ACTION_NAME,
- Piwik_Tracker_Action::TYPE_SITE_SEARCH,
+ Action::TYPE_ACTION_URL,
+ Action::TYPE_OUTLINK,
+ Action::TYPE_DOWNLOAD,
+ Action::TYPE_ACTION_NAME,
+ Action::TYPE_SITE_SEARCH,
);
static protected $invalidSummedColumnNameToRenamedNameFromPeriodArchive = array(
Metrics::INDEX_NB_UNIQ_VISITORS => Metrics::INDEX_SUM_DAILY_NB_UNIQ_VISITORS,
@@ -160,8 +161,8 @@ class Piwik_Actions_Archiver extends PluginsArchiver
$dataTable = new DataTable();
$dataTable->setMaximumAllowedRows(Piwik_Actions_ArchivingHelper::$maximumRowsInDataTableLevelZero);
- if ($type == Piwik_Tracker_Action::TYPE_ACTION_URL
- || $type == Piwik_Tracker_Action::TYPE_ACTION_NAME
+ if ($type == Action::TYPE_ACTION_URL
+ || $type == Action::TYPE_ACTION_NAME
) {
// for page urls and page titles, performance metrics exist and have to be aggregated correctly
$dataTable->setColumnAggregationOperations(self::$actionColumnAggregationOperations);
@@ -181,20 +182,20 @@ class Piwik_Actions_Archiver extends PluginsArchiver
count(distinct log_link_visit_action.idvisitor) as `" . Metrics::INDEX_NB_UNIQ_VISITORS . "`,
count(*) as `" . Metrics::INDEX_PAGE_NB_HITS . "`,
sum(
- case when " . Piwik_Tracker_Action::DB_COLUMN_TIME_GENERATION . " is null
+ case when " . Action::DB_COLUMN_TIME_GENERATION . " is null
then 0
- else " . Piwik_Tracker_Action::DB_COLUMN_TIME_GENERATION . "
+ else " . Action::DB_COLUMN_TIME_GENERATION . "
end
) / 1000 as `" . Metrics::INDEX_PAGE_SUM_TIME_GENERATION . "`,
sum(
- case when " . Piwik_Tracker_Action::DB_COLUMN_TIME_GENERATION . " is null
+ case when " . Action::DB_COLUMN_TIME_GENERATION . " is null
then 0
else 1
end
) as `" . Metrics::INDEX_PAGE_NB_HITS_WITH_TIME_GENERATION . "`,
- min(" . Piwik_Tracker_Action::DB_COLUMN_TIME_GENERATION . ") / 1000
+ min(" . Action::DB_COLUMN_TIME_GENERATION . ") / 1000
as `" . Metrics::INDEX_PAGE_MIN_TIME_GENERATION . "`,
- max(" . Piwik_Tracker_Action::DB_COLUMN_TIME_GENERATION . ") / 1000
+ max(" . Action::DB_COLUMN_TIME_GENERATION . ") / 1000
as `" . Metrics::INDEX_PAGE_MAX_TIME_GENERATION . "`
";
@@ -237,7 +238,7 @@ class Piwik_Actions_Archiver extends PluginsArchiver
// 2) For each page view, count number of times the referrer page was a Site Search
if ($this->isSiteSearchEnabled()) {
$selectFlagNoResultKeywords = ",
- CASE WHEN (MAX(log_link_visit_action.custom_var_v" . Piwik_Tracker_Action::CVAR_INDEX_SEARCH_COUNT . ") = 0 AND log_link_visit_action.custom_var_k" . Piwik_Tracker_Action::CVAR_INDEX_SEARCH_COUNT . " = '" . Piwik_Tracker_Action::CVAR_KEY_SEARCH_COUNT . "') THEN 1 ELSE 0 END AS `" . Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT . "`";
+ CASE WHEN (MAX(log_link_visit_action.custom_var_v" . Action::CVAR_INDEX_SEARCH_COUNT . ") = 0 AND log_link_visit_action.custom_var_k" . Action::CVAR_INDEX_SEARCH_COUNT . " = '" . Action::CVAR_KEY_SEARCH_COUNT . "') THEN 1 ELSE 0 END AS `" . Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT . "`";
//we need an extra JOIN to know whether the referrer "idaction_name_ref" was a Site Search request
$from[] = array(
@@ -247,7 +248,7 @@ class Piwik_Actions_Archiver extends PluginsArchiver
);
$selectSiteSearchFollowingPages = ",
- SUM(CASE WHEN log_action_name_ref.type = " . Piwik_Tracker_Action::TYPE_SITE_SEARCH . " THEN 1 ELSE 0 END) AS `" . Metrics::INDEX_PAGE_IS_FOLLOWING_SITE_SEARCH_NB_HITS . "`";
+ SUM(CASE WHEN log_action_name_ref.type = " . Action::TYPE_SITE_SEARCH . " THEN 1 ELSE 0 END) AS `" . Metrics::INDEX_PAGE_IS_FOLLOWING_SITE_SEARCH_NB_HITS . "`";
$select .= $selectFlagNoResultKeywords
. $selectSiteSearchFollowingPages;
@@ -445,7 +446,7 @@ class Piwik_Actions_Archiver extends PluginsArchiver
protected function recordPageUrlsReports()
{
- $dataTable = $this->getDataTable(Piwik_Tracker_Action::TYPE_ACTION_URL);
+ $dataTable = $this->getDataTable(Action::TYPE_ACTION_URL);
$this->recordDataTable($dataTable, self::PAGE_URLS_RECORD_NAME);
$records = array(
@@ -516,7 +517,7 @@ class Piwik_Actions_Archiver extends PluginsArchiver
protected function recordDownloadsReports()
{
- $dataTable = $this->getDataTable(Piwik_Tracker_Action::TYPE_DOWNLOAD);
+ $dataTable = $this->getDataTable(Action::TYPE_DOWNLOAD);
$this->recordDataTable($dataTable, self::DOWNLOADS_RECORD_NAME);
$this->getProcessor()->insertNumericRecord(self::METRIC_DOWNLOADS_RECORD_NAME, array_sum($dataTable->getColumn(Metrics::INDEX_PAGE_NB_HITS)));
@@ -525,7 +526,7 @@ class Piwik_Actions_Archiver extends PluginsArchiver
protected function recordOutlinksReports()
{
- $dataTable = $this->getDataTable(Piwik_Tracker_Action::TYPE_OUTLINK);
+ $dataTable = $this->getDataTable(Action::TYPE_OUTLINK);
$this->recordDataTable($dataTable, self::OUTLINKS_RECORD_NAME);
$this->getProcessor()->insertNumericRecord(self::METRIC_OUTLINKS_RECORD_NAME, array_sum($dataTable->getColumn(Metrics::INDEX_PAGE_NB_HITS)));
@@ -534,13 +535,13 @@ class Piwik_Actions_Archiver extends PluginsArchiver
protected function recordPageTitlesReports()
{
- $dataTable = $this->getDataTable(Piwik_Tracker_Action::TYPE_ACTION_NAME);
+ $dataTable = $this->getDataTable(Action::TYPE_ACTION_NAME);
$this->recordDataTable($dataTable, self::PAGE_TITLES_RECORD_NAME);
}
protected function recordSiteSearchReports()
{
- $dataTable = $this->getDataTable(Piwik_Tracker_Action::TYPE_SITE_SEARCH);
+ $dataTable = $this->getDataTable(Action::TYPE_SITE_SEARCH);
$this->deleteUnusedColumnsFromKeywordsDataTable($dataTable);
$this->recordDataTable($dataTable, self::SITE_SEARCH_RECORD_NAME);
diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php
index 2e885a435e..8c95ae629f 100644
--- a/plugins/Actions/ArchivingHelper.php
+++ b/plugins/Actions/ArchivingHelper.php
@@ -12,6 +12,7 @@ use Piwik\Config;
use Piwik\DataTable\Row;
use Piwik\Metrics;
use Piwik\DataTable;
+use Piwik\Tracker\Action;
/**
* This static class provides:
@@ -38,28 +39,28 @@ class Piwik_Actions_ArchivingHelper
$rowsProcessed = 0;
while ($row = $query->fetch()) {
if (empty($row['idaction'])) {
- $row['type'] = ($fieldQueried == 'idaction_url' ? Piwik_Tracker_Action::TYPE_ACTION_URL : Piwik_Tracker_Action::TYPE_ACTION_NAME);
+ $row['type'] = ($fieldQueried == 'idaction_url' ? Action::TYPE_ACTION_URL : Action::TYPE_ACTION_NAME);
// This will be replaced with 'X not defined' later
$row['name'] = '';
// Yes, this is kind of a hack, so we don't mix 'page url not defined' with 'page title not defined' etc.
$row['idaction'] = -$row['type'];
}
- if ($row['type'] != Piwik_Tracker_Action::TYPE_SITE_SEARCH) {
+ if ($row['type'] != Action::TYPE_SITE_SEARCH) {
unset($row[Metrics::INDEX_SITE_SEARCH_HAS_NO_RESULT]);
}
// This will appear as <url /> in the API, which is actually very important to keep
// eg. When there's at least one row in a report that does not have a URL, not having this <url/> would break HTML/PDF reports.
$url = '';
- if ($row['type'] == Piwik_Tracker_Action::TYPE_SITE_SEARCH
- || $row['type'] == Piwik_Tracker_Action::TYPE_ACTION_NAME
+ if ($row['type'] == Action::TYPE_SITE_SEARCH
+ || $row['type'] == Action::TYPE_ACTION_NAME
) {
$url = null;
} elseif (!empty($row['name'])
&& $row['name'] != DataTable::LABEL_SUMMARY_ROW
) {
- $url = Piwik_Tracker_Action::reconstructNormalizedUrl((string)$row['name'], $row['url_prefix']);
+ $url = Action::reconstructNormalizedUrl((string)$row['name'], $row['url_prefix']);
}
if (isset($row['name'])
@@ -116,8 +117,8 @@ class Piwik_Actions_ArchivingHelper
}
}
- if ($row['type'] != Piwik_Tracker_Action::TYPE_ACTION_URL
- && $row['type'] != Piwik_Tracker_Action::TYPE_ACTION_NAME
+ if ($row['type'] != Action::TYPE_ACTION_URL
+ && $row['type'] != Action::TYPE_ACTION_NAME
) {
// only keep performance metrics when they're used (i.e. for URLs and page titles)
if (array_key_exists(Metrics::INDEX_PAGE_SUM_TIME_GENERATION, $row)) {
@@ -308,7 +309,7 @@ class Piwik_Actions_ArchivingHelper
static public function getActionExplodedNames($name, $type, $urlPrefix = null)
{
// Site Search does not split Search keywords
- if ($type == Piwik_Tracker_Action::TYPE_SITE_SEARCH) {
+ if ($type == Action::TYPE_SITE_SEARCH) {
return array($name);
}
@@ -334,8 +335,8 @@ class Piwik_Actions_ArchivingHelper
$urlFragment = $matches[3];
}
- if ($type == Piwik_Tracker_Action::TYPE_DOWNLOAD
- || $type == Piwik_Tracker_Action::TYPE_OUTLINK
+ if ($type == Action::TYPE_DOWNLOAD
+ || $type == Action::TYPE_OUTLINK
) {
if ($isUrl) {
return array(trim($urlHost), '/' . trim($urlPath));
@@ -350,7 +351,7 @@ class Piwik_Actions_ArchivingHelper
}
}
- if ($type == Piwik_Tracker_Action::TYPE_ACTION_NAME) {
+ if ($type == Action::TYPE_ACTION_NAME) {
$categoryDelimiter = self::$actionTitleCategoryDelimiter;
} else {
$categoryDelimiter = self::$actionUrlCategoryDelimiter;
@@ -358,7 +359,7 @@ class Piwik_Actions_ArchivingHelper
if ($isUrl) {
- $urlFragment = Piwik_Tracker_Action::processUrlFragment($urlFragment);
+ $urlFragment = Action::processUrlFragment($urlFragment);
if (!empty($urlFragment)) {
$name .= '#' . $urlFragment;
}
@@ -386,7 +387,7 @@ class Piwik_Actions_ArchivingHelper
// we are careful to prefix the page URL / name with some value
// so that if a page has the same name as a category
// we don't merge both entries
- if ($type != Piwik_Tracker_Action::TYPE_ACTION_NAME) {
+ if ($type != Action::TYPE_ACTION_NAME) {
$lastPageName = '/' . $lastPageName;
} else {
$lastPageName = ' ' . $lastPageName;
@@ -431,7 +432,7 @@ class Piwik_Actions_ArchivingHelper
self::$defaultActionNameWhenNotDefined = Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageName'));
self::$defaultActionUrlWhenNotDefined = Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageURL'));
}
- if ($type == Piwik_Tracker_Action::TYPE_ACTION_NAME) {
+ if ($type == Action::TYPE_ACTION_NAME) {
return self::$defaultActionNameWhenNotDefined;
}
return self::$defaultActionUrlWhenNotDefined;
diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php
index b4de7b1d1d..9e040b552c 100644
--- a/plugins/CoreAdminHome/Controller.php
+++ b/plugins/CoreAdminHome/Controller.php
@@ -15,6 +15,7 @@ use Piwik\Controller\Admin;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Nonce;
+use Piwik\Tracker\IgnoreCookie;
use Piwik\View;
use Piwik\Url;
use Piwik\Site;
@@ -171,13 +172,13 @@ class Piwik_CoreAdminHome_Controller extends Admin
*/
public function optOut()
{
- $trackVisits = !Piwik_Tracker_IgnoreCookie::isIgnoreCookieFound();
+ $trackVisits = !IgnoreCookie::isIgnoreCookieFound();
$nonce = Common::getRequestVar('nonce', false);
$language = Common::getRequestVar('language', '');
if ($nonce !== false && Nonce::verifyNonce('Piwik_OptOut', $nonce)) {
Nonce::discardNonce('Piwik_OptOut');
- Piwik_Tracker_IgnoreCookie::setIgnoreCookie();
+ IgnoreCookie::setIgnoreCookie();
$trackVisits = !$trackVisits;
}
diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php
index 05244f24ef..c3517d8870 100644
--- a/plugins/CoreAdminHome/CoreAdminHome.php
+++ b/plugins/CoreAdminHome/CoreAdminHome.php
@@ -15,6 +15,7 @@ use Piwik\Date;
use Piwik\ScheduledTask;
use Piwik\Plugin;
use Piwik\Db;
+use Piwik\ScheduledTime\Daily;
/**
*
@@ -41,7 +42,7 @@ class Piwik_CoreAdminHome extends Plugin
$purgeArchiveTablesTask = new ScheduledTask ($this,
'purgeOutdatedArchives',
null,
- new Piwik_ScheduledTime_Daily(),
+ new Daily(),
ScheduledTask::HIGH_PRIORITY);
$tasks[] = $purgeArchiveTablesTask;
@@ -49,7 +50,7 @@ class Piwik_CoreAdminHome extends Plugin
$optimizeArchiveTableTask = new ScheduledTask ($this,
'optimizeArchiveTable',
null,
- new Piwik_ScheduledTime_Daily(),
+ new Daily(),
ScheduledTask::LOWEST_PRIORITY);
$tasks[] = $optimizeArchiveTableTask;
}
diff --git a/plugins/CustomVariables/API.php b/plugins/CustomVariables/API.php
index bfe38b7240..fb3e88456e 100644
--- a/plugins/CustomVariables/API.php
+++ b/plugins/CustomVariables/API.php
@@ -12,6 +12,7 @@ use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Date;
use Piwik\DataTable;
+use Piwik\Tracker\Action;
/**
* The Custom Variables API lets you access reports for your <a href='http://piwik.org/docs/custom-variables/' target='_blank'>Custom Variables</a> names and values.
@@ -86,7 +87,7 @@ class Piwik_CustomVariables_API
*/
public static function getReservedCustomVariableKeys()
{
- return array('_pks', '_pkn', '_pkc', '_pkp', Piwik_Tracker_Action::CVAR_KEY_SEARCH_COUNT, Piwik_Tracker_Action::CVAR_KEY_SEARCH_CATEGORY);
+ return array('_pks', '_pkn', '_pkc', '_pkp', Action::CVAR_KEY_SEARCH_COUNT, Action::CVAR_KEY_SEARCH_CATEGORY);
}
/**
diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php
index 198f7a8889..e26bb0a254 100644
--- a/plugins/CustomVariables/Archiver.php
+++ b/plugins/CustomVariables/Archiver.php
@@ -6,6 +6,7 @@ use Piwik\Metrics;
use Piwik\DataArray;
use Piwik\Tracker;
use Piwik\PluginsArchiver;
+use Piwik\Tracker\GoalManager;
/**
* Piwik - Open source web analytics
@@ -141,7 +142,7 @@ class Piwik_CustomVariables_Archiver extends PluginsArchiver
$count = 0;
foreach ($decoded as $category) {
if (empty($category)
- || $count >= Piwik_Tracker_GoalManager::MAXIMUM_PRODUCT_CATEGORIES
+ || $count >= GoalManager::MAXIMUM_PRODUCT_CATEGORIES
) {
continue;
}
diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php
index 7a5c6076f7..def12d84a4 100644
--- a/plugins/DBStats/DBStats.php
+++ b/plugins/DBStats/DBStats.php
@@ -13,6 +13,7 @@ use Piwik\Date;
use Piwik\Common;
use Piwik\ScheduledTask;
use Piwik\Plugin;
+use Piwik\ScheduledTime\Weekly;
/**
*
@@ -52,7 +53,7 @@ class Piwik_DBStats extends Plugin
$this,
'cacheDataByArchiveNameReports',
null,
- new Piwik_ScheduledTime_Weekly(),
+ new Weekly(),
ScheduledTask::LOWEST_PRIORITY
);
$tasks[] = $cacheDataByArchiveNameReportsTask;
diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php
index aa9b58ea26..7ffe0dc79e 100644
--- a/plugins/Dashboard/Controller.php
+++ b/plugins/Dashboard/Controller.php
@@ -11,6 +11,7 @@ use Piwik\DataTable\Renderer\Json;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Controller;
+use Piwik\Session\SessionNamespace;
use Piwik\View;
use Piwik\Db;
use Piwik\WidgetsList;
@@ -95,7 +96,7 @@ class Piwik_Dashboard_Controller extends Controller
$layout = $this->dashboard->getDefaultLayout();
$idDashboard = Common::getRequestVar('idDashboard', 1, 'int');
if (Piwik::isUserIsAnonymous()) {
- $session = new Piwik_Session_Namespace("Piwik_Dashboard");
+ $session = new SessionNamespace("Piwik_Dashboard");
$session->dashboardLayout = $layout;
$session->setExpirationSeconds(1800);
} else {
@@ -259,7 +260,7 @@ class Piwik_Dashboard_Controller extends Controller
$idDashboard = Common::getRequestVar('idDashboard', 1, 'int');
$name = Common::getRequestVar('name', '', 'string');
if (Piwik::isUserIsAnonymous()) {
- $session = new Piwik_Session_Namespace("Piwik_Dashboard");
+ $session = new SessionNamespace("Piwik_Dashboard");
$session->dashboardLayout = $layout;
$session->setExpirationSeconds(1800);
} else {
@@ -297,7 +298,7 @@ class Piwik_Dashboard_Controller extends Controller
{
if (Piwik::isUserIsAnonymous()) {
- $session = new Piwik_Session_Namespace("Piwik_Dashboard");
+ $session = new SessionNamespace("Piwik_Dashboard");
if (!isset($session->dashboardLayout)) {
return $this->dashboard->getDefaultLayout();
diff --git a/plugins/DoNotTrack/DoNotTrack.php b/plugins/DoNotTrack/DoNotTrack.php
index 2ea56e3d0f..8d9a3cf700 100644
--- a/plugins/DoNotTrack/DoNotTrack.php
+++ b/plugins/DoNotTrack/DoNotTrack.php
@@ -10,6 +10,8 @@
*/
use Piwik\Plugin;
use Piwik\Common;
+use Piwik\Tracker\IgnoreCookie;
+use Piwik\Tracker\Request;
/**
* Ignore visits where user agent's request contains either:
@@ -35,7 +37,7 @@ class Piwik_DoNotTrack extends Plugin
if ((isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1')
|| (isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1')
) {
- $request = new Piwik_Tracker_Request($_REQUEST);
+ $request = new Request($_REQUEST);
$ua = $request->getUserAgent();
if (strpos($ua, 'MSIE 10') !== false) {
Common::printDebug("INTERNET EXPLORER 10 Enables DNT by default, so Piwik ignores DNT for all IE10 browsers...");
@@ -45,7 +47,7 @@ class Piwik_DoNotTrack extends Plugin
$exclude = true;
Common::printDebug("DoNotTrack found.");
- $trackingCookie = Piwik_Tracker_IgnoreCookie::getTrackingCookie();
+ $trackingCookie = IgnoreCookie::getTrackingCookie();
$trackingCookie->delete();
// this is an optional supplement to the site's tracking status resource at:
diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php
index 46f8738771..3eb1a62e28 100644
--- a/plugins/Goals/API.php
+++ b/plugins/Goals/API.php
@@ -15,6 +15,8 @@ use Piwik\Common;
use Piwik\DataTable;
use Piwik\Site;
use Piwik\Db;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\GoalManager;
/**
* Goals API lets you Manage existing goals, via "updateGoal" and "deleteGoal", create new Goals via "addGoal",
@@ -124,7 +126,7 @@ class Piwik_Goals_API
'revenue' => (float)$revenue,
'deleted' => 0,
));
- Piwik_Tracker_Cache::regenerateCacheWebsiteAttributes($idSite);
+ Cache::regenerateCacheWebsiteAttributes($idSite);
return $idGoal;
}
@@ -162,7 +164,7 @@ class Piwik_Goals_API
),
"idsite = '$idSite' AND idgoal = '$idGoal'"
);
- Piwik_Tracker_Cache::regenerateCacheWebsiteAttributes($idSite);
+ Cache::regenerateCacheWebsiteAttributes($idSite);
}
private function checkPatternIsValid($patternType, $pattern)
@@ -201,7 +203,7 @@ class Piwik_Goals_API
AND idgoal = ?",
array($idSite, $idGoal));
Db::deleteAllRows(Common::prefixTable("log_conversion"), "WHERE idgoal = ?", 100000, array($idGoal));
- Piwik_Tracker_Cache::regenerateCacheWebsiteAttributes($idSite);
+ Cache::regenerateCacheWebsiteAttributes($idSite);
}
/**
@@ -229,7 +231,7 @@ class Piwik_Goals_API
}
// Average price = sum product revenue / quantity
- $dataTable->queueFilter('ColumnCallbackAddColumnQuotient', array('avg_price', 'price', $ordersColumn, Piwik_Tracker_GoalManager::REVENUE_PRECISION));
+ $dataTable->queueFilter('ColumnCallbackAddColumnQuotient', array('avg_price', 'price', $ordersColumn, GoalManager::REVENUE_PRECISION));
// Average quantity = sum product quantity / abandoned carts
$dataTable->queueFilter('ColumnCallbackAddColumnQuotient', array('avg_quantity', 'quantity', $ordersColumn, $precision = 1));
@@ -280,7 +282,7 @@ class Piwik_Goals_API
}
// Product conversion rate = orders / visits
- $dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('conversion_rate', $ordersColumn, 'nb_visits', Piwik_Tracker_GoalManager::REVENUE_PRECISION));
+ $dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('conversion_rate', $ordersColumn, 'nb_visits', GoalManager::REVENUE_PRECISION));
return $dataTable;
}
@@ -354,9 +356,9 @@ class Piwik_Goals_API
protected static function convertSpecialGoalIds($idGoal)
{
if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) {
- return Piwik_Tracker_GoalManager::IDGOAL_ORDER;
+ return GoalManager::IDGOAL_ORDER;
} else if ($idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) {
- return Piwik_Tracker_GoalManager::IDGOAL_CART;
+ return GoalManager::IDGOAL_CART;
} else {
return $idGoal;
}
diff --git a/plugins/Goals/Archiver.php b/plugins/Goals/Archiver.php
index 000de7d136..cad582453a 100644
--- a/plugins/Goals/Archiver.php
+++ b/plugins/Goals/Archiver.php
@@ -14,6 +14,7 @@ use Piwik\Metrics;
use Piwik\DataTable;
use Piwik\DataArray;
use Piwik\PluginsArchiver;
+use Piwik\Tracker\GoalManager;
class Piwik_Goals_Archiver extends PluginsArchiver
{
@@ -138,7 +139,7 @@ class Piwik_Goals_Archiver extends PluginsArchiver
// We don't want to sum Abandoned cart metrics in the overall revenue/conversions/converted visits
// since it is a "negative conversion"
- if ($idGoal != Piwik_Tracker_GoalManager::IDGOAL_CART) {
+ if ($idGoal != GoalManager::IDGOAL_CART) {
$totalConversions += $row[Metrics::INDEX_GOAL_NB_CONVERSIONS];
$totalRevenue += $row[Metrics::INDEX_GOAL_REVENUE];
}
@@ -198,7 +199,7 @@ class Piwik_Goals_Archiver extends PluginsArchiver
protected function getConversionRate($count)
{
$visits = $this->getProcessor()->getNumberOfVisits();
- return round(100 * $count / $visits, Piwik_Tracker_GoalManager::REVENUE_PRECISION);
+ return round(100 * $count / $visits, GoalManager::REVENUE_PRECISION);
}
protected function insertReports($recordName, $visitsToConversions)
@@ -258,7 +259,7 @@ class Piwik_Goals_Archiver extends PluginsArchiver
foreach ($this->itemReports as $dimension => $itemAggregatesByType) {
foreach ($itemAggregatesByType as $ecommerceType => $itemAggregate) {
$recordName = $this->dimensionRecord[$dimension];
- if ($ecommerceType == Piwik_Tracker_GoalManager::IDGOAL_CART) {
+ if ($ecommerceType == GoalManager::IDGOAL_CART) {
$recordName = self::getItemRecordNameAbandonedCart($recordName);
}
$table = $this->getProcessor()->getDataTableFromDataArray($itemAggregate);
@@ -334,7 +335,7 @@ class Piwik_Goals_Archiver extends PluginsArchiver
}
}
- if ($row['ecommerceType'] == Piwik_Tracker_GoalManager::IDGOAL_CART) {
+ if ($row['ecommerceType'] == GoalManager::IDGOAL_CART) {
// abandoned carts are the numner of visits with an abandoned cart
$row[Metrics::INDEX_ECOMMERCE_ORDERS] = $row[Metrics::INDEX_NB_VISITS];
}
@@ -365,7 +366,7 @@ class Piwik_Goals_Archiver extends PluginsArchiver
protected function getEcommerceIdGoals()
{
- return array(Piwik_Tracker_GoalManager::IDGOAL_CART, Piwik_Tracker_GoalManager::IDGOAL_ORDER);
+ return array(GoalManager::IDGOAL_CART, GoalManager::IDGOAL_ORDER);
}
static public function getItemRecordNameAbandonedCart($recordName)
@@ -392,11 +393,11 @@ class Piwik_Goals_Archiver extends PluginsArchiver
/*
* Archive General Goal metrics
*/
- $goalIdsToSum = Piwik_Tracker_GoalManager::getGoalIds($this->getProcessor()->getSite()->getId());
+ $goalIdsToSum = GoalManager::getGoalIds($this->getProcessor()->getSite()->getId());
//Ecommerce
- $goalIdsToSum[] = Piwik_Tracker_GoalManager::IDGOAL_ORDER;
- $goalIdsToSum[] = Piwik_Tracker_GoalManager::IDGOAL_CART; //bug here if idgoal=1
+ $goalIdsToSum[] = GoalManager::IDGOAL_ORDER;
+ $goalIdsToSum[] = GoalManager::IDGOAL_CART; //bug here if idgoal=1
// Overall goal metrics
$goalIdsToSum[] = false;
diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php
index 1ae77ed879..4dc4685c59 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -11,6 +11,7 @@
use Piwik\ArchiveProcessor;
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Tracker\GoalManager;
use Piwik\TranslationWriter;
use Piwik\Plugin;
use Piwik\Site;
@@ -54,7 +55,7 @@ class Piwik_Goals extends Plugin
return $columns;
}
// Orders
- if ($idGoal === Piwik_Tracker_GoalManager::IDGOAL_ORDER) {
+ if ($idGoal === GoalManager::IDGOAL_ORDER) {
$columns = array_merge($columns, array(
'revenue_subtotal',
'revenue_tax',
@@ -63,7 +64,7 @@ class Piwik_Goals extends Plugin
));
}
// Abandoned carts & orders
- if ($idGoal <= Piwik_Tracker_GoalManager::IDGOAL_ORDER) {
+ if ($idGoal <= GoalManager::IDGOAL_ORDER) {
$columns[] = 'items';
}
return $columns;
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index aa3052e6b5..d0207e1ffa 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -17,6 +17,7 @@ use Piwik\Config;
use Piwik\Common;
use Piwik\Access;
use Piwik\Http;
+use Piwik\Session\SessionNamespace;
use Piwik\Updater;
use Piwik\View;
use Piwik\Version;
@@ -48,7 +49,7 @@ class Piwik_Installation_Controller extends Admin
public function __construct()
{
- $this->session = new Piwik_Session_Namespace('Piwik_Installation');
+ $this->session = new SessionNamespace('Piwik_Installation');
if (!isset($this->session->currentStepDone)) {
$this->session->currentStepDone = '';
$this->session->skipThisStep = array();
diff --git a/plugins/Live/API.php b/plugins/Live/API.php
index 8cd04cf585..3354c67335 100644
--- a/plugins/Live/API.php
+++ b/plugins/Live/API.php
@@ -22,6 +22,8 @@ use Piwik\Tracker;
use Piwik\Segment;
use Piwik\Site;
use Piwik\Db;
+use Piwik\Tracker\Action;
+use Piwik\Tracker\GoalManager;
/**
* @see plugins/Referers/functions.php
@@ -212,8 +214,8 @@ class Piwik_Live_API
private function getCustomVariablePrettyKey($key)
{
$rename = array(
- Piwik_Tracker_Action::CVAR_KEY_SEARCH_CATEGORY => Piwik_Translate('Actions_ColumnSearchCategory'),
- Piwik_Tracker_Action::CVAR_KEY_SEARCH_COUNT => Piwik_Translate('Actions_ColumnSearchResultsCount'),
+ Action::CVAR_KEY_SEARCH_CATEGORY => Piwik_Translate('Actions_ColumnSearchCategory'),
+ Action::CVAR_KEY_SEARCH_COUNT => Piwik_Translate('Actions_ColumnSearchResultsCount'),
);
if (isset($rename[$key])) {
return $rename[$key];
@@ -508,7 +510,7 @@ class Piwik_Live_API
}
// Reconstruct url from prefix
- $actionDetail['url'] = Piwik_Tracker_Action::reconstructNormalizedUrl($actionDetail['url'], $actionDetail['url_prefix']);
+ $actionDetail['url'] = Action::reconstructNormalizedUrl($actionDetail['url'], $actionDetail['url_prefix']);
unset($actionDetail['url_prefix']);
// Set the time spent for this action (which is the timeSpentRef of the next action)
@@ -526,7 +528,7 @@ class Piwik_Live_API
unset($actionDetail['custom_float']);
// Handle Site Search
- if ($actionDetail['type'] == Piwik_Tracker_Action::TYPE_SITE_SEARCH) {
+ if ($actionDetail['type'] == Action::TYPE_SITE_SEARCH) {
$actionDetail['siteSearchKeyword'] = $actionDetail['pageTitle'];
unset($actionDetail['pageTitle']);
}
@@ -556,7 +558,7 @@ class Piwik_Live_API
$goalDetails = Db::fetchAll($sql, array($idVisit));
$sql = "SELECT
- case idgoal when " . Piwik_Tracker_GoalManager::IDGOAL_CART . " then '" . Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART . "' else '" . Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER . "' end as type,
+ case idgoal when " . GoalManager::IDGOAL_CART . " then '" . Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART . "' else '" . Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER . "' end as type,
idorder as orderId,
" . LogAggregator::getSqlRevenue('revenue') . " as revenue,
" . LogAggregator::getSqlRevenue('revenue_subtotal') . " as revenueSubTotal,
@@ -568,7 +570,7 @@ class Piwik_Live_API
log_conversion.server_time as serverTimePretty
FROM " . Common::prefixTable('log_conversion') . " AS log_conversion
WHERE idvisit = ?
- AND idgoal <= " . Piwik_Tracker_GoalManager::IDGOAL_ORDER . "
+ AND idgoal <= " . GoalManager::IDGOAL_ORDER . "
ORDER BY server_time ASC
LIMIT 0, $actionsLimit";
$ecommerceDetails = Db::fetchAll($sql, array($idVisit));
@@ -615,7 +617,7 @@ class Piwik_Live_API
";
$bind = array($idVisit, isset($ecommerceConversion['orderId'])
? $ecommerceConversion['orderId']
- : Piwik_Tracker_GoalManager::ITEM_IDORDER_ABANDONED_CART
+ : GoalManager::ITEM_IDORDER_ABANDONED_CART
);
$itemsDetails = Db::fetchAll($sql, $bind);
@@ -641,15 +643,15 @@ class Piwik_Live_API
case Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART:
$details['icon'] = 'plugins/Zeitgeist/images/' . $details['type'] . '.gif';
break;
- case Piwik_Tracker_Action_Interface::TYPE_DOWNLOAD:
+ case Tracker\ActionInterface::TYPE_DOWNLOAD:
$details['type'] = 'download';
$details['icon'] = 'plugins/Zeitgeist/images/download.png';
break;
- case Piwik_Tracker_Action_Interface::TYPE_OUTLINK:
+ case Tracker\ActionInterface::TYPE_OUTLINK:
$details['type'] = 'outlink';
$details['icon'] = 'plugins/Zeitgeist/images/link.gif';
break;
- case Piwik_Tracker_Action::TYPE_SITE_SEARCH:
+ case Action::TYPE_SITE_SEARCH:
$details['type'] = 'search';
$details['icon'] = 'plugins/Zeitgeist/images/search_ico.png';
break;
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php
index db31fe886f..5d7441fc38 100644
--- a/plugins/Live/Visitor.php
+++ b/plugins/Live/Visitor.php
@@ -12,6 +12,7 @@ use Piwik\Piwik;
use Piwik\Common;
use Piwik\IP;
use Piwik\Tracker;
+use Piwik\Tracker\Visit;
/**
* @see plugins/Referers/functions.php
@@ -272,7 +273,7 @@ class Piwik_Live_Visitor
public function getRegionName()
{
$region = $this->getRegionCode();
- if ($region != '' && $region != Piwik_Tracker_Visit::UNKNOWN_CODE) {
+ if ($region != '' && $region != Visit::UNKNOWN_CODE) {
return Piwik_UserCountry_LocationProvider_GeoIp::getRegionNameFromCodes(
$this->details['location_country'], $region);
}
diff --git a/plugins/Overlay/API.php b/plugins/Overlay/API.php
index d6d019aa23..35e7c681e4 100644
--- a/plugins/Overlay/API.php
+++ b/plugins/Overlay/API.php
@@ -3,6 +3,7 @@ use Piwik\Config;
use Piwik\Piwik;
use Piwik\Access;
use Piwik\DataTable;
+use Piwik\Tracker\Action;
/**
* Piwik - Open source web analytics
@@ -79,7 +80,7 @@ class Piwik_Overlay_API
{
$this->authenticate($idSite);
- $url = Piwik_Tracker_Action::excludeQueryParametersFromUrl($url, $idSite);
+ $url = Action::excludeQueryParametersFromUrl($url, $idSite);
// we don't unsanitize $url here. it will be done in the Transitions plugin.
$resultDataTable = new DataTable;
diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php
index b034173e43..2efcfd7057 100644
--- a/plugins/Overlay/Controller.php
+++ b/plugins/Overlay/Controller.php
@@ -5,6 +5,7 @@ use Piwik\Piwik;
use Piwik\Config;
use Piwik\Common;
use Piwik\Controller;
+use Piwik\Tracker\Action;
use Piwik\View;
/**
@@ -52,12 +53,12 @@ class Piwik_Overlay_Controller extends Controller
$currentUrl = Common::getRequestVar('currentUrl');
$currentUrl = Common::unsanitizeInputValue($currentUrl);
- $normalizedCurrentUrl = Piwik_Tracker_Action::excludeQueryParametersFromUrl($currentUrl, $idSite);
+ $normalizedCurrentUrl = Action::excludeQueryParametersFromUrl($currentUrl, $idSite);
$normalizedCurrentUrl = Common::unsanitizeInputValue($normalizedCurrentUrl);
// load the appropriate row of the page urls report using the label filter
Piwik_Actions_ArchivingHelper::reloadConfig();
- $path = Piwik_Actions_ArchivingHelper::getActionExplodedNames($normalizedCurrentUrl, Piwik_Tracker_Action::TYPE_ACTION_URL);
+ $path = Piwik_Actions_ArchivingHelper::getActionExplodedNames($normalizedCurrentUrl, Action::TYPE_ACTION_URL);
$path = array_map('urlencode', $path);
$label = implode('>', $path);
$request = new Request(
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php
index 3681776a71..517b410bfe 100644
--- a/plugins/PrivacyManager/PrivacyManager.php
+++ b/plugins/PrivacyManager/PrivacyManager.php
@@ -16,6 +16,8 @@ use Piwik\Date;
use Piwik\ScheduledTask;
use Piwik\Plugin;
use Piwik\Db;
+use Piwik\ScheduledTime\Daily;
+use Piwik\Tracker\GoalManager;
/**
* @see plugins/PrivacyManager/LogDataPurger.php
@@ -73,12 +75,12 @@ class Piwik_PrivacyManager extends Plugin
// they will execute before the optimize tables task
$purgeReportDataTask = new ScheduledTask(
- $this, 'deleteReportData', null, new Piwik_ScheduledTime_Daily(), ScheduledTask::LOW_PRIORITY
+ $this, 'deleteReportData', null, new Daily(), ScheduledTask::LOW_PRIORITY
);
$tasks[] = $purgeReportDataTask;
$purgeLogDataTask = new ScheduledTask(
- $this, 'deleteLogData', null, new Piwik_ScheduledTime_Daily(), ScheduledTask::LOW_PRIORITY
+ $this, 'deleteLogData', null, new Daily(), ScheduledTask::LOW_PRIORITY
);
$tasks[] = $purgeLogDataTask;
}
@@ -349,8 +351,8 @@ class Piwik_PrivacyManager extends Plugin
}
$metricsToKeep[] = Piwik_Goals_Archiver::getRecordName($metric);
- $metricsToKeep[] = Piwik_Goals_Archiver::getRecordName($metric, Piwik_Tracker_GoalManager::IDGOAL_ORDER);
- $metricsToKeep[] = Piwik_Goals_Archiver::getRecordName($metric, Piwik_Tracker_GoalManager::IDGOAL_CART);
+ $metricsToKeep[] = Piwik_Goals_Archiver::getRecordName($metric, GoalManager::IDGOAL_ORDER);
+ $metricsToKeep[] = Piwik_Goals_Archiver::getRecordName($metric, GoalManager::IDGOAL_CART);
}
}
diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php
index 6633a70f5d..cf1b362c7b 100644
--- a/plugins/Proxy/Controller.php
+++ b/plugins/Proxy/Controller.php
@@ -60,7 +60,7 @@ class Piwik_Proxy_Controller extends Controller
// validate referrer
$referrer = Url::getReferer();
if (empty($referrer) || !Url::isLocalUrl($referrer)) {
- die('Invalid Referer detected - This means that your web browser is not sending the "Referer URL" which is
+ die('Invalid Referrer detected - This means that your web browser is not sending the "Referrer URL" which is
required to proceed with the redirect. Verify your browser settings and add-ons, to check why your browser
is not sending this referer.
diff --git a/plugins/Referers/API.php b/plugins/Referers/API.php
index 495a73f53f..b7a16365bd 100644
--- a/plugins/Referers/API.php
+++ b/plugins/Referers/API.php
@@ -302,7 +302,7 @@ class Piwik_Referers_API
{
$dataTable = $this->getDataTable(Piwik_Referers_Archiver::WEBSITES_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
// the htmlspecialchars_decode call is for BC for before 1.1
- // as the Referer URL was previously encoded in the log tables, but is now recorded raw
+ // as the Referrer URL was previously encoded in the log tables, but is now recorded raw
$dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', create_function('$label', 'return htmlspecialchars_decode($label);')));
$dataTable->queueFilter('ColumnCallbackReplace', array('label', 'Piwik_getPathFromUrl'));
return $dataTable;
diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php
index 7a6307769f..738fda97ba 100644
--- a/plugins/Referers/Referers.php
+++ b/plugins/Referers/Referers.php
@@ -207,7 +207,7 @@ class Piwik_Referers extends Plugin
}
/**
- * Adds Referer widgets
+ * Adds Referrer widgets
*/
function addWidgets()
{
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php
index 3a891fe414..18f22d8278 100644
--- a/plugins/SitesManager/API.php
+++ b/plugins/SitesManager/API.php
@@ -14,6 +14,7 @@ use Piwik\Access;
use Piwik\Date;
use Piwik\IP;
use Piwik\Db;
+use Piwik\Tracker\Cache;
use Piwik\Url;
use Piwik\TaskScheduler;
use Piwik\Site;
@@ -550,7 +551,7 @@ class Piwik_SitesManager_API
private function postUpdateWebsite($idSite)
{
Site::clearCache();
- Piwik_Tracker_Cache::regenerateCacheWebsiteAttributes($idSite);
+ Cache::regenerateCacheWebsiteAttributes($idSite);
}
/**
@@ -586,7 +587,7 @@ class Piwik_SitesManager_API
WHERE idsite = ?", $idSite);
// we do not delete logs here on purpose (you can run these queries on the log_ tables to delete all data)
- Piwik_Tracker_Cache::deleteCacheWebsiteAttributes($idSite);
+ Cache::deleteCacheWebsiteAttributes($idSite);
Piwik_PostEvent('SitesManager.deleteSite', array($idSite));
}
@@ -705,7 +706,7 @@ class Piwik_SitesManager_API
Piwik::checkUserIsSuperUser();
$excludedIps = $this->checkAndReturnExcludedIps($excludedIps);
Piwik_SetOption(self::OPTION_EXCLUDED_IPS_GLOBAL, $excludedIps);
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
return true;
}
@@ -722,7 +723,7 @@ class Piwik_SitesManager_API
Piwik::checkUserIsSuperUser();
Piwik_SetOption(self::OPTION_SEARCH_KEYWORD_QUERY_PARAMETERS_GLOBAL, $searchKeywordParameters);
Piwik_SetOption(self::OPTION_SEARCH_CATEGORY_QUERY_PARAMETERS_GLOBAL, $searchCategoryParameters);
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
return true;
}
@@ -791,7 +792,7 @@ class Piwik_SitesManager_API
Piwik_SetOption(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL, $excludedUserAgents);
// make sure tracker cache will reflect change
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
}
/**
@@ -820,7 +821,7 @@ class Piwik_SitesManager_API
Piwik_SetOption(self::OPTION_SITE_SPECIFIC_USER_AGENT_EXCLUDE_ENABLE, $enabled);
// make sure tracker cache will reflect change
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
}
/**
@@ -851,7 +852,7 @@ class Piwik_SitesManager_API
Piwik_SetOption(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL, $enabled);
// make sure tracker cache will reflect change
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
}
/**
@@ -866,7 +867,7 @@ class Piwik_SitesManager_API
Piwik::checkUserIsSuperUser();
$excludedQueryParameters = $this->checkAndReturnCommaSeparatedStringList($excludedQueryParameters);
Piwik_SetOption(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL, $excludedQueryParameters);
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
return true;
}
diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php
index e084c81737..947e946a22 100644
--- a/plugins/Transitions/API.php
+++ b/plugins/Transitions/API.php
@@ -24,6 +24,7 @@ use Piwik\RankingQuery;
use Piwik\Segment;
use Piwik\SegmentExpression;
use Piwik\Site;
+use Piwik\Tracker\Action;
/**
* @package Piwik_Transitions
@@ -158,7 +159,7 @@ class Piwik_Transitions_API
if ($id < 0) {
$unknown = Piwik_Actions_ArchivingHelper::getUnknownActionName(
- Piwik_Tracker_Action::TYPE_ACTION_NAME);
+ Action::TYPE_ACTION_NAME);
if (trim($actionName) == trim($unknown)) {
$id = $actionsPlugin->getIdActionFromSegment('', 'idaction_name', SegmentExpression::MATCH_EQUAL, 'pageTitle');
@@ -240,7 +241,7 @@ class Piwik_Transitions_API
$isTitle = ($actionType == 'title');
if (!$isTitle) {
// specific setup for page urls
- $types[Piwik_Tracker_Action::TYPE_ACTION_URL] = 'followingPages';
+ $types[Action::TYPE_ACTION_URL] = 'followingPages';
$dimension = 'IF( idaction_url IS NULL, idaction_name, idaction_url )';
// site search referrers are logged with url=NULL
// when we find one, we have to join on name
@@ -248,7 +249,7 @@ class Piwik_Transitions_API
$selects = array('log_action.name', 'log_action.url_prefix', 'log_action.type');
} else {
// specific setup for page titles:
- $types[Piwik_Tracker_Action::TYPE_ACTION_NAME] = 'followingPages';
+ $types[Action::TYPE_ACTION_NAME] = 'followingPages';
// join log_action on name and url and pick depending on url type
// the table joined on url is log_action1
$joinLogActionColumn = array('idaction_url', 'idaction_name');
@@ -257,7 +258,7 @@ class Piwik_Transitions_API
' /* following site search */ . '
WHEN log_link_visit_action.idaction_url IS NULL THEN log_action2.idaction
' /* following page view: use page title */ . '
- WHEN log_action1.type = ' . Piwik_Tracker_Action::TYPE_ACTION_URL . ' THEN log_action2.idaction
+ WHEN log_action1.type = ' . Action::TYPE_ACTION_URL . ' THEN log_action2.idaction
' /* following download or outlink: use url */ . '
ELSE log_action1.idaction
END
@@ -267,7 +268,7 @@ class Piwik_Transitions_API
' /* following site search */ . '
WHEN log_link_visit_action.idaction_url IS NULL THEN log_action2.name
' /* following page view: use page title */ . '
- WHEN log_action1.type = ' . Piwik_Tracker_Action::TYPE_ACTION_URL . ' THEN log_action2.name
+ WHEN log_action1.type = ' . Action::TYPE_ACTION_URL . ' THEN log_action2.name
' /* following download or outlink: use url */ . '
ELSE log_action1.name
END AS `name`',
@@ -275,7 +276,7 @@ class Piwik_Transitions_API
' /* following site search */ . '
WHEN log_link_visit_action.idaction_url IS NULL THEN log_action2.type
' /* following page view: use page title */ . '
- WHEN log_action1.type = ' . Piwik_Tracker_Action::TYPE_ACTION_URL . ' THEN log_action2.type
+ WHEN log_action1.type = ' . Action::TYPE_ACTION_URL . ' THEN log_action2.type
' /* following download or outlink: use url */ . '
ELSE log_action1.type
END AS `type`',
@@ -284,9 +285,9 @@ class Piwik_Transitions_API
}
// these types are available for both titles and urls
- $types[Piwik_Tracker_Action::TYPE_SITE_SEARCH] = 'followingSiteSearches';
- $types[Piwik_Tracker_Action::TYPE_OUTLINK] = 'outlinks';
- $types[Piwik_Tracker_Action::TYPE_DOWNLOAD] = 'downloads';
+ $types[Action::TYPE_SITE_SEARCH] = 'followingSiteSearches';
+ $types[Action::TYPE_OUTLINK] = 'outlinks';
+ $types[Action::TYPE_DOWNLOAD] = 'downloads';
$rankingQuery = new RankingQuery($limitBeforeGrouping ? $limitBeforeGrouping : $this->limitBeforeGrouping);
$rankingQuery->addLabelColumn(array('name', 'url_prefix'));
@@ -424,12 +425,12 @@ class Piwik_Transitions_API
$rankingQuery->partitionResultIntoMultipleGroups('action_partition', array(0, 1, 2));
$type = $this->getColumnTypeSuffix($actionType);
- $mainActionType = Piwik_Tracker_Action::TYPE_ACTION_URL;
+ $mainActionType = Action::TYPE_ACTION_URL;
$dimension = 'idaction_url_ref';
$isTitle = $actionType == 'title';
if ($isTitle) {
- $mainActionType = Piwik_Tracker_Action::TYPE_ACTION_NAME;
+ $mainActionType = Action::TYPE_ACTION_NAME;
$dimension = 'idaction_name_ref';
}
@@ -439,7 +440,7 @@ class Piwik_Transitions_API
'CASE WHEN log_link_visit_action.idaction_' . $type . '_ref = ' . intval($idaction) . ' THEN 1 ELSE 0 END AS `is_self`',
'CASE
WHEN log_action.type = ' . $mainActionType . ' THEN 1
- WHEN log_action.type = ' . Piwik_Tracker_Action::TYPE_SITE_SEARCH . ' THEN 2
+ WHEN log_action.type = ' . Action::TYPE_SITE_SEARCH . ' THEN 2
ELSE 0
END AS `action_partition`'
);
@@ -513,13 +514,13 @@ class Piwik_Transitions_API
$label = $pageRecord['name'];
if (empty($label)) {
$label = Piwik_Actions_ArchivingHelper::getUnknownActionName(
- Piwik_Tracker_Action::TYPE_ACTION_NAME);
+ Action::TYPE_ACTION_NAME);
}
return $label;
} else if ($this->returnNormalizedUrls) {
return $pageRecord['name'];
} else {
- return Piwik_Tracker_Action::reconstructNormalizedUrl(
+ return Action::reconstructNormalizedUrl(
$pageRecord['name'], $pageRecord['url_prefix']);
}
}
diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php
index 113a1dc6c5..62b472bbaa 100644
--- a/plugins/UserCountry/API.php
+++ b/plugins/UserCountry/API.php
@@ -12,6 +12,7 @@ use Piwik\Archive;
use Piwik\Metrics;
use Piwik\Piwik;
use Piwik\DataTable;
+use Piwik\Tracker\Visit;
/**
* @see plugins/UserCountry/functions.php
@@ -75,7 +76,7 @@ class Piwik_UserCountry_API
$dataTable = $this->getDataTable(Piwik_UserCountry_Archiver::REGION_RECORD_NAME, $idSite, $period, $date, $segment);
$separator = Piwik_UserCountry_Archiver::LOCATION_SEPARATOR;
- $unk = Piwik_Tracker_Visit::UNKNOWN_CODE;
+ $unk = Visit::UNKNOWN_CODE;
// split the label and put the elements into the 'region' and 'country' metadata fields
$dataTable->filter('ColumnCallbackAddMetadata',
@@ -117,7 +118,7 @@ class Piwik_UserCountry_API
$dataTable = $this->getDataTable(Piwik_UserCountry_Archiver::CITY_RECORD_NAME, $idSite, $period, $date, $segment);
$separator = Piwik_UserCountry_Archiver::LOCATION_SEPARATOR;
- $unk = Piwik_Tracker_Visit::UNKNOWN_CODE;
+ $unk = Visit::UNKNOWN_CODE;
// split the label and put the elements into the 'city_name', 'region', 'country',
// 'lat' & 'long' metadata fields
diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php
index d981e47b6d..784a28ed7f 100755
--- a/plugins/UserCountry/GeoIPAutoUpdater.php
+++ b/plugins/UserCountry/GeoIPAutoUpdater.php
@@ -12,6 +12,8 @@ use Piwik\Piwik;
use Piwik\Common;
use Piwik\Date;
use Piwik\Http;
+use Piwik\ScheduledTime\Monthly;
+use Piwik\ScheduledTime\Weekly;
use Piwik\Unzip;
use Piwik\ScheduledTask;
@@ -257,12 +259,12 @@ class Piwik_UserCountry_GeoIPAutoUpdater
// get new DBs on Wednesday
switch ($schedulePeriodStr) {
case self::SCHEDULE_PERIOD_WEEKLY:
- $schedulePeriod = new Piwik_ScheduledTime_Weekly();
+ $schedulePeriod = new Weekly();
$schedulePeriod->setDay(3);
break;
case self::SCHEDULE_PERIOD_MONTHLY:
default:
- $schedulePeriod = new Piwik_ScheduledTime_Monthly();
+ $schedulePeriod = new Monthly();
$schedulePeriod->setDayOfWeek(3, 0);
break;
}
diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php
index 5fb24a4dd2..40751b7247 100755
--- a/plugins/UserCountry/LocationProvider.php
+++ b/plugins/UserCountry/LocationProvider.php
@@ -10,6 +10,7 @@
*/
use Piwik\Common;
use Piwik\IP;
+use Piwik\Tracker\Cache;
/**
* @see plugins/UserCountry/LocationProvider/Default.php
@@ -288,7 +289,7 @@ abstract class Piwik_UserCountry_LocationProvider
"Invalid provider ID '$providerId'. The provider either does not exist or is not available");
}
Piwik_SetOption(self::CURRENT_PROVIDER_OPTION_NAME, $providerId);
- Piwik_Tracker_Cache::clearCacheGeneral();
+ Cache::clearCacheGeneral();
return $provider;
}
diff --git a/plugins/UserCountry/functions.php b/plugins/UserCountry/functions.php
index 04b8e443e7..cdc408a273 100644
--- a/plugins/UserCountry/functions.php
+++ b/plugins/UserCountry/functions.php
@@ -9,6 +9,7 @@
* @package Piwik_UserCountry
*/
use Piwik\DataTable;
+use Piwik\Tracker\Visit;
/**
* Return the flag image path for a given country
@@ -24,7 +25,7 @@ function Piwik_getFlagFromCode($code)
if (file_exists($absolutePath)) {
return $pathWithCode;
}
- return sprintf($pathInPiwik, Piwik_Tracker_Visit::UNKNOWN_CODE);
+ return sprintf($pathInPiwik, Visit::UNKNOWN_CODE);
}
/**
@@ -49,7 +50,7 @@ function Piwik_ContinentTranslate($label)
*/
function Piwik_CountryTranslate($label)
{
- if ($label == Piwik_Tracker_Visit::UNKNOWN_CODE || $label == '') {
+ if ($label == Visit::UNKNOWN_CODE || $label == '') {
return Piwik_Translate('General_Unknown');
}
return Piwik_Translate('UserCountry_country_' . $label);
@@ -118,7 +119,7 @@ function Piwik_UserCountry_getPrettyRegionName($label)
list($regionCode, $countryCode) = explode(Piwik_UserCountry_Archiver::LOCATION_SEPARATOR, $label);
$result = Piwik_UserCountry_LocationProvider_GeoIp::getRegionNameFromCodes($countryCode, $regionCode);
- if ($countryCode != Piwik_Tracker_Visit::UNKNOWN_CODE && $countryCode != '') {
+ if ($countryCode != Visit::UNKNOWN_CODE && $countryCode != '') {
$result .= ', ' . Piwik_CountryTranslate($countryCode);
}
return $result;
@@ -149,13 +150,13 @@ function Piwik_UserCountry_getPrettyCityName($label)
$regionCode = $parts[1];
$countryCode = @$parts[2];
- if ($cityName == Piwik_Tracker_Visit::UNKNOWN_CODE || $cityName == '') {
+ if ($cityName == Visit::UNKNOWN_CODE || $cityName == '') {
$cityName = Piwik_Translate('General_Unknown');
}
$result = $cityName;
- if ($countryCode != Piwik_Tracker_Visit::UNKNOWN_CODE && $countryCode != '') {
- if ($regionCode != '' && $regionCode != Piwik_Tracker_Visit::UNKNOWN_CODE) {
+ if ($countryCode != Visit::UNKNOWN_CODE && $countryCode != '') {
+ if ($regionCode != '' && $regionCode != Visit::UNKNOWN_CODE) {
$regionName = Piwik_UserCountry_LocationProvider_GeoIp::getRegionNameFromCodes($countryCode, $regionCode);
$result .= ', ' . $regionName;
}
diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php
index 86164eb5a1..41269b773b 100644
--- a/plugins/UserSettings/functions.php
+++ b/plugins/UserSettings/functions.php
@@ -9,6 +9,7 @@
* @package Piwik_UserSettings
*/
use Piwik\Piwik;
+use Piwik\Tracker\Request;
/**
* @see libs/UserAgentParser/UserAgentParser.php
@@ -208,7 +209,7 @@ function Piwik_UserSettings_keepStrlenGreater($value)
function Piwik_getScreenTypeFromResolution($resolution)
{
- if ($resolution === Piwik_Tracker_Request::UNKNOWN_RESOLUTION) {
+ if ($resolution === Request::UNKNOWN_RESOLUTION) {
return $resolution;
}
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index da629b1f95..9c9c1a776e 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -15,6 +15,7 @@ use Piwik\Access;
use Piwik\Date;
use Piwik\Site;
use Piwik\Db;
+use Piwik\Tracker\Cache;
/**
* The UsersManager API lets you Manage Users and their permissions to access specific websites.
@@ -393,7 +394,7 @@ class Piwik_UsersManager_API
// we reload the access list which doesn't yet take in consideration this new user
Access::getInstance()->reloadAccess();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
Piwik_PostEvent('UsersManager.addUser', array($userLogin));
}
@@ -450,7 +451,7 @@ class Piwik_UsersManager_API
),
"login = '$userLogin'"
);
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
Piwik_PostEvent('UsersManager.updateUser', array($userLogin));
}
@@ -475,7 +476,7 @@ class Piwik_UsersManager_API
$this->deleteUserOnly($userLogin);
$this->deleteUserAccess($userLogin);
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
}
/**
@@ -572,7 +573,7 @@ class Piwik_UsersManager_API
// we reload the access list which doesn't yet take in consideration this new user access
Access::getInstance()->reloadAccess();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
}
/**
diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php
index 9bc778c6ff..bedf2bb5fb 100644
--- a/plugins/UsersManager/Controller.php
+++ b/plugins/UsersManager/Controller.php
@@ -13,6 +13,7 @@ use Piwik\Controller\Admin;
use Piwik\Piwik;
use Piwik\Common;
use Piwik\Config;
+use Piwik\Tracker\IgnoreCookie;
use Piwik\View;
use Piwik\Url;
use Piwik\Site;
@@ -166,7 +167,7 @@ class Piwik_UsersManager_Controller extends Admin
'year' => Piwik_Translate('General_CurrentYear'),
);
- $view->ignoreCookieSet = Piwik_Tracker_IgnoreCookie::isIgnoreCookieFound();
+ $view->ignoreCookieSet = IgnoreCookie::isIgnoreCookieFound();
$this->initViewAnonymousUserSettings($view);
$view->piwikHost = Url::getCurrentHost();
$this->setBasicVariablesView($view);
@@ -179,7 +180,7 @@ class Piwik_UsersManager_Controller extends Admin
Piwik::checkUserIsNotAnonymous();
$this->checkTokenInUrl();
- Piwik_Tracker_IgnoreCookie::setIgnoreCookie();
+ IgnoreCookie::setIgnoreCookie();
Piwik::redirectToModule('UsersManager', 'userSettings', array('token_auth' => false));
}
diff --git a/tests/LocalTracker.php b/tests/LocalTracker.php
index 321f0171c4..3a7463ece2 100755
--- a/tests/LocalTracker.php
+++ b/tests/LocalTracker.php
@@ -2,6 +2,7 @@
use Piwik\Config;
use Piwik\Tracker;
+use Piwik\Tracker\Cache;
$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
$GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
@@ -43,7 +44,7 @@ class Piwik_LocalTracker extends PiwikTracker
}
// unset cached values
- Piwik_Tracker_Cache::$trackerCache = null;
+ Cache::$trackerCache = null;
Tracker::setForceIp(null);
Tracker::setForceDateTime(null);
Tracker::setForceVisitorId(null);
diff --git a/tests/PHPUnit/Core/DataTableTest.php b/tests/PHPUnit/Core/DataTableTest.php
index 5568c259e2..d8e825ef88 100644
--- a/tests/PHPUnit/Core/DataTableTest.php
+++ b/tests/PHPUnit/Core/DataTableTest.php
@@ -304,12 +304,14 @@ class DataTableTest extends PHPUnit_Framework_TestCase
public function test_unserializeWorks_WhenDataTableFormatPriorPiwik2()
{
+ $serializedDatatable = '';
// Prior Piwik 2.0, we didn't use namespaces. Some
- $oldSerialized = 'O:19:"Piwik_DataTable_Row":1:{s:1:"c";a:3:{i:0;a:8:{s:8:"test_int";i:150;s:10:"test_float";d:150;s:11:"test_float2";d:14.5;
- s:14:"test_stringint";i:150;i:0;s:4:"toto";s:17:"integerArrayToSum";a:3:{i:1;i:6;i:2;d:15.5;i:3;a:2:{i:2;i:7;i:1;i:2;}}s:11:"test_float3";d:1.5;s:4:"test";s:11:"string fake";}i:1;a:2:{s:4:"logo";s:9:"piwik.png";s:5:"super";a:1:{i:0;s:39:"this column has an array value, amazing";}}i:3;N;}}';
-
+ require PIWIK_INCLUDE_PATH . "/tests/resources/pre-Piwik2-DataTable-archived.php";
+ $this->assertTrue(strlen($serializedDatatable) > 1000);
+ $table = unserialize($serializedDatatable);
+ $this->assertTrue($table[0] instanceof \Piwik\DataTable\Row);
}
/**
diff --git a/tests/PHPUnit/Core/ReleaseCheckListTest.php b/tests/PHPUnit/Core/ReleaseCheckListTest.php
index 116ddae02c..1d12346cca 100644
--- a/tests/PHPUnit/Core/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Core/ReleaseCheckListTest.php
@@ -1,6 +1,7 @@
<?php
use Piwik\Piwik;
use Piwik\Common;
+use Piwik\Tracker\Db;
/**
* Piwik - Open source web analytics
@@ -91,7 +92,7 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
public function testProfilingDisabledInProduction()
{
require_once 'Tracker/Db.php';
- $this->assertTrue(Piwik_Tracker_Db::isProfilingEnabled() === false, 'SQL profiler should be disabled in production! See Piwik_Tracker_Db::$profiling');
+ $this->assertTrue(Db::isProfilingEnabled() === false, 'SQL profiler should be disabled in production! See Db::$profiling');
}
/**
diff --git a/tests/PHPUnit/Core/ScheduledTime/DailyTest.php b/tests/PHPUnit/Core/ScheduledTime/DailyTest.php
index 982e19cd12..501e1adb34 100644
--- a/tests/PHPUnit/Core/ScheduledTime/DailyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/DailyTest.php
@@ -5,6 +5,8 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+use Piwik\ScheduledTime\Daily;
+
class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
{
private static $_JANUARY_01_1971_09_00_00;
@@ -24,7 +26,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setHour on Piwik_ScheduledTime_Daily
+ * Tests invalid call to setHour on Daily
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Daily
@@ -32,7 +34,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeDailyNegative()
{
try {
- $dailySchedule = new Piwik_ScheduledTime_Daily();
+ $dailySchedule = new Daily();
$dailySchedule->setHour(-1);
} catch (Exception $e) {
@@ -42,7 +44,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setHour on Piwik_ScheduledTime_Daily
+ * Tests invalid call to setHour on Daily
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Daily
@@ -50,7 +52,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeDailyOver24()
{
try {
- $dailySchedule = new Piwik_ScheduledTime_Daily();
+ $dailySchedule = new Daily();
$dailySchedule->setHour(25);
} catch (Exception $e) {
return;
@@ -59,7 +61,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests forbidden call to setDay on Piwik_ScheduledTime_Daily
+ * Tests forbidden call to setDay on Daily
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Daily
@@ -67,7 +69,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeDaily()
{
try {
- $dailySchedule = new Piwik_ScheduledTime_Daily();
+ $dailySchedule = new Daily();
$dailySchedule->setDay(1);
} catch (Exception $e) {
return;
@@ -76,7 +78,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Daily with unspecified hour
+ * Tests getRescheduledTime on Daily with unspecified hour
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Daily
@@ -93,7 +95,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Saturday January 2 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Daily', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Daily', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_10_00));
@@ -101,7 +103,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Daily with specified hour
+ * Tests getRescheduledTime on Daily with specified hour
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Daily
@@ -118,7 +120,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Saturday January 2 1971 09:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Daily', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Daily', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_00_00));
@@ -135,7 +137,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Saturday January 2 1971 09:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Daily', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Daily', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_12_10_00));
@@ -152,7 +154,7 @@ class ScheduledTime_DailyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Saturday January 2 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Daily', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Daily', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_12_10_00));
diff --git a/tests/PHPUnit/Core/ScheduledTime/HourlyTest.php b/tests/PHPUnit/Core/ScheduledTime/HourlyTest.php
index b0c808fe5e..43b422739f 100644
--- a/tests/PHPUnit/Core/ScheduledTime/HourlyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/HourlyTest.php
@@ -5,6 +5,8 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+use Piwik\ScheduledTime\Hourly;
+
class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
{
private static $_JANUARY_01_1971_09_00_00;
@@ -20,7 +22,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests forbidden call to setHour on Piwik_ScheduledTime_Hourly
+ * Tests forbidden call to setHour on Hourly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Hourly
@@ -28,7 +30,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeHourly()
{
try {
- $hourlySchedule = new Piwik_ScheduledTime_Hourly();
+ $hourlySchedule = new Hourly();
$hourlySchedule->setHour(0);
} catch (Exception $e) {
return;
@@ -37,7 +39,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests forbidden call to setDay on Piwik_ScheduledTime_Hourly
+ * Tests forbidden call to setDay on Hourly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Hourly
@@ -45,7 +47,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeHourly()
{
try {
- $hourlySchedule = new Piwik_ScheduledTime_Hourly();
+ $hourlySchedule = new Hourly();
$hourlySchedule->setDay(1);
} catch (Exception $e) {
return;
@@ -54,7 +56,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Hourly
+ * Tests getRescheduledTime on Hourly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Hourly
@@ -70,7 +72,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Friday January 1 1971 10:00:00 GMT
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Hourly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Hourly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_00_00));
@@ -85,7 +87,7 @@ class ScheduledTime_HourlyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Friday January 1 1971 10:00:00 GMT
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Hourly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Hourly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_10_00));
diff --git a/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php b/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php
index 8bab11da43..00f61917df 100644
--- a/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/MonthlyTest.php
@@ -5,6 +5,8 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+use Piwik\ScheduledTime\Monthly;
+
class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
{
private static $_JANUARY_01_1971_09_00_00;
@@ -32,7 +34,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setHour on Piwik_ScheduledTime_Monthly
+ * Tests invalid call to setHour on Monthly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Monthly
@@ -40,7 +42,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeMonthlyNegative()
{
try {
- $monthlySchedule = new Piwik_ScheduledTime_Monthly();
+ $monthlySchedule = new Monthly();
$monthlySchedule->setHour(-1);
} catch (Exception $e) {
return;
@@ -49,7 +51,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setHour on Piwik_ScheduledTime_Monthly
+ * Tests invalid call to setHour on Monthly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Monthly
@@ -57,7 +59,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimMonthlyOver24()
{
try {
- $monthlySchedule = new Piwik_ScheduledTime_Monthly();
+ $monthlySchedule = new Monthly();
$monthlySchedule->setHour(25);
} catch (Exception $e) {
return;
@@ -66,7 +68,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setDay on Piwik_ScheduledTime_Monthly
+ * Tests invalid call to setDay on Monthly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Monthly
@@ -74,7 +76,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeMonthlyDay0()
{
try {
- $monthlySchedule = new Piwik_ScheduledTime_Monthly();
+ $monthlySchedule = new Monthly();
$monthlySchedule->setDay(0);
} catch (Exception $e) {
return;
@@ -83,7 +85,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setDay on Piwik_ScheduledTime_Monthly
+ * Tests invalid call to setDay on Monthly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Monthly
@@ -91,7 +93,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeMonthlyOver31()
{
try {
- $monthlySchedule = new Piwik_ScheduledTime_Monthly();
+ $monthlySchedule = new Monthly();
$monthlySchedule->setDay(32);
} catch (Exception $e) {
return;
@@ -100,7 +102,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Monthly with unspecified hour and unspecified day
+ * Tests getRescheduledTime on Monthly with unspecified hour and unspecified day
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Monthly
@@ -118,7 +120,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Monday February 1 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Monthly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Monthly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_00_00));
@@ -135,7 +137,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Monday February 1 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Monthly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Monthly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_05_1971_09_00_00));
@@ -144,7 +146,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Monthly with unspecified hour and specified day
+ * Tests getRescheduledTime on Monthly with unspecified hour and specified day
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Monthly
@@ -153,7 +155,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
*/
public function testGetRescheduledTimeMonthlyUnspecifiedHourSpecifiedDay($currentTime, $day, $expected)
{
- $mock = $this->getMock('Piwik_ScheduledTime_Monthly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Monthly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$$currentTime));
@@ -226,7 +228,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
*/
public function testMonthlyDayOfWeek()
{
- $mock = $this->getMock('Piwik_ScheduledTime_Monthly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Monthly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_15_1971_09_00_00));
@@ -246,7 +248,7 @@ class ScheduledTime_MonthlyTest extends PHPUnit_Framework_TestCase
*/
public function testMonthlyDayOfWeekInvalid($day, $week)
{
- $mock = $this->getMock('Piwik_ScheduledTime_Monthly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Monthly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_15_1971_09_00_00));
diff --git a/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php b/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php
index 6812bc90c0..a5a6913db1 100644
--- a/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php
+++ b/tests/PHPUnit/Core/ScheduledTime/WeeklyTest.php
@@ -5,6 +5,8 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+use Piwik\ScheduledTime\Weekly;
+
class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
{
private static $_JANUARY_01_1971_09_10_00;
@@ -26,7 +28,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setHour on Piwik_ScheduledTime_Weekly
+ * Tests invalid call to setHour on Weekly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -34,7 +36,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeWeeklyNegative()
{
try {
- $weeklySchedule = new Piwik_ScheduledTime_Weekly();
+ $weeklySchedule = new Weekly();
$weeklySchedule->setHour(-1);
} catch (Exception $e) {
return;
@@ -43,7 +45,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setHour on Piwik_ScheduledTime_Weekly
+ * Tests invalid call to setHour on Weekly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -51,7 +53,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
public function testSetHourScheduledTimeWeeklyOver24()
{
try {
- $weeklySchedule = new Piwik_ScheduledTime_Weekly();
+ $weeklySchedule = new Weekly();
$weeklySchedule->setHour(25);
} catch (Exception $e) {
return;
@@ -60,7 +62,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setDay on Piwik_ScheduledTime_Weekly
+ * Tests invalid call to setDay on Weekly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -68,7 +70,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeWeeklyDay0()
{
try {
- $weeklySchedule = new Piwik_ScheduledTime_Weekly();
+ $weeklySchedule = new Weekly();
$weeklySchedule->setDay(0);
} catch (Exception $e) {
return;
@@ -77,7 +79,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests invalid call to setDay on Piwik_ScheduledTime_Weekly
+ * Tests invalid call to setDay on Weekly
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -85,7 +87,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
public function testSetDayScheduledTimeWeeklyOver7()
{
try {
- $weeklySchedule = new Piwik_ScheduledTime_Weekly();
+ $weeklySchedule = new Weekly();
$weeklySchedule->setDay(8);
} catch (Exception $e) {
return;
@@ -94,7 +96,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Weekly with unspecified hour and unspecified day
+ * Tests getRescheduledTime on Weekly with unspecified hour and unspecified day
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -112,7 +114,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Monday January 4 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Weekly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Weekly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_10_00));
@@ -120,7 +122,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Weekly with specified hour and unspecified day
+ * Tests getRescheduledTime on Weekly with specified hour and unspecified day
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -138,7 +140,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Monday January 4 1971 09:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Weekly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Weekly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_01_1971_09_10_00));
@@ -147,7 +149,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
}
/**
- * Tests getRescheduledTime on Piwik_ScheduledTime_Weekly with unspecified hour and specified day
+ * Tests getRescheduledTime on Weekly with unspecified hour and specified day
* @group Core
* @group ScheduledTime
* @group ScheduledTime_Weekly
@@ -165,7 +167,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Monday January 11 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Weekly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Weekly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_04_1971_09_00_00));
@@ -183,7 +185,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Monday January 11 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Weekly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Weekly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_05_1971_09_00_00));
@@ -201,7 +203,7 @@ class ScheduledTime_WeeklyTest extends PHPUnit_Framework_TestCase
* Expected :
* getRescheduledTime returns Friday January 15 1971 00:00:00 UTC
*/
- $mock = $this->getMock('Piwik_ScheduledTime_Weekly', array('getTime'));
+ $mock = $this->getMock('\Piwik\ScheduledTime\Weekly', array('getTime'));
$mock->expects($this->any())
->method('getTime')
->will($this->returnValue(self::$_JANUARY_04_1971_09_00_00));
diff --git a/tests/PHPUnit/Core/TaskSchedulerTest.php b/tests/PHPUnit/Core/TaskSchedulerTest.php
index 88db5b2db4..ae6a80ba4b 100644
--- a/tests/PHPUnit/Core/TaskSchedulerTest.php
+++ b/tests/PHPUnit/Core/TaskSchedulerTest.php
@@ -6,6 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
use Piwik\EventDispatcher;
+use Piwik\ScheduledTime\Daily;
use Piwik\TaskScheduler;
use Piwik\ScheduledTask;
@@ -179,7 +180,7 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
$this->assertNotEmpty($executeTask->invoke(
new TaskScheduler(),
- new ScheduledTask ($mock, $methodName, $parameterValue, new Piwik_ScheduledTime_Daily())
+ new ScheduledTask ($mock, $methodName, $parameterValue, new Daily())
));
}
@@ -190,7 +191,7 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
{
$systemTime = time();
- $dailySchedule = $this->getMock('Piwik_ScheduledTime_Daily', array('getTime'));
+ $dailySchedule = $this->getMock('\Piwik\ScheduledTime\Daily', array('getTime'));
$dailySchedule->expects($this->any())
->method('getTime')
->will($this->returnValue($systemTime));
diff --git a/tests/PHPUnit/Core/Tracker/ActionTest.php b/tests/PHPUnit/Core/Tracker/ActionTest.php
index 95a8fee7b4..f04bfafea5 100644
--- a/tests/PHPUnit/Core/Tracker/ActionTest.php
+++ b/tests/PHPUnit/Core/Tracker/ActionTest.php
@@ -1,6 +1,8 @@
<?php
use Piwik\Config;
use Piwik\Access;
+use Piwik\Tracker\Action;
+use Piwik\Tracker\Request;
use Piwik\Translate;
/**
@@ -115,7 +117,7 @@ class Tracker_ActionTest extends DatabaseTestCase
$siteSearch = 1, $searchKeywordParameters = null, $searchCategoryParameters = null,
$excludedIps = '', $excludedQueryParameters = '', $timezone = null, $currency = null,
$group = null, $startDate = null, $excludedUserAgents = null, $keepURLFragments = 1);
- $this->assertEquals($filteredUrl[0], Piwik_Tracker_Action::excludeQueryParametersFromUrl($url, $idSite));
+ $this->assertEquals($filteredUrl[0], Action::excludeQueryParametersFromUrl($url, $idSite));
}
public function getTestUrlsHashtag()
@@ -140,7 +142,7 @@ class Tracker_ActionTest extends DatabaseTestCase
*/
public function testRemoveTrailingHashtag($url, $expectedUrl)
{
- $this->assertEquals(Piwik_Tracker_Action::reconstructNormalizedUrl($url, Piwik_Tracker_Action::$urlPrefixMap['http://']), $expectedUrl);
+ $this->assertEquals(Action::reconstructNormalizedUrl($url, Action::$urlPrefixMap['http://']), $expectedUrl);
}
@@ -159,7 +161,7 @@ class Tracker_ActionTest extends DatabaseTestCase
$siteSearch = 1, $searchKeywordParameters = null, $searchCategoryParameters = null,
$excludedIps = '', $excludedQueryParameters, $timezone = null, $currency = null,
$group = null, $startDate = null, $excludedUserAgents = null, $keepURLFragments = 1);
- $this->assertEquals($filteredUrl[1], Piwik_Tracker_Action::excludeQueryParametersFromUrl($url, $idSite));
+ $this->assertEquals($filteredUrl[1], Action::excludeQueryParametersFromUrl($url, $idSite));
}
/**
@@ -180,7 +182,7 @@ class Tracker_ActionTest extends DatabaseTestCase
$excludedIps = '', $excludedQueryParameters, $timezone = null, $currency = null,
$group = null, $startDate = null, $excludedUserAgents = null, $keepURLFragments = 1);
Piwik_SitesManager_API::getInstance()->setGlobalExcludedQueryParameters($excludedGlobalParameters);
- $this->assertEquals($filteredUrl[1], Piwik_Tracker_Action::excludeQueryParametersFromUrl($url, $idSite));
+ $this->assertEquals($filteredUrl[1], Action::excludeQueryParametersFromUrl($url, $idSite));
}
@@ -192,21 +194,21 @@ class Tracker_ActionTest extends DatabaseTestCase
'request' => array('link' => 'http://example.org'),
'expected' => array('name' => null,
'url' => 'http://example.org',
- 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ 'type' => Action::TYPE_OUTLINK),
),
// outlinks with custom name
array(
'request' => array('link' => 'http://example.org', 'action_name' => 'Example.org'),
'expected' => array('name' => 'Example.org',
'url' => 'http://example.org',
- 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ 'type' => Action::TYPE_OUTLINK),
),
// keep the case in urls, but trim
array(
'request' => array('link' => ' http://example.org/Category/Test/ '),
'expected' => array('name' => null,
'url' => 'http://example.org/Category/Test/',
- 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ 'type' => Action::TYPE_OUTLINK),
),
// trim the custom name
@@ -214,7 +216,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'request' => array('link' => ' http://example.org/Category/Test/ ', 'action_name' => ' Example dot org '),
'expected' => array('name' => 'Example dot org',
'url' => 'http://example.org/Category/Test/',
- 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ 'type' => Action::TYPE_OUTLINK),
),
// downloads
@@ -222,7 +224,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'request' => array('download' => 'http://example.org/*$test.zip'),
'expected' => array('name' => null,
'url' => 'http://example.org/*$test.zip',
- 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ 'type' => Action::TYPE_DOWNLOAD),
),
// downloads with custom name
@@ -230,7 +232,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'request' => array('download' => 'http://example.org/*$test.zip', 'action_name' => 'Download test.zip'),
'expected' => array('name' => 'Download test.zip',
'url' => 'http://example.org/*$test.zip',
- 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ 'type' => Action::TYPE_DOWNLOAD),
),
// keep the case and multiple / in urls
@@ -238,7 +240,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'request' => array('download' => 'http://example.org/CATEGORY/test///test.pdf'),
'expected' => array('name' => null,
'url' => 'http://example.org/CATEGORY/test///test.pdf',
- 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ 'type' => Action::TYPE_DOWNLOAD),
),
// page view
@@ -246,71 +248,71 @@ class Tracker_ActionTest extends DatabaseTestCase
'request' => array('url' => 'http://example.org/'),
'expected' => array('name' => null,
'url' => 'http://example.org/',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('url' => 'http://example.org/', 'action_name' => 'Example.org Website'),
'expected' => array('name' => 'Example.org Website',
'url' => 'http://example.org/',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('url' => 'http://example.org/CATEGORY/'),
'expected' => array('name' => null,
'url' => 'http://example.org/CATEGORY/',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('url' => 'http://example.org/CATEGORY/TEST', 'action_name' => 'Example.org / Category / test /'),
'expected' => array('name' => 'Example.org/Category/test',
'url' => 'http://example.org/CATEGORY/TEST',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('url' => 'http://example.org/?2,123'),
'expected' => array('name' => null,
'url' => 'http://example.org/?2,123',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// empty request
array(
'request' => array(),
'expected' => array('name' => null, 'url' => '',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('name' => null, 'url' => "\n"),
'expected' => array('name' => null, 'url' => '',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('url' => 'http://example.org/category/',
'action_name' => 'custom name with/one delimiter/two delimiters/'),
'expected' => array('name' => 'custom name with/one delimiter/two delimiters',
'url' => 'http://example.org/category/',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
array(
'request' => array('url' => 'http://example.org/category/',
'action_name' => 'http://custom action name look like url/'),
'expected' => array('name' => 'http:/custom action name look like url',
'url' => 'http://example.org/category/',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: delete tab, trimmed, not strtolowered
array(
'request' => array('url' => "http://example.org/category/test///test wOw "),
'expected' => array('name' => null,
'url' => 'http://example.org/category/test///test wOw',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: inclusion of zero values in action name
array(
'request' => array('url' => "http://example.org/category/1/0/t/test"),
'expected' => array('name' => null,
'url' => 'http://example.org/category/1/0/t/test',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: action name ("Test &hellip;") - expect decoding of some html entities
array(
@@ -318,7 +320,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'action_name' => "Test &hellip;"),
'expected' => array('name' => 'Test …',
'url' => 'http://example.org/ACTION/URL',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: action name ("Special &amp; chars") - expect no conversion of html special chars
array(
@@ -326,7 +328,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'action_name' => "Special &amp; chars"),
'expected' => array('name' => 'Special &amp; chars',
'url' => 'http://example.org/ACTION/URL',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: action name ("Tést") - handle wide character
array(
@@ -334,7 +336,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'action_name' => "Tést"),
'expected' => array('name' => 'Tést',
'url' => 'http://example.org/ACTION/URL',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: action name ("Tést") - handle UTF-8 byte sequence
array(
@@ -342,7 +344,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'action_name' => "T\xc3\xa9st"),
'expected' => array('name' => 'Tést',
'url' => 'http://example.org/ACTION/URL',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
// testing: action name ("Tést") - invalid UTF-8 (e.g., ISO-8859-1) is not handled
array(
@@ -350,7 +352,7 @@ class Tracker_ActionTest extends DatabaseTestCase
'action_name' => "T\xe9st"),
'expected' => array('name' => version_compare(PHP_VERSION, '5.2.5') === -1 ? 'T\xe9st' : 'Tést',
'url' => 'http://example.org/ACTION/URL',
- 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'type' => Action::TYPE_ACTION_URL),
),
);
}
@@ -366,14 +368,14 @@ class Tracker_ActionTest extends DatabaseTestCase
$this->setUpRootAccess();
$idSite = Piwik_SitesManager_API::getInstance()->addSite("site1", array('http://example.org'));
$request['idsite'] = $idSite;
- $request = new Piwik_Tracker_Request($request);
+ $request = new Request($request);
$action = new Test_Piwik_TrackerAction_extractUrlAndActionNameFromRequest($request);
$this->assertEquals($action->public_extractUrlAndActionNameFromRequest(), $expected);
}
}
-class Test_Piwik_TrackerAction_extractUrlAndActionNameFromRequest extends Piwik_Tracker_Action
+class Test_Piwik_TrackerAction_extractUrlAndActionNameFromRequest extends Action
{
public function public_extractUrlAndActionNameFromRequest()
{
diff --git a/tests/PHPUnit/Core/Tracker/VisitTest.php b/tests/PHPUnit/Core/Tracker/VisitTest.php
index 23eed1d310..dd5490f2ff 100644
--- a/tests/PHPUnit/Core/Tracker/VisitTest.php
+++ b/tests/PHPUnit/Core/Tracker/VisitTest.php
@@ -7,6 +7,8 @@
*/
use Piwik\Access;
use Piwik\IP;
+use Piwik\Tracker\VisitExcluded;
+use Piwik\Tracker\Request;
class Tracker_VisitTest extends DatabaseTestCase
{
@@ -75,13 +77,13 @@ class Tracker_VisitTest extends DatabaseTestCase
$idsite = Piwik_SitesManager_API::getInstance()->addSite("name", "http://piwik.net/", $ecommerce = 0,
$siteSearch = 1, $searchKeywordParameters = null, $searchCategoryParameters = null, $excludedIp);
- $request = new Piwik_Tracker_Request(array('idsite' => $idsite));
+ $request = new Request(array('idsite' => $idsite));
// test that IPs within the range, or the given IP, are excluded
foreach ($tests as $ip => $expected) {
$testIpIsExcluded = IP::P2N($ip);
- $excluded = new Test_Piwik_Tracker_VisitExcluded_public($request, $testIpIsExcluded);
+ $excluded = new VisitExcluded_public($request, $testIpIsExcluded);
$this->assertSame($expected, $excluded->public_isVisitorIpExcluded($testIpIsExcluded));
}
}
@@ -126,18 +128,18 @@ class Tracker_VisitTest extends DatabaseTestCase
$excludedQueryParameters = null, $timezone = null, $currency = null, $group = null, $startDate = null,
$excludedUserAgent);
- $request = new Piwik_Tracker_Request(array('idsite' => $idsite));
+ $request = new Request(array('idsite' => $idsite));
// test that user agents that contain excluded user agent strings are excluded
foreach ($tests as $ua => $expected) {
- $excluded = new Test_Piwik_Tracker_VisitExcluded_public($request, $ip = false, $ua);
+ $excluded = new VisitExcluded_public($request, $ip = false, $ua);
$this->assertSame($expected, $excluded->public_isUserAgentExcluded($ua), "Result if isUserAgentExcluded('$ua') was not " . ($expected ? 'true' : 'false') . ".");
}
}
}
-class Test_Piwik_Tracker_VisitExcluded_public extends Piwik_Tracker_VisitExcluded
+class VisitExcluded_public extends VisitExcluded
{
public function public_isVisitorIpExcluded($ip)
{
diff --git a/tests/PHPUnit/Core/UnzipTest.php b/tests/PHPUnit/Core/UnzipTest.php
index 221c420991..a0865e6e46 100644
--- a/tests/PHPUnit/Core/UnzipTest.php
+++ b/tests/PHPUnit/Core/UnzipTest.php
@@ -6,6 +6,10 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
use Piwik\Unzip;
+use Piwik\Unzip\Gzip;
+use Piwik\Unzip\PclZip;
+use Piwik\Unzip\ZipArchive;
+use Piwik\Unzip\Tar;
class UnzipTest extends PHPUnit_Framework_TestCase
{
@@ -29,7 +33,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$this->assertFileNotExists(dirname(__FILE__) . '/../../tests/' . $test . '.txt');
unlink($extractDir . $test . '.txt');
- $unzip = new Piwik_Unzip_ZipArchive($filename);
+ $unzip = new ZipArchive($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(1, count($res));
$this->assertFileExists($extractDir . $test . '.txt');
@@ -46,7 +50,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$this->assertFileNotExists(dirname(__FILE__) . '/../../tests/' . $test . '.txt');
unlink($extractDir . $test . '.txt');
- $unzip = new Piwik_Unzip_PclZip($filename);
+ $unzip = new PclZip($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(1, count($res));
$this->assertFileExists($extractDir . $test . '.txt');
@@ -67,7 +71,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$filename = dirname(__FILE__) . '/Unzip/' . $test . '.zip';
if (class_exists('ZipArchive', false)) {
- $unzip = new Piwik_Unzip_ZipArchive($filename);
+ $unzip = new ZipArchive($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(0, $res);
$this->assertFileNotExists($extractDir . $test . '.txt');
@@ -77,7 +81,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$this->assertFileNotExists(dirname(__FILE__) . '/../../' . $test . '.txt');
}
- $unzip = new Piwik_Unzip_PclZip($filename);
+ $unzip = new PclZip($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(0, $res);
$this->assertFileNotExists($extractDir . $test . '.txt');
@@ -99,14 +103,14 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$filename = dirname(__FILE__) . '/Unzip/' . $test . '.zip';
if (class_exists('ZipArchive', false)) {
- $unzip = new Piwik_Unzip_ZipArchive($filename);
+ $unzip = new ZipArchive($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(0, $res);
$this->assertFileNotExists($extractDir . $test . '.txt');
$this->assertFileNotExists(dirname(__FILE__) . '/' . $test . '.txt');
}
- $unzip = new Piwik_Unzip_PclZip($filename);
+ $unzip = new PclZip($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(0, $res);
$this->assertFileNotExists($extractDir . $test . '.txt');
@@ -123,7 +127,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$filename = dirname(__FILE__) . '/Unzip/zaabs.zip';
$extractDir = PIWIK_USER_PATH . '/tmp/latest/';
- $unzip = new Piwik_Unzip_ZipArchive($filename);
+ $unzip = new ZipArchive($filename);
$this->assertContains('No error', $unzip->errorInfo());
}
@@ -137,7 +141,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$filename = dirname(__FILE__) . '/Unzip/empty.zip';
$extractDir = PIWIK_USER_PATH . '/tmp/latest/';
- $unzip = new Piwik_Unzip_ZipArchive($filename);
+ $unzip = new ZipArchive($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(0, $res);
}
@@ -152,7 +156,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$filename = dirname(__FILE__) . '/Unzip/NotExisting.zip';
try {
- $unzip = new Piwik_Unzip_ZipArchive($filename);
+ $unzip = new ZipArchive($filename);
} catch (Exception $e) {
return;
}
@@ -169,7 +173,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$extractDir = PIWIK_USER_PATH . '/tmp/latest/';
$filename = dirname(__FILE__) . '/Unzip/NotExisting.zip';
- $unzip = new Piwik_Unzip_PclZip($filename);
+ $unzip = new PclZip($filename);
$res = $unzip->extract($extractDir);
$this->assertEquals(0, $res);
@@ -186,7 +190,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$extractFile = $extractDir . 'testgz.txt';
$filename = dirname(__FILE__) . '/Unzip/test.gz';
- $unzip = new Piwik_Unzip_Gzip($filename);
+ $unzip = new Gzip($filename);
$res = $unzip->extract($extractFile);
$this->assertTrue($res);
@@ -202,7 +206,7 @@ class UnzipTest extends PHPUnit_Framework_TestCase
$extractDir = PIWIK_USER_PATH . '/tmp/latest/';
$filename = dirname(__FILE__) . '/Unzip/test.tar.gz';
- $unzip = new Piwik_Unzip_Tar($filename, 'gz');
+ $unzip = new Tar($filename, 'gz');
$res = $unzip->extract($extractDir);
$this->assertTrue($res);
diff --git a/tests/PHPUnit/Core/UrlTest.php b/tests/PHPUnit/Core/UrlTest.php
index 12fb22033c..334edef1ca 100644
--- a/tests/PHPUnit/Core/UrlTest.php
+++ b/tests/PHPUnit/Core/UrlTest.php
@@ -116,7 +116,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
// mangled HTTP_HOST
array('www.example.com', 'http://example.com/path/#anchor', '/path/index.php', 'http://example.com/path/referrer', true),
- // suppressed Referer
+ // suppressed Referrer
array('www.example.com', 'http://www.example.com/path/#anchor', '/path/index.php', null, true),
array('www.example.com', 'http://www.example.com/path/#anchor', '/path/index.php', '', true),
diff --git a/tests/PHPUnit/DatabaseTestCase.php b/tests/PHPUnit/DatabaseTestCase.php
index b2144d5c15..47a34f8bbe 100644
--- a/tests/PHPUnit/DatabaseTestCase.php
+++ b/tests/PHPUnit/DatabaseTestCase.php
@@ -11,6 +11,7 @@ use Piwik\DataTable\Manager;
use Piwik\Piwik;
use Piwik\Option;
use Piwik\Site;
+use Piwik\Tracker\Cache;
/**
* Tests extending DatabaseTestCase are much slower to run: the setUp will
@@ -72,7 +73,7 @@ class DatabaseTestCase extends PHPUnit_Framework_TestCase
Option::getInstance()->clearCache();
Piwik_PDFReports_API::$cache = array();
Site::clearCache();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
Config::getInstance()->clear();
ArchiveTableCreator::clear();
\Zend_Registry::_unsetInstance();
diff --git a/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php b/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php
index b1f7828610..2284a14aa9 100644
--- a/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php
+++ b/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php
@@ -6,6 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
use Piwik\Date;
+use Piwik\Tracker\Visit;
/**
* Adds one site and tracks a couple visits using a custom visitor ID.
@@ -44,14 +45,14 @@ class Test_Piwik_Fixture_FewVisitsWithSetVisitorId extends Test_Piwik_BaseFixtur
// We create VISITOR A
$t->setUrl('http://example.org/index.htm');
- $t->setVisitorId(Piwik_Tracker_Visit::generateUniqueVisitorId());
+ $t->setVisitorId(Visit::generateUniqueVisitorId());
self::checkResponse($t->doTrackPageView('incredible title!'));
// VISITOR B: few minutes later, we trigger the same tracker but with a custom visitor ID,
// => this will create a new visit B
$t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.05)->getDatetime());
$t->setUrl('http://example.org/index2.htm');
- $t->setVisitorId(Piwik_Tracker_Visit::generateUniqueVisitorId());
+ $t->setVisitorId(Visit::generateUniqueVisitorId());
self::checkResponse($t->doTrackPageView('incredible title!'));
// This new visit B will have 2 page views
diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php
index 1fc9dfe5aa..4e6b18cbfc 100755
--- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php
+++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php
@@ -80,7 +80,7 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchVisitorTyp
// We expect 2 segments * (1 custom variable name + 2 ref metrics + 6 subtable for the values of the name + 5 referers blob)
'archive_blob_2009_12' => 30,
// 6 metrics,
- // 2 Referer metrics (Referers_distinctSearchEngines/Referers_distinctKeywords),
+ // 2 Referrer metrics (Referers_distinctSearchEngines/Referers_distinctKeywords),
// 3 done flag (referers, CustomVar, VisitsSummary),
// X * 2 segments
'archive_numeric_2009_12' => (6 + 2 + 3) * 2,
diff --git a/tests/PHPUnit/Integration/UrlNormalizationTest.php b/tests/PHPUnit/Integration/UrlNormalizationTest.php
index db1931a31e..7e8d4fa7a1 100644
--- a/tests/PHPUnit/Integration/UrlNormalizationTest.php
+++ b/tests/PHPUnit/Integration/UrlNormalizationTest.php
@@ -1,5 +1,6 @@
<?php
use Piwik\Common;
+use Piwik\Tracker\Action;
/**
* Tests the URL normalization.
@@ -91,7 +92,7 @@ class Test_Piwik_Integration_UrlNormalization extends IntegrationTestCase
$this->assertEquals($expected, $count, "only $expected actions expected");
$sql = "SELECT name, url_prefix FROM " . Common::prefixTable('log_action')
- . " WHERE type = " . Piwik_Tracker_Action::TYPE_ACTION_URL
+ . " WHERE type = " . Action::TYPE_ACTION_URL
. " ORDER BY idaction ASC";
$urls = \Zend_Registry::get('db')->fetchAll($sql);
$expected = array(
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index 12cbf5574d..0fdb16c32d 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -19,6 +19,7 @@ use Piwik\Access;
use Piwik\Option;
use Piwik\ReportRenderer;
use Piwik\Site;
+use Piwik\Tracker\Cache;
use Piwik\Translate;
use Piwik\Db;
use Piwik\Visualization\Cloud;
@@ -185,7 +186,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
// We need to be SU to create websites for tests
Piwik::setUserIsSuperUser();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
if ($installPlugins === null) $installPlugins = $createEmptyDatabase;
self::installAndLoadPlugins( $installPlugins);
@@ -234,7 +235,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
Manager::getInstance()->deleteAll();
Option::getInstance()->clearCache();
Site::clearCache();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
Config::getInstance()->clear();
ArchiveTableCreator::clear();
Piwik_PDFReports_API::$cache = array();
diff --git a/tests/PHPUnit/Plugins/ActionsTest.php b/tests/PHPUnit/Plugins/ActionsTest.php
index cf89fe5317..c6c3465fa9 100644
--- a/tests/PHPUnit/Plugins/ActionsTest.php
+++ b/tests/PHPUnit/Plugins/ActionsTest.php
@@ -5,6 +5,7 @@
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
+use Piwik\Tracker\Action;
use Piwik\Translate;
require_once 'Actions/Actions.php';
@@ -25,83 +26,83 @@ class ActionsTests extends PHPUnit_Framework_TestCase
{
return array(
array(
- 'params' => array('name' => 'http://example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => null),
+ 'params' => array('name' => 'http://example.org/', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => null),
'expected' => array('/index'),
),
array(
- 'params' => array('name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 1),
+ 'params' => array('name' => 'example.org/', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 1),
'expected' => array('/index'),
),
array(
- 'params' => array('name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 2),
+ 'params' => array('name' => 'example.org/', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 2),
'expected' => array('/index'),
),
array(
- 'params' => array('name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 3),
+ 'params' => array('name' => 'example.org/', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 3),
'expected' => array('/index'),
),
array(
- 'params' => array('name' => 'example.org/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 4),
+ 'params' => array('name' => 'example.org/', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 4),
'expected' => array('/index'),
),
array(
- 'params' => array('name' => 'example.org/path/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 4),
+ 'params' => array('name' => 'example.org/path/', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 4),
'expected' => array('path', '/index'),
),
array(
- 'params' => array('name' => 'example.org/test/path', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 1),
+ 'params' => array('name' => 'example.org/test/path', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 1),
'expected' => array('test', '/path'),
),
array(
- 'params' => array('name' => 'http://example.org/path/', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array('name' => 'http://example.org/path/', 'type' => Action::TYPE_ACTION_URL),
'expected' => array('path', '/index'),
),
array(
- 'params' => array('name' => 'example.org/test/path', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL, 'urlPrefix' => 1),
+ 'params' => array('name' => 'example.org/test/path', 'type' => Action::TYPE_ACTION_URL, 'urlPrefix' => 1),
'expected' => array('test', '/path'),
),
array(
- 'params' => array('name' => 'Test / Path', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array('name' => 'Test / Path', 'type' => Action::TYPE_ACTION_URL),
'expected' => array('Test', '/Path'),
),
array(
- 'params' => array('name' => ' Test trim ', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array('name' => ' Test trim ', 'type' => Action::TYPE_ACTION_URL),
'expected' => array('/Test trim'),
),
array(
- 'params' => array('name' => 'Category / Subcategory', 'type' => Piwik_Tracker_Action::TYPE_ACTION_NAME),
+ 'params' => array('name' => 'Category / Subcategory', 'type' => Action::TYPE_ACTION_NAME),
'expected' => array('Category', ' Subcategory'),
),
array(
- 'params' => array('name' => '/path/index.php?var=test', 'type' => Piwik_Tracker_Action::TYPE_ACTION_NAME),
+ 'params' => array('name' => '/path/index.php?var=test', 'type' => Action::TYPE_ACTION_NAME),
'expected' => array('path', ' index.php?var=test'),
),
array(
- 'params' => array('name' => 'http://example.org/path/Default.aspx#anchor', 'type' => Piwik_Tracker_Action::TYPE_ACTION_NAME),
+ 'params' => array('name' => 'http://example.org/path/Default.aspx#anchor', 'type' => Action::TYPE_ACTION_NAME),
'expected' => array('path', ' Default.aspx#anchor'),
),
array(
- 'params' => array('name' => '', 'type' => Piwik_Tracker_Action::TYPE_ACTION_NAME),
+ 'params' => array('name' => '', 'type' => Action::TYPE_ACTION_NAME),
'expected' => array('Page Name not defined'),
),
array(
- 'params' => array('name' => '', 'type' => Piwik_Tracker_Action::TYPE_ACTION_URL),
+ 'params' => array('name' => '', 'type' => Action::TYPE_ACTION_URL),
'expected' => array('Page URL not defined'),
),
array(
- 'params' => array('name' => 'http://example.org/download.zip', 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ 'params' => array('name' => 'http://example.org/download.zip', 'type' => Action::TYPE_DOWNLOAD),
'expected' => array('example.org', '/download.zip'),
),
array(
- 'params' => array('name' => 'http://example.org/download/1/', 'type' => Piwik_Tracker_Action::TYPE_DOWNLOAD),
+ 'params' => array('name' => 'http://example.org/download/1/', 'type' => Action::TYPE_DOWNLOAD),
'expected' => array('example.org', '/download/1/'),
),
array(
- 'params' => array('name' => 'http://example.org/link', 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ 'params' => array('name' => 'http://example.org/link', 'type' => Action::TYPE_OUTLINK),
'expected' => array('example.org', '/link'),
),
array(
- 'params' => array('name' => 'http://example.org/some/path/', 'type' => Piwik_Tracker_Action::TYPE_OUTLINK),
+ 'params' => array('name' => 'http://example.org/some/path/', 'type' => Action::TYPE_OUTLINK),
'expected' => array('example.org', '/some/path/'),
),
);
diff --git a/tests/PHPUnit/Plugins/PDFReportsTest.php b/tests/PHPUnit/Plugins/PDFReportsTest.php
index cc61ddf161..85b32a89c9 100644
--- a/tests/PHPUnit/Plugins/PDFReportsTest.php
+++ b/tests/PHPUnit/Plugins/PDFReportsTest.php
@@ -8,6 +8,8 @@
use Piwik\Access;
use Piwik\ScheduledTime;
use Piwik\ScheduledTask;
+use Piwik\ScheduledTime\Daily;
+use Piwik\ScheduledTime\Monthly;
use Piwik\Site;
require_once 'PDFReports/PDFReports.php';
@@ -365,16 +367,16 @@ class PDFReportsTest extends DatabaseTestCase
);
// expected tasks
- $scheduleTask1 = new Piwik_ScheduledTime_Daily();
+ $scheduleTask1 = new Daily();
$scheduleTask1->setHour(23); // paris is UTC-1, period ends at 23h UTC
- $scheduleTask2 = new Piwik_ScheduledTime_Monthly();
+ $scheduleTask2 = new Monthly();
$scheduleTask2->setHour(7); // site is UTC-6.5, period ends at 6h30 UTC, smallest resolution is hour
- $scheduleTask3 = new Piwik_ScheduledTime_Monthly();
+ $scheduleTask3 = new Monthly();
$scheduleTask3->setHour(7); // paris is UTC-1, configured to be sent at 8h
- $scheduleTask4 = new Piwik_ScheduledTime_Monthly();
+ $scheduleTask4 = new Monthly();
$scheduleTask4->setHour(15); // site is UTC-6.5, configured to be sent at 8h
$expectedTasks = array(
diff --git a/tests/PHPUnit/Plugins/PrivacyManagerTest.php b/tests/PHPUnit/Plugins/PrivacyManagerTest.php
index 4d44c6464f..17ca9d2c8c 100755
--- a/tests/PHPUnit/Plugins/PrivacyManagerTest.php
+++ b/tests/PHPUnit/Plugins/PrivacyManagerTest.php
@@ -16,6 +16,8 @@ use Piwik\Date;
use Piwik\Option;
use Piwik\Site;
use Piwik\Db;
+use Piwik\Tracker\Cache;
+use Piwik\Tracker\GoalManager;
require_once 'PrivacyManager/PrivacyManager.php';
@@ -115,7 +117,7 @@ class PrivacyManagerTest extends IntegrationTestCase
Manager::getInstance()->deleteAll();
Option::getInstance()->clearCache();
Site::clearCache();
- Piwik_Tracker_Cache::deleteTrackerCache();
+ Cache::deleteTrackerCache();
ArchiveTableCreator::clear();
$tempTableName = Common::prefixTable(Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME);
@@ -718,7 +720,7 @@ class PrivacyManagerTest extends IntegrationTestCase
'nb_actions',
Piwik_Goals_Archiver::getRecordName('revenue'),
Piwik_Goals_Archiver::getRecordName('nb_conversions', 1),
- Piwik_Goals_Archiver::getRecordName('revenue', Piwik_Tracker_GoalManager::IDGOAL_ORDER)
+ Piwik_Goals_Archiver::getRecordName('revenue', GoalManager::IDGOAL_ORDER)
);
$archiveTables = self::_getArchiveTableNames();
diff --git a/tests/PHPUnit/proxy/index.php b/tests/PHPUnit/proxy/index.php
index ce08221128..12f5e0b2a9 100644
--- a/tests/PHPUnit/proxy/index.php
+++ b/tests/PHPUnit/proxy/index.php
@@ -5,6 +5,7 @@
*/
// make sure the test environment is loaded
+use Piwik\Tracker\Cache;
use Piwik\Visualization\Cloud;
// Wrapping the request inside ob_start() calls to ensure that the Test
@@ -25,7 +26,7 @@ Piwik_TestingEnvironment::addHooks();
Cloud::$debugDisableShuffle = true;
\Piwik\Tracker::setTestEnvironment();
-Piwik_Tracker_Cache::deleteTrackerCache();
+Cache::deleteTrackerCache();
// Disable index.php dispatch since we do it manually below
define('PIWIK_ENABLE_DISPATCH', false);
diff --git a/tests/PHPUnit/proxy/piwik.php b/tests/PHPUnit/proxy/piwik.php
index 8610ef8b4d..2a72cfbd88 100755
--- a/tests/PHPUnit/proxy/piwik.php
+++ b/tests/PHPUnit/proxy/piwik.php
@@ -16,6 +16,7 @@ use Piwik\DataTable\Manager;
use Piwik\Option;
use Piwik\Tracker;
use Piwik\Site;
+use Piwik\Tracker\Cache;
ob_start();
@@ -44,7 +45,7 @@ Tracker::setTestEnvironment();
Manager::getInstance()->deleteAll();
Option::getInstance()->clearCache();
Site::clearCache();
-Piwik_Tracker_Cache::deleteTrackerCache();
+Cache::deleteTrackerCache();
include PIWIK_INCLUDE_PATH . '/piwik.php';
ob_end_flush();