Skip to content
Permalink
Browse files
refs #8565 #8503 #8567 refactored/removed some code to not use deprec…
…ated APIs / events for 3.0
  • Loading branch information
tsteur committed Sep 9, 2015
1 parent c983e4f commit 65353d7bac8a90bf05545c0ecd693d81b684f9e2
Showing 61 changed files with 132 additions and 115 deletions.
@@ -10,6 +10,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'

### Deprecations
* The API method `SitesManager.getSitesIdWithVisits` has been deprecated and will be removed in Piwik 3.0
* The API method `\Piwik\Plugin::getListHooksRegistered()` has been deprecated and will be removed in Piwik 3.0. Use `\Piwik\Plugin::registerEvents()` instead.
* The following events have been deprecated and will be removed in Piwik 3.0. Use [dimensions](http://developer.piwik.org/guides/dimensions) instead.
* `Tracker.existingVisitInformation`
* `Tracker.getVisitFieldsToPersist`
@@ -19,6 +20,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'
* `Tracker.recordEcommerceGoal`
* `Tracker.recordStandardGoals`


### New APIs

* The JavaScript Tracker `piwik.js` got a new method `logAllContentBlocksOnPage` to log all found content blocks within a page to the console. This is useful to debug / test content tracking. It can be triggered via `_paq.push(['logAllContentBlocksOnPage'])`
@@ -56,7 +56,7 @@
*
* class MyPlugin extends Plugin
* {
* public function getListHooksRegistered()
* public function registerEvents()
* {
* return array(
* 'API.getReportMetadata' => 'getReportMetadata',
@@ -192,7 +192,7 @@ public function getInformation()
}

/**
* Returns a list of hooks with associated event observers.
* Returns a list of events with associated event observers.
*
* Derived classes should use this method to associate callbacks with events.
*
@@ -209,12 +209,22 @@ public function getInformation()
* 'before' => true // execute before callbacks w/o ordering
* )
* )
* @since 2.15.0
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array();
}

/**
* @deprecated since 2.15.0 use {@link registerEvents()} instead.
* @return array
*/
public function getListHooksRegistered()
{
return $this->registerEvents();
}

/**
* This method is executed after a plugin is loaded and translations are registered.
* Useful for initialization code that uses translated strings.
@@ -146,10 +146,6 @@ public static function build($defaultType = null, $apiAction = false, $controlle
return self::createViewDataTableInstance($visualizations[$type], $controllerAction, $apiAction, $params);
}

if (class_exists($type)) {
return self::createViewDataTableInstance($type, $controllerAction, $apiAction, $params);
}

if (array_key_exists($defaultType, $visualizations)) {
return self::createViewDataTableInstance($visualizations[$defaultType], $controllerAction, $apiAction, $params);
}
@@ -589,9 +589,9 @@ public function __construct()
}

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles'
@@ -26,9 +26,9 @@ class Actions extends \Piwik\Plugin
const ACTIONS_REPORT_ROWS_DISPLAY = 100;

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'ViewDataTable.configure' => 'configureViewDataTable',
@@ -16,9 +16,9 @@
class Annotations extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -19,9 +19,9 @@ class BulkTracking extends \Piwik\Plugin
private $requests;

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'Tracker.newHandler' => 'setHandlerIfBulkRequest',
@@ -118,7 +118,7 @@ public function test_setHandlerIfBulkRequest_shouldNotSetAHandler_IfItIsNotABulk
$this->assertNull($handler);
}

public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndCreateBulkHandler_IfBulkRequest()
public function test_registerEvents_shouldListenToNewTrackerEventAndCreateBulkHandler_IfBulkRequest()
{
$this->injectRawDataToBulk($this->getDummyRequest());

@@ -127,14 +127,14 @@ public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndCrea
$this->assertTrue($handler instanceof Handler);
}

public function test_getListHooksRegistered_shouldListenToNewTrackerEventAndNotCreateBulkHandler_IfNotBulkRequest()
public function test_registerEvents_shouldListenToNewTrackerEventAndNotCreateBulkHandler_IfNotBulkRequest()
{
$handler = DefaultHandler\Factory::make();

$this->assertTrue($handler instanceof DefaultHandler);
}

public function test_getListHooksRegistered_shouldListenToInitRequestSetEventAndInit_IfBulkRequest()
public function test_registerEvents_shouldListenToInitRequestSetEventAndInit_IfBulkRequest()
{
$this->injectRawDataToBulk($this->getDummyRequest());

@@ -11,9 +11,9 @@
class Contents extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
@@ -18,9 +18,9 @@
class CoreAdminHome extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -14,9 +14,9 @@
class CoreHome extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -31,7 +31,7 @@
{% for footerIconGroup in footerIcons %}
<div class="tableIconsGroup">
<span class="{{ footerIconGroup.class }}">
{% for footerIcon in footerIconGroup.buttons %}
{% for footerIcon in footerIconGroup.buttons if footerIcon.icon %}
{% set isActiveEcommerceView = clientSideParameters.abandonedCarts is defined and
((footerIcon.id == 'ecommerceOrder' and clientSideParameters.abandonedCarts == 0) or
(footerIcon.id == 'ecommerceAbandonedCart' and clientSideParameters.abandonedCarts == 1)) %}
@@ -14,9 +14,9 @@
class CorePluginsAdmin extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -26,9 +26,9 @@
class CoreUpdater extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'Request.dispatchCoreAndPluginUpdatesScreen' => 'dispatch',
@@ -21,9 +21,9 @@
class CoreVisualizations extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -16,9 +16,9 @@
class CustomVariables extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'API.getSegmentDimensionMetadata' => 'getSegmentsMetadata',
@@ -18,9 +18,9 @@ class DBStats extends \Piwik\Plugin
const TIME_OF_LAST_TASK_RUN_OPTION = 'dbstats_time_of_last_cache_task_run';

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -212,6 +212,7 @@ public function saveLayout()
$this->checkTokenInUrl();

$layout = Common::unsanitizeInputValue(Common::getRequestVar('layout'));
$layout = strip_tags($layout);
$idDashboard = Common::getRequestVar('idDashboard', 1, 'int');
$name = Common::getRequestVar('name', '', 'string');

@@ -236,6 +237,7 @@ public function saveLayoutAsDefault()

if (Piwik::hasUserSuperUserAccess()) {
$layout = Common::unsanitizeInputValue(Common::getRequestVar('layout'));
$layout = strip_tags($layout);
$this->getModel()->createOrUpdateDashboard('', '1', $layout);
}
}
@@ -18,9 +18,9 @@
class Dashboard extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -18,9 +18,9 @@
class DevicePlugins extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
@@ -18,9 +18,9 @@
class DevicesDetection extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'Live.getAllVisitorDetails' => 'extendVisitorDetails'
@@ -16,9 +16,9 @@
class Events extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'Metrics.getDefaultMetricDocumentationTranslations' => 'addMetricDocumentationTranslations',
@@ -14,9 +14,9 @@
class ExampleRssWidget extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles'
@@ -15,9 +15,9 @@ class Feedback extends \Piwik\Plugin
{

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
@@ -86,9 +86,9 @@ public static function getGoalColumns($idGoal)
}

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
$hooks = array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -31,9 +31,9 @@ class ImageGraph extends \Piwik\Plugin
);

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
$hooks = array(
'API.getReportMetadata.end' => array('function' => 'getReportMetadata',
@@ -13,9 +13,9 @@
class Insights extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
@@ -26,9 +26,9 @@ class Installation extends \Piwik\Plugin
protected $installationControllerName = '\\Piwik\\Plugins\\Installation\\Controller';

/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
$hooks = array(
'Config.NoConfigurationFile' => 'dispatch',
@@ -27,9 +27,9 @@
class LanguagesManager extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
* @see Piwik\Plugin::registerEvents
*/
public function getListHooksRegistered()
public function registerEvents()
{
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',

0 comments on commit 65353d7

Please sign in to comment.