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

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2016-09-01 09:28:13 +0300
committerGitHub <noreply@github.com>2016-09-01 09:28:13 +0300
commit9efc7341f98058bbe37f70d0a93e9ea47d7caf4c (patch)
tree7373a34dc9dc8850f70c315d597933e3f03f0766 /plugins
parentca0bc1077618db213ffa2e83959c2c47cec9357e (diff)
Remove deprecated events (#10455)
* remove some deprecated events * fix unit tests wants to establish a DB connection, read it from cache * fix possible bug * fix some integration tests * fix tests * fix category was not set * fix some tests * fix integration test * trying to fix pivot tests * add new events * update submodule
Diffstat (limited to 'plugins')
-rw-r--r--plugins/API/SegmentMetadata.php48
-rw-r--r--plugins/CoreVisualizations/CoreVisualizations.php5
m---------plugins/CustomDimensions0
-rw-r--r--plugins/CustomVariables/Columns/Base.php26
-rw-r--r--plugins/CustomVariables/Columns/CustomVariableName.php1
-rw-r--r--plugins/CustomVariables/Columns/CustomVariableValue.php1
-rw-r--r--plugins/CustomVariables/CustomVariables.php52
-rw-r--r--plugins/CustomVariables/Segment.php21
-rw-r--r--plugins/CustomVariables/tests/Integration/CustomVariablesTest.php7
-rw-r--r--plugins/Goals/Goals.php66
-rw-r--r--plugins/Login/SessionInitializer.php39
11 files changed, 69 insertions, 197 deletions
diff --git a/plugins/API/SegmentMetadata.php b/plugins/API/SegmentMetadata.php
index 4be514978c..fbe73a774f 100644
--- a/plugins/API/SegmentMetadata.php
+++ b/plugins/API/SegmentMetadata.php
@@ -27,54 +27,6 @@ class SegmentMetadata
}
}
- /**
- * Triggered when gathering all available segment dimensions.
- *
- * This event can be used to make new segment dimensions available.
- *
- * **Example**
- *
- * public function getSegmentsMetadata(&$segments, $idSites)
- * {
- * $segments[] = array(
- * 'type' => 'dimension',
- * 'category' => Piwik::translate('General_Visit'),
- * 'name' => 'General_VisitorIP',
- * 'segment' => 'visitIp',
- * 'acceptedValues' => '13.54.122.1, etc.',
- * 'sqlSegment' => 'log_visit.location_ip',
- * 'sqlFilter' => array('Piwik\IP', 'P2N'),
- * 'permission' => $isAuthenticatedWithViewAccess,
- * );
- * }
- *
- * @param array &$dimensions The list of available segment dimensions. Append to this list to add
- * new segments. Each element in this list must contain the
- * following information:
- *
- * - **type**: Either `'metric'` or `'dimension'`. `'metric'` means
- * the value is a numeric and `'dimension'` means it is
- * a string. Also, `'metric'` values will be displayed
- * under **Visit (metrics)** in the Segment Editor.
- * - **category**: The segment category name. This can be an existing
- * segment category visible in the segment editor.
- * - **name**: The pretty name of the segment. Can be a translation token.
- * - **segment**: The segment name, eg, `'visitIp'` or `'searches'`.
- * - **acceptedValues**: A string describing one or two exacmple values, eg
- * `'13.54.122.1, etc.'`.
- * - **sqlSegment**: The table column this segment will segment by.
- * For example, `'log_visit.location_ip'` for the
- * **visitIp** segment.
- * - **sqlFilter**: A PHP callback to apply to segment values before
- * they are used in SQL.
- * - **permission**: True if the current user has view access to this
- * segment, false if otherwise.
- * @param array $idSites The list of site IDs we're getting the available segments
- * for. Some segments (such as Goal segments) depend on the
- * site.
- */
- Piwik::postEvent('API.getSegmentDimensionMetadata', array(&$segments, $idSites));
-
$segments[] = array(
'type' => 'dimension',
'category' => Piwik::translate('General_Visit'),
diff --git a/plugins/CoreVisualizations/CoreVisualizations.php b/plugins/CoreVisualizations/CoreVisualizations.php
index 0aec35fb3e..b832903228 100644
--- a/plugins/CoreVisualizations/CoreVisualizations.php
+++ b/plugins/CoreVisualizations/CoreVisualizations.php
@@ -9,7 +9,6 @@
namespace Piwik\Plugins\CoreVisualizations;
-use Piwik\Common;
use Piwik\ViewDataTable\Manager as ViewDataTableManager;
require_once PIWIK_INCLUDE_PATH . '/plugins/CoreVisualizations/JqplotDataGenerator.php';
@@ -21,7 +20,7 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/CoreVisualizations/JqplotDataGenerat
class CoreVisualizations extends \Piwik\Plugin
{
/**
- * @see Piwik\Plugin::registerEvents
+ * @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
@@ -29,7 +28,7 @@ class CoreVisualizations extends \Piwik\Plugin
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
- 'UsersManager.deleteUser' => 'deleteUser'
+ 'UsersManager.deleteUser' => 'deleteUser',
);
}
diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions
-Subproject 8e088b3530dd85d2632ab2e264d2cb7492532ba
+Subproject 7bbbfd673469bea91c9164e3a4feeee1368e6ff
diff --git a/plugins/CustomVariables/Columns/Base.php b/plugins/CustomVariables/Columns/Base.php
index 4c6a4ea542..4cebcb0688 100644
--- a/plugins/CustomVariables/Columns/Base.php
+++ b/plugins/CustomVariables/Columns/Base.php
@@ -8,10 +8,9 @@
namespace Piwik\Plugins\CustomVariables\Columns;
-use Piwik\DataTable;
use Piwik\Piwik;
use Piwik\Plugin\Dimension\VisitDimension;
-use Piwik\Plugin\Segment;
+use Piwik\Plugins\CustomVariables\Segment;
use Piwik\Plugins\CustomVariables\CustomVariables;
class Base extends VisitDimension
@@ -24,7 +23,6 @@ class Base extends VisitDimension
$segment->setType('dimension');
$segment->setSegment('customVariable' . $segmentNameSuffix);
$segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')');
- $segment->setCategory('CustomVariables_CustomVariables');
$segment->setUnionOfSegments($this->getSegmentColumns('customVariable' . $segmentNameSuffix, $numCustomVariables));
$this->addSegment($segment);
@@ -32,9 +30,29 @@ class Base extends VisitDimension
$segment->setType('dimension');
$segment->setSegment('customVariablePage' . $segmentNameSuffix);
$segment->setName($this->getName() . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')');
- $segment->setCategory('CustomVariables_CustomVariables');
$segment->setUnionOfSegments($this->getSegmentColumns('customVariablePage' . $segmentNameSuffix, $numCustomVariables));
$this->addSegment($segment);
+
+ $segmentSuffix = 'v';
+ if (strtolower($segmentNameSuffix) === 'name') {
+ $segmentSuffix = 'k';
+ }
+
+ for ($i = 1; $i <= $numCustomVariables; $i++) {
+ $segment = new Segment();
+ $segment->setSegment('customVariable' . $segmentNameSuffix . $i);
+ $segment->setSqlSegment('log_visit.custom_var_' . $segmentSuffix . $i);
+ $segment->setName(Piwik::translate('CustomVariables_ColumnCustomVariable' . $segmentNameSuffix) . ' ' . $i
+ . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')');
+ $this->addSegment($segment);
+
+ $segment = new Segment();
+ $segment->setSegment('customVariablePage' . $segmentNameSuffix . $i);
+ $segment->setSqlSegment('log_link_visit_action.custom_var_' . $segmentSuffix . $i);
+ $segment->setName(Piwik::translate('CustomVariables_ColumnCustomVariable' . $segmentNameSuffix) . ' ' . $i
+ . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')');
+ $this->addSegment($segment);
+ }
}
private function getSegmentColumns($column, $numCustomVariables)
diff --git a/plugins/CustomVariables/Columns/CustomVariableName.php b/plugins/CustomVariables/Columns/CustomVariableName.php
index b42f2e8ae7..982ce1e264 100644
--- a/plugins/CustomVariables/Columns/CustomVariableName.php
+++ b/plugins/CustomVariables/Columns/CustomVariableName.php
@@ -21,4 +21,5 @@ class CustomVariableName extends Base
{
return Piwik::translate('CustomVariables_ColumnCustomVariableName');
}
+
} \ No newline at end of file
diff --git a/plugins/CustomVariables/Columns/CustomVariableValue.php b/plugins/CustomVariables/Columns/CustomVariableValue.php
index a565a8136c..10c146f2e1 100644
--- a/plugins/CustomVariables/Columns/CustomVariableValue.php
+++ b/plugins/CustomVariables/Columns/CustomVariableValue.php
@@ -21,4 +21,5 @@ class CustomVariableValue extends Base
{
return Piwik::translate('CustomVariables_ColumnCustomVariableValue');
}
+
} \ No newline at end of file
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index 9059482c33..78a779e5f9 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -8,24 +8,22 @@
*/
namespace Piwik\Plugins\CustomVariables;
-use Piwik\ArchiveProcessor;
-use Piwik\Piwik;
use Piwik\Tracker\Cache;
-use Piwik\Tracker;
class CustomVariables extends \Piwik\Plugin
{
+ const MAX_NUM_CUSTOMVARS_CACHEKEY = 'CustomVariables.MaxNumCustomVariables';
+
/**
- * @see Piwik\Plugin::registerEvents
+ * @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
return array(
- 'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata',
'Live.getAllVisitorDetails' => 'extendVisitorDetails',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
- 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
+ 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
);
}
@@ -77,7 +75,7 @@ class CustomVariables extends \Piwik\Plugin
public static function getNumUsableCustomVariables()
{
$cache = Cache::getCacheGeneral();
- $cacheKey = 'CustomVariables.NumUsableCustomVariables';
+ $cacheKey = self::MAX_NUM_CUSTOMVARS_CACHEKEY;
if (!array_key_exists($cacheKey, $cache)) {
@@ -107,46 +105,6 @@ class CustomVariables extends \Piwik\Plugin
return $cache[$cacheKey];
}
- public function getSegmentsMetadata(&$segments)
- {
- $maxCustomVariables = self::getNumUsableCustomVariables();
-
- for ($i = 1; $i <= $maxCustomVariables; $i++) {
- $segments[] = array(
- 'type' => 'dimension',
- 'category' => 'CustomVariables_CustomVariables',
- 'name' => Piwik::translate('CustomVariables_ColumnCustomVariableName') . ' ' . $i
- . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')',
- 'segment' => 'customVariableName' . $i,
- 'sqlSegment' => 'log_visit.custom_var_k' . $i,
- );
- $segments[] = array(
- 'type' => 'dimension',
- 'category' => 'CustomVariables_CustomVariables',
- 'name' => Piwik::translate('CustomVariables_ColumnCustomVariableValue') . ' ' . $i
- . ' (' . Piwik::translate('CustomVariables_ScopeVisit') . ')',
- 'segment' => 'customVariableValue' . $i,
- 'sqlSegment' => 'log_visit.custom_var_v' . $i,
- );
- $segments[] = array(
- 'type' => 'dimension',
- 'category' => 'CustomVariables_CustomVariables',
- 'name' => Piwik::translate('CustomVariables_ColumnCustomVariableName') . ' ' . $i
- . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')',
- 'segment' => 'customVariablePageName' . $i,
- 'sqlSegment' => 'log_link_visit_action.custom_var_k' . $i,
- );
- $segments[] = array(
- 'type' => 'dimension',
- 'category' => 'CustomVariables_CustomVariables',
- 'name' => Piwik::translate('CustomVariables_ColumnCustomVariableValue') . ' ' . $i
- . ' (' . Piwik::translate('CustomVariables_ScopePage') . ')',
- 'segment' => 'customVariablePageValue' . $i,
- 'sqlSegment' => 'log_link_visit_action.custom_var_v' . $i,
- );
- }
- }
-
public function getClientSideTranslationKeys(&$translationKeys)
{
$translationKeys[] = 'CustomVariables_CustomVariables';
diff --git a/plugins/CustomVariables/Segment.php b/plugins/CustomVariables/Segment.php
new file mode 100644
index 0000000000..fc1c3fd0a7
--- /dev/null
+++ b/plugins/CustomVariables/Segment.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\CustomVariables;
+
+/**
+ * CustomVariables segment base class
+ */
+class Segment extends \Piwik\Plugin\Segment
+{
+ protected function init()
+ {
+ $this->setCategory('CustomVariables_CustomVariables');
+ }
+}
+
diff --git a/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php b/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php
index e24bbf0090..421b19bd0d 100644
--- a/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php
+++ b/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php
@@ -6,7 +6,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-namespace Piwik\Plugins\CustomVariables\tests;
+namespace Piwik\Plugins\CustomVariables\tests\Integration;
+
use Piwik\Plugins\CustomVariables\CustomVariables;
use Piwik\Plugins\CustomVariables\Model;
use Piwik\Tracker\Cache;
@@ -30,13 +31,13 @@ class CustomVariablesTest extends IntegrationTestCase
CustomVariables::getNumUsableCustomVariables();
$cache = Cache::getCacheGeneral();
- $this->assertSame(5, $cache['CustomVariables.NumUsableCustomVariables']);
+ $this->assertSame(5, $cache[CustomVariables::MAX_NUM_CUSTOMVARS_CACHEKEY]);
}
public function test_getNumUsableCustomVariables_ShouldReadFromCacheIfPossible()
{
$cache = Cache::getCacheGeneral();
- $cache['CustomVariables.NumUsableCustomVariables'] = 10;
+ $cache[CustomVariables::MAX_NUM_CUSTOMVARS_CACHEKEY] = 10;
Cache::setCacheGeneral($cache);
$this->assertSame(10, CustomVariables::getNumUsableCustomVariables());
diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php
index b478be5b16..0d228cadb6 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -67,7 +67,7 @@ class Goals extends \Piwik\Plugin
}
/**
- * @see Piwik\Plugin::registerEvents
+ * @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
@@ -77,7 +77,6 @@ class Goals extends \Piwik\Plugin
'Tracker.Cache.getSiteAttributes' => 'fetchGoalsFromDb',
'API.getReportMetadata.end' => 'getReportMetadataEnd',
'SitesManager.deleteSite.end' => 'deleteSiteGoals',
- 'Goals.getReportsWithGoalMetrics' => 'getActualReportsWithGoalMetrics',
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
'Category.addSubcategories' => 'addSubcategories'
@@ -194,67 +193,28 @@ class Goals extends \Piwik\Plugin
'name' => $report->getName(),
'module' => $report->getModule(),
'action' => $report->getAction(),
+ 'parameters' => $report->getParameters()
);
}
}
- /**
- * Triggered when gathering all reports that contain Goal metrics. The list of reports
- * will be displayed on the left column of the bottom of every _Goals_ page.
- *
- * If plugins define reports that contain goal metrics (such as **conversions** or **revenue**),
- * they can use this event to make sure their reports can be viewed on Goals pages.
- *
- * **Example**
- *
- * public function getReportsWithGoalMetrics(&$reports)
- * {
- * $reports[] = array(
- * 'category' => Piwik::translate('MyPlugin_myReportCategory'),
- * 'name' => Piwik::translate('MyPlugin_myReportDimension'),
- * 'module' => 'MyPlugin',
- * 'action' => 'getMyReport'
- * );
- * }
- *
- * @param array &$reportsWithGoals The list of arrays describing reports that have Goal metrics.
- * Each element of this array must be an array with the following
- * properties:
- *
- * - **category**: The report category. This should be a translated string.
- * - **name**: The report's translated name.
- * - **module**: The plugin the report is in, eg, `'UserCountry'`.
- * - **action**: The API method of the report, eg, `'getCountry'`.
- * @ignore
- * @deprecated since 2.5.0
- */
- Piwik::postEvent('Goals.getReportsWithGoalMetrics', array(&$reportsWithGoals));
-
- return $reportsWithGoals;
- }
-
- /**
- * This function executes when the 'Goals.getReportsWithGoalMetrics' event fires. It
- * adds the 'visits to conversion' report metadata to the list of goal reports so
- * this report will be displayed.
- */
- public function getActualReportsWithGoalMetrics(&$dimensions)
- {
$reportWithGoalMetrics = array(
array('category' => 'General_Visit',
- 'name' => Piwik::translate('Goals_VisitsUntilConv'),
- 'module' => 'Goals',
- 'action' => 'getVisitsUntilConversion',
- 'viewDataTable' => 'table',
+ 'name' => Piwik::translate('Goals_VisitsUntilConv'),
+ 'module' => 'Goals',
+ 'action' => 'getVisitsUntilConversion',
+ 'viewDataTable' => 'table',
),
array('category' => 'General_Visit',
- 'name' => Piwik::translate('Goals_DaysToConv'),
- 'module' => 'Goals',
- 'action' => 'getDaysToConversion',
- 'viewDataTable' => 'table',
+ 'name' => Piwik::translate('Goals_DaysToConv'),
+ 'module' => 'Goals',
+ 'action' => 'getDaysToConversion',
+ 'viewDataTable' => 'table',
)
);
- $dimensions = array_merge($dimensions, $reportWithGoalMetrics);
+ $reportsWithGoals = array_merge($reportsWithGoals, $reportWithGoalMetrics);
+
+ return $reportsWithGoals;
}
public function getJsFiles(&$jsFiles)
diff --git a/plugins/Login/SessionInitializer.php b/plugins/Login/SessionInitializer.php
index a3c5f9a648..72013d2b8c 100644
--- a/plugins/Login/SessionInitializer.php
+++ b/plugins/Login/SessionInitializer.php
@@ -118,11 +118,6 @@ class SessionInitializer
} else {
$this->processSuccessfulSession($authResult, $rememberMe);
}
-
- /**
- * @deprecated Create a custom SessionInitializer instead.
- */
- Piwik::postEvent('Login.initSession.end');
}
/**
@@ -136,29 +131,6 @@ class SessionInitializer
*/
protected function doAuthenticateSession(AuthInterface $auth)
{
- $login = $auth->getLogin();
- $tokenAuthSecret = null;
-
- try {
- $tokenAuthSecret = $auth->getTokenAuthSecret();
- } catch (Exception $ex) {
- Log::debug("SessionInitializer::doAuthenticateSession: token_auth secret for %s not available before user"
- . " is authenticated.", $login);
- }
-
- $tokenAuth = empty($tokenAuthSecret) ? null : $this->usersManagerAPI->getTokenAuth($login, $tokenAuthSecret);
-
- /**
- * @deprecated Create a custom SessionInitializer instead.
- */
- Piwik::postEvent(
- 'Login.authenticate',
- array(
- $auth->getLogin(),
- $tokenAuth
- )
- );
-
return $auth->authenticate();
}
@@ -201,17 +173,6 @@ class SessionInitializer
*/
protected function processSuccessfulSession(AuthResult $authResult, $rememberMe)
{
- /**
- * @deprecated Create a custom SessionInitializer instead.
- */
- Piwik::postEvent(
- 'Login.authenticate.successful',
- array(
- $authResult->getIdentity(),
- $authResult->getTokenAuth()
- )
- );
-
$cookie = $this->getAuthCookie($rememberMe);
$cookie->set('login', $authResult->getIdentity());
$cookie->set('token_auth', $this->getHashTokenAuth($authResult->getIdentity(), $authResult->getTokenAuth()));