From 7585967cbd80d7869f57a9adc69c02e8d14cbc33 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Wed, 3 Jun 2020 18:47:44 +1200 Subject: Remove code tagged with `@deprecated` (#16001) * remove some code tagged with deprecated * some more tweaks * remove more deprecated methods * more deprecations * remove old files * remove more deprecated methods * fix some tests * update logviewer submodule * fix some tests * fix ui test * another deprecation * Update CHANGELOG.md Co-authored-by: Stefan Giehl * add test for dimensions provider Co-authored-by: Stefan Giehl --- CHANGELOG.md | 21 ++- core/Application/EnvironmentManipulator.php | 2 +- core/ArchiveProcessor/PluginsArchiver.php | 5 - core/Columns/Dimension.php | 16 --- core/Config.php | 23 ---- core/Container/StaticContainer.php | 3 +- core/DataAccess/ArchiveWriter.php | 3 +- core/DataTable/Filter/CalculateEvolutionFilter.php | 2 +- core/Db.php | 13 -- core/FrontController.php | 1 - core/Mail/Transport.php | 2 +- core/MetricsFormatter.php | 67 ---------- core/NumberFormatter.php | 2 +- core/Plugin.php | 1 - core/Plugin/API.php | 6 +- core/Plugin/Controller.php | 9 +- core/Plugin/LogTablesProvider.php | 2 +- core/Plugin/Manager.php | 2 +- core/ReportRenderer/Pdf.php | 4 +- core/ScheduledTask.php | 27 ---- core/Session/SessionInitializer.php | 13 -- core/Site.php | 1 - core/Tracker.php | 8 -- core/Translate.php | 147 --------------------- core/Updater.php | 13 -- core/Updates/3.13.1-b2.php | 3 +- core/View/HtmlReportEmailHeaderView.php | 1 - plugins/API/API.php | 65 +-------- .../angularjs/common/services/piwik-api.js | 3 - .../CoreHome/angularjs/history/history.service.js | 2 +- plugins/CoreHome/javascripts/broadcast.js | 6 +- plugins/CorePluginsAdmin/Controller.php | 16 --- plugins/CorePluginsAdmin/templates/macros.twig | 4 +- plugins/CorePluginsAdmin/templates/plugins.twig | 2 +- plugins/CorePluginsAdmin/templates/themes.twig | 2 +- plugins/CoreUpdater/CoreUpdater.php | 16 --- plugins/CustomVariables/Model.php | 4 +- plugins/DevicesDetection/API.php | 19 --- plugins/Diagnostics/Diagnostic/DbMaxPacket.php | 5 +- plugins/ExampleAPI/API.php | 10 -- plugins/GeoIp2/GeoIP2AutoUpdater.php | 2 - plugins/GeoIp2/LocationProvider/GeoIp2.php | 20 --- plugins/Goals/API.php | 2 - plugins/LanguagesManager/API.php | 9 -- plugins/Live/API.php | 50 ------- plugins/LogViewer | 2 +- plugins/Login/Login.php | 8 -- plugins/Login/SessionInitializer.php | 5 - .../ProfessionalServices/ProfessionalServices.php | 21 --- plugins/Proxy/Controller.php | 33 ----- plugins/Referrers/API.php | 24 ---- plugins/SitesManager/API.php | 50 ------- plugins/SitesManager/Controller.php | 14 -- plugins/VisitsSummary/Controller.php | 14 +- tests/PHPUnit/Framework/Fixture.php | 28 ---- .../PHPUnit/Framework/TestCase/SystemTestCase.php | 16 --- tests/PHPUnit/Framework/TestRequest/Collection.php | 4 - .../PHPUnit/Integration/Columns/DimensionTest.php | 8 -- .../Integration/Columns/DimensionsProviderTest.php | 38 ++++++ tests/PHPUnit/Integration/DbTest.php | 4 +- tests/PHPUnit/Integration/FrontControllerTest.php | 2 +- .../System/BackwardsCompatibility1XTest.php | 1 - ...dIsRangeDateIsLastNMetadataAndNormalAPITest.php | 2 +- tests/PHPUnit/System/UrlNormalizationTest.php | 8 -- .../UIIntegrationTest_api_listing.png | 4 +- 65 files changed, 111 insertions(+), 809 deletions(-) delete mode 100644 core/MetricsFormatter.php delete mode 100644 core/ScheduledTask.php delete mode 100644 core/Translate.php create mode 100644 tests/PHPUnit/Integration/Columns/DimensionsProviderTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 7879a8a3e9..f1d5ecdaa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* ### Breaking changes * The API `UsersManager.getTokenAuth` has been removed. Instead you need to use `UsersManager.createAppSpecificTokenAuth` and store this token in your application. * The API `UsersManager.createTokenAuth` has been removed. Instead you need to use `UsersManager.createAppSpecificTokenAuth` and store this token in your application. +* The API `DevicesDetection.getBrowserFamilies` has been removed. Instead you need to use `DevicesDetection.getBrowsers` * Deprecated `piwik` font was removed. Use `matomo` font instead * The JavaScript AjaxHelper does not longer support synchronous requests. All requests will be sent async instead. * The deprecated Platform API method `\Piwik\Plugin::getListHooksRegistered()` has been removed. Use `\Piwik\Plugin::registerEvents()` instead @@ -21,6 +22,7 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* * The deprecated Platform API method `\Piwik\Updates::getMigrationQueries()` has been removed. Use `\Piwik\Updates::getMigrations()` instead * The deprecated Platform API method `\Piwik\Updates::executeMigrationQueries()` has been removed. Use `\Piwik\Updates::executeMigrations()` instead * The deprecated Platform API method `\Piwik\Updates::update()` has been removed. Use `\Piwik\Updates::doUpdate()` instead +* The deprecated Platform API method `\Piwik\Updater::updateDatabase()` has been removed. The method is not needed anymore. * Matomo no longer polyfills the `JSON` object in the JavaScript tracker. This means IE7 and older, Firefox 3 and older will be no longer suppported in the tracker. * The deprecated Platform API method `\Piwik\Common::json_encode()` has been removed. Use `json_encode()` instead * The deprecated Platform API method `\Piwik\Common::json_decode()` has been removed. Use `json_decode()` instead @@ -28,13 +30,23 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* * The deprecated Platform API method `\Piwik\Common::getCountriesList()` has been removed. Use `\Piwik\Intl\Data\Provider\RegionDataProvider::getCountriesList()` instead * The deprecated Platform API method `\Piwik\Common::getLanguagesList()` has been removed. Use `\Piwik\Intl\Data\Provider\LanguageDataProvider::getLanguagesList()` instead * The deprecated Platform API method `\Piwik\Common::getLanguageToCountryList()` has been removed. Use `\Piwik\Intl\Data\Provider\LanguageDataProvider::getLanguageToCountryList()` instead -* The deprecated Platform API method `\Piwik\MetricsFormatter::getCurrencyList()` has been removed. Use `\Piwik\Intl\Data\Provider\CurrencyDataProvider::getCurrencyList()` instead * The deprecated Platform API method `\Piwik\Site::getCurrencyList()` has been removed. Use `\Piwik\Intl\Data\Provider\CurrencyDataProvider::getCurrencyList()` instead * The deprecated Platform API method `\Piwik\Piwik::setUserHasSuperUserAccess()` has been removed. Use `\Piwik\Access::doAsSuperUser()` instead +* The deprecated Platform API class `\Piwik\MetricsFormatter` has been removed. Use `Piwik\Metrics\Formatter` or `Piwik\Metrics\Formatter\Html` instead * The deprecated Platform API class `\Piwik\Registry` has been removed. Use `\Piwik\Container\StaticContainer` instead * The deprecated Platform API class `\Piwik\TaskScheduler` has been removed. Use `\Piwik\Scheduler\Scheduler` instead * The deprecated Platform API class `\Piwik\DeviceDetectorFactory` has been removed. Use `\Piwik\DeviceDetector\DeviceDetectorFactory` instead +* The deprecated Platform API class `\Piwik\ScheduledTask` has been removed. Use `\Piwik\Scheduler\Task` instead. * The deprecated Platform API class `\Piwik\Translate` has been removed. Use `\Piwik\Translation\Translator` instead. +* The deprecated Platform API class `\Piwik\Plugins\Login\SessionInitializer` is no longer considered API as it is no longer needed. +* The deprecated Platform API method `Piwik\Columns\Dimension::factory` has been removed. Use `DimensionsProvider::factory` instead. +* The deprecated Platform API method `Piwik\Config::reset` has been removed. Use the `reload` method instead. +* The deprecated Platform API method `Piwik\Config::init` has been removed. Use the `reload()` method instead. +* The deprecated Platform API method `Piwik\Db::getColumnNamesFromTable` has been removed. Use the `TableMetadata::getColumns` method instead. +* The deprecated Platform API method `Piwik\Session\SessionInitializer::getHashTokenAuth` has been removed. There is no need for this method anymore. +* The deprecated Platform API method `Piwik\Tracker::getDatetimeFromTimestamp` has been removed. Use `Piwik\Date::getDatetimeFromTimestamp` instead. +* The deprecated Platform API constant `Piwik\Plugins\Goals\API::NEW_VISIT_SEGMENT` has been removed. Use `Piwik\Plugins\VisitFrequency\API::NEW_VISITOR_SEGMENT` instead. +* The following deprecated Platform API event has been removed: `Live.getExtraVisitorDetails'`. Use the `VisitorDetails` class within each plugin instead. * The JavaScript tracker now uses `sendBeacon` by default if supported by the browser. You can disable this by calling the tracker method `disableAlwaysUseSendBeacon`. As a result, callback parameters won't work anymore and a tracking request might not appear in the developer tools. * The console option `--piwik-domain` has been removed. Use `--matomo-domain` instead * The core plugin `CustomPiwikJs` has been renamed to `CustomJsTracker` @@ -42,6 +54,13 @@ The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)* * The event `CustomPiwikJs.shouldAddTrackerFile` has been renamed to `CustomJsTracker.shouldAddTrackerFile` * Public API class `Piwik\Plugins\CustomPiwikJs\TrackerUpdater` has been renamed to `Piwik\Plugins\CustomJsTracker\TrackerUpdater` * API method `CustomPiwikJs.doesIncludePluginTrackersAutomatically` has been renamed to `CustomJsTracker.doesIncludePluginTrackersAutomatically` +* The following deprecated API methods have been removed: `API.getDefaultMetricTranslations`, `API.getLogoUrl`, `API.getHeaderLogoUrl`, `API.getSVGLogoUrl`, `API.hasSVGLogo` +* The following deprecated API methods have been removed: `SitesManager.getSitesIdWithVisits`, `SitesManager.isSiteSpecificUserAgentExcludeEnabled`, `SitesManager.setSiteSpecificUserAgentExcludeEnabled` +* The following deprecated API methods have been removed: `Referrers.getKeywordsForPageUrl` and `Referrers.getKeywordsForPageTitle`. Use `Referrers.getKeywords` instead in combination with a `entryPageUrl` or `entryPageTitle` segment. +* The following deprecated API method `Live.getLastVisitsForVisitor` has been removed. Use `Live.getVisitorProfile` instead. +* The following deprecated API method `Live.getLastVisits` has been removed. Use `Live.getLastVisitsDetails` instead. +* The deperecated event `LanguageManager.getAvailableLanguages` has been removed. Use `LanguagesManager.getAvailableLanguages` instead. +* The controller action `Proxy.redirect` has been removed. Instead link to the URL directly in HTML and set an attribute `rel="noreferrer noopener"` * The API response format `php` has been removed. * GeoIP Legacy support has been fully removed. Users of GeoIP Legacy need to set up a new location provider like GeoIP2, otherwise the default location provider will be used. * Site search category and count are no longer stored as custom variables. That also means they will now have an extra field in action details and no longer appear in custom variables. diff --git a/core/Application/EnvironmentManipulator.php b/core/Application/EnvironmentManipulator.php index 7dea5c0e90..3c781d525d 100644 --- a/core/Application/EnvironmentManipulator.php +++ b/core/Application/EnvironmentManipulator.php @@ -26,7 +26,7 @@ interface EnvironmentManipulator public function makeGlobalSettingsProvider(GlobalSettingsProvider $original); /** - * Create a custom PluginList kernel object, overriding the default behavior.@deprecated + * Create a custom PluginList kernel object, overriding the default behavior. * * @param GlobalSettingsProvider $globalSettingsProvider * @return PluginList diff --git a/core/ArchiveProcessor/PluginsArchiver.php b/core/ArchiveProcessor/PluginsArchiver.php index b7efa00f50..60d95d5a2d 100644 --- a/core/ArchiveProcessor/PluginsArchiver.php +++ b/core/ArchiveProcessor/PluginsArchiver.php @@ -81,11 +81,6 @@ class PluginsArchiver * * @param bool $shouldAggregateFromRawData Set to true, to aggregate from raw data, or false to aggregate multiple reports. * @param Parameters $params - * @ignore - * @deprecated - * - * In Matomo 4.0 we should maybe remove this event, and instead maybe always archive from raw data when it is daily archive, - * no matter if single site or not. We cannot do this in Matomo 3.X as some custom plugin archivers may not be able to handle multiple sites. */ Piwik::postEvent('ArchiveProcessor.shouldAggregateFromRawData', array(&$shouldAggregateFromRawData, $this->params)); diff --git a/core/Columns/Dimension.php b/core/Columns/Dimension.php index 970e91aa59..204afa7179 100644 --- a/core/Columns/Dimension.php +++ b/core/Columns/Dimension.php @@ -761,22 +761,6 @@ abstract class Dimension return $instances; } - /** - * Creates a Dimension instance from a string ID (see {@link getId()}). - * - * @param string $dimensionId See {@link getId()}. - * @return Dimension|null The created instance or null if there is no Dimension for - * $dimensionId or if the plugin that contains the Dimension is - * not loaded. - * @api - * @deprecated Please use DimensionsProvider::factory instead - */ - public static function factory($dimensionId) - { - list($module, $dimension) = explode('.', $dimensionId); - return ComponentFactory::factory($module, $dimension, __CLASS__); - } - /** * Returns the name of the plugin that contains this Dimension. * diff --git a/core/Config.php b/core/Config.php index 6e4f444817..d56bdeac5d 100644 --- a/core/Config.php +++ b/core/Config.php @@ -290,26 +290,6 @@ class Config return is_writable($this->settings->getPathLocal()); } - /** - * Clear in-memory configuration so it can be reloaded - * @deprecated since v2.12.0 - */ - public function clear() - { - $this->reload(); - } - - /** - * Read configuration from files into memory - * - * @throws Exception if local config file is not readable; exits for other errors - * @deprecated since v2.12.0 - */ - public function init() - { - $this->reload(); - } - /** * Reloads config data from disk. * @@ -321,9 +301,6 @@ class Config $this->settings->reload($pathGlobal, $pathLocal, $pathCommon); } - /** - * @deprecated - */ public function existsLocalConfig() { return is_readable($this->getLocalPath()); diff --git a/core/Container/StaticContainer.php b/core/Container/StaticContainer.php index 21a2193257..1100eb930b 100644 --- a/core/Container/StaticContainer.php +++ b/core/Container/StaticContainer.php @@ -13,7 +13,8 @@ use DI\Container; /** * This class provides a static access to the container. * - * @deprecated This class is introduced only to keep BC with the current static architecture. It will be removed in 3.0. + * @internal + * This class is introduced only to keep BC with the current static architecture. It might be removed in a future version. * - it is global state (that class makes the container a global variable) * - using the container directly is the "service locator" anti-pattern (which is not dependency injection) */ diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php index 0077ea9074..a8446db9b4 100644 --- a/core/DataAccess/ArchiveWriter.php +++ b/core/DataAccess/ArchiveWriter.php @@ -43,7 +43,8 @@ class ArchiveWriter * This flag is deprecated, new archives should not be written as temporary. * * @var int - * @deprecated + * @deprecated it should not be used anymore as temporary archives have been removed. It still exists though for + * historical reasons. */ const DONE_OK_TEMPORARY = 3; diff --git a/core/DataTable/Filter/CalculateEvolutionFilter.php b/core/DataTable/Filter/CalculateEvolutionFilter.php index 0a2a67fdc7..0ebe19b53c 100644 --- a/core/DataTable/Filter/CalculateEvolutionFilter.php +++ b/core/DataTable/Filter/CalculateEvolutionFilter.php @@ -18,7 +18,7 @@ use Piwik\Site; * A {@link DataTable} filter that calculates the evolution of a metric and adds * it to each row as a percentage. * - * **This filter cannot be used as an argument to {@link Piwik\DataTable::filter()}** since + * **This filter cannot be used as an argument to {@link \Piwik\DataTable::filter()}** since * it requires corresponding data from another DataTable. Instead, * you must manually perform a binary filter (see the **MultiSites** API for an * example). diff --git a/core/Db.php b/core/Db.php index 8cd1d082cf..1dd7bbf16c 100644 --- a/core/Db.php +++ b/core/Db.php @@ -490,19 +490,6 @@ class Db self::dropTables($tablesAlreadyInstalled); } - /** - * Get columns information from table - * - * @param string|array $table The name of the table you want to get the columns definition for. - * @return \Zend_Db_Statement - * @deprecated since 2.11.0 - */ - public static function getColumnNamesFromTable($table) - { - $tableMetadataAccess = new TableMetadata(); - return $tableMetadataAccess->getColumns($table); - } - /** * Locks the supplied table or tables. * diff --git a/core/FrontController.php b/core/FrontController.php index 97ad7c7745..58659da1d1 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -199,7 +199,6 @@ class FrontController extends Singleton * @param string $actionName The controller action name, eg, `'realtimeMap'`. * @param array $parameters Array of parameters to pass to the controller action method. * @return string The `echo`'d data or the return value of the controller action. - * @deprecated */ public function fetchDispatch($module = null, $actionName = null, $parameters = null) { diff --git a/core/Mail/Transport.php b/core/Mail/Transport.php index de2a2e8425..7eabb12ae7 100644 --- a/core/Mail/Transport.php +++ b/core/Mail/Transport.php @@ -93,7 +93,7 @@ class Transport if (defined('PIWIK_TEST_MODE')) { // hack /** * @ignore - * @deprecated + * @internal */ Piwik::postTestEvent("Test.Mail.send", array($phpMailer)); return true; diff --git a/core/MetricsFormatter.php b/core/MetricsFormatter.php deleted file mode 100644 index d94a8b8a3f..0000000000 --- a/core/MetricsFormatter.php +++ /dev/null @@ -1,67 +0,0 @@ -getPrettyNumber($value); - } - - public static function getPrettyTimeFromSeconds($numberOfSeconds, $displayTimeAsSentence = true, $isHtml = true, $round = false) - { - return self::getFormatter($isHtml)->getPrettyTimeFromSeconds($numberOfSeconds, $displayTimeAsSentence, $round); - } - - public static function getPrettySizeFromBytes($size, $unit = null, $precision = 1) - { - return self::getFormatter()->getPrettySizeFromBytes($size, $unit, $precision); - } - - public static function getPrettyMoney($value, $idSite, $isHtml = true) - { - return self::getFormatter($isHtml)->getPrettyMoney($value, $idSite); - } - - public static function getPrettyValue($idSite, $columnName, $value, $isHtml) - { - return ProcessedReport::getPrettyValue(self::getFormatter($isHtml), $idSite, $columnName, $value); - } - - public static function getCurrencySymbol($idSite) - { - return Site::getCurrencySymbolFor($idSite); - } -} diff --git a/core/NumberFormatter.php b/core/NumberFormatter.php index 4450f7132b..694b94735d 100644 --- a/core/NumberFormatter.php +++ b/core/NumberFormatter.php @@ -296,7 +296,7 @@ class NumberFormatter */ public static function getInstance() { - return StaticContainer::get('Piwik\NumberFormatter'); + return StaticContainer::get(NumberFormatter::class); } public function clearCache() diff --git a/core/Plugin.php b/core/Plugin.php index 6d2435e867..9f18f37c42 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -184,7 +184,6 @@ class Plugin * - 'theme' => bool // Whether this plugin is a theme (a theme is a plugin, but a plugin is not necessarily a theme) * * @return array - * @deprecated */ public function getInformation() { diff --git a/core/Plugin/API.php b/core/Plugin/API.php index 0c50dd573c..8618a63dd6 100644 --- a/core/Plugin/API.php +++ b/core/Plugin/API.php @@ -77,7 +77,7 @@ abstract class API /** * Used in tests only * @ignore - * @deprecated + * @internal */ public static function unsetInstance() { @@ -88,7 +88,7 @@ abstract class API /** * Used in tests only * @ignore - * @deprecated + * @internal */ public static function unsetAllInstances() { @@ -98,7 +98,7 @@ abstract class API /** * Sets the singleton instance. For testing purposes. * @ignore - * @deprecated + * @internal */ public static function setSingletonInstance($instance) { diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php index 1eed760d12..166d786d70 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -733,10 +733,11 @@ abstract class Controller $this->addCustomLogoInfo($view); - $view->logoHeader = \Piwik\Plugins\API\API::getInstance()->getHeaderLogoUrl(); - $view->logoLarge = \Piwik\Plugins\API\API::getInstance()->getLogoUrl(); - $view->logoSVG = \Piwik\Plugins\API\API::getInstance()->getSVGLogoUrl(); - $view->hasSVGLogo = \Piwik\Plugins\API\API::getInstance()->hasSVGLogo(); + $customLogo = new CustomLogo(); + $view->logoHeader = $customLogo->getHeaderLogoUrl(); + $view->logoLarge = $customLogo->getLogoUrl(); + $view->logoSVG = $customLogo->getSVGLogoUrl(); + $view->hasSVGLogo = $customLogo->hasSVGLogo(); $view->superUserEmails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses()); $view->themeStyles = ThemeStyles::get(); diff --git a/core/Plugin/LogTablesProvider.php b/core/Plugin/LogTablesProvider.php index e0efec7f11..2295501212 100644 --- a/core/Plugin/LogTablesProvider.php +++ b/core/Plugin/LogTablesProvider.php @@ -105,7 +105,7 @@ class LogTablesProvider { * * @param array &$logTables An array containing a list of log entries. * - * @deprecated Only used for tests + * @internal Only used for tests * @ignore */ Piwik::postEvent('LogTables.addLogTables', array(&$logTables)); diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 8d503a2a1d..67ba2bf6e1 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -495,7 +495,7 @@ class Manager /** * Returns the path to the directory where core plugins are located. Please note since Matomo 3.9 * plugins may also be located in other directories and therefore this method has been deprecated. - * @deprecated since Matomo 3.9.0 use {@link (getPluginsDirectories())} or {@link getPluginDirectory($pluginName)} instead + * @internal since Matomo 3.9.0 use {@link (getPluginsDirectories())} or {@link getPluginDirectory($pluginName)} instead * @return string */ public static function getPluginsDirectory() diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php index 21e090ee26..3875f1e484 100644 --- a/core/ReportRenderer/Pdf.php +++ b/core/ReportRenderer/Pdf.php @@ -13,6 +13,7 @@ use Piwik\Filesystem; use Piwik\NumberFormatter; use Piwik\Piwik; use Piwik\Plugins\API\API; +use Piwik\Plugins\CoreAdminHome\CustomLogo; use Piwik\ReportRenderer; use Piwik\TCPDF; @@ -182,7 +183,8 @@ class Pdf extends ReportRenderer $this->TCPDF->Bookmark(Piwik::translate('ScheduledReports_FrontPage')); // logo - $this->TCPDF->Image(API::getInstance()->getLogoUrl(true), $this->logoImagePosition[0], $this->logoImagePosition[1], 180 / $factor = 2, 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300); + $customLogo = new CustomLogo(); + $this->TCPDF->Image($customLogo->getLogoUrl(true), $this->logoImagePosition[0], $this->logoImagePosition[1], 180 / $factor = 2, 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300); $this->TCPDF->Ln(8); // report title diff --git a/core/ScheduledTask.php b/core/ScheduledTask.php deleted file mode 100644 index cf8e326e55..0000000000 --- a/core/ScheduledTask.php +++ /dev/null @@ -1,27 +0,0 @@ - '2', 'name' => 'Site 2', ...), * ) * @return array The modified array. - * @deprecated * @internal */ public static function setSitesFromArray($sites) diff --git a/core/Tracker.php b/core/Tracker.php index 2cf9c04b63..fd1db25022 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -207,14 +207,6 @@ class Tracker return 0 !== $this->countOfLoggedRequests; } - /** - * @deprecated since 2.10.0 use {@link Date::getDatetimeFromTimestamp()} instead - */ - public static function getDatetimeFromTimestamp($timestamp) - { - return Date::getDatetimeFromTimestamp($timestamp); - } - public function isDatabaseConnected() { return !is_null(self::$db); diff --git a/core/Translate.php b/core/Translate.php deleted file mode 100644 index bf872af59f..0000000000 --- a/core/Translate.php +++ /dev/null @@ -1,147 +0,0 @@ -clean($s); - } - - /** - * @deprecated - */ - public static function loadEnglishTranslation() - { - self::loadAllTranslations(); - } - - /** - * @deprecated - */ - public static function unloadEnglishTranslation() - { - self::reset(); - } - - /** - * @deprecated - */ - public static function reloadLanguage($language = false) - { - self::triggerDeprecationNotice(); - } - - /** - * Reads the specified code translation file in memory. - * - * @param bool|string $language 2 letter language code. If not specified, will detect current user translation, or load default translation. - * @return void - */ - public static function loadCoreTranslation($language = false) - { - self::triggerDeprecationNotice(); - self::getTranslator()->addDirectory(PIWIK_INCLUDE_PATH . '/lang'); - } - - /** - * @deprecated - */ - public static function mergeTranslationArray($translation) - { - self::triggerDeprecationNotice(); - } - - /** - * @return string the language filename prefix, eg 'en' for english - * @throws exception if the language set is not a valid filename - */ - public static function getLanguageToLoad() - { - self::triggerDeprecationNotice(); - return self::getTranslator()->getCurrentLanguage(); - } - - /** Reset the cached language to load. Used in tests. */ - public static function reset() - { - self::triggerDeprecationNotice(); - self::getTranslator()->reset(); - } - - /** - * Either the name of the currently loaded language such as 'en' or 'de' or null if no language is loaded at all. - * @return bool|string - */ - public static function getLanguageLoaded() - { - self::triggerDeprecationNotice(); - return self::getTranslator()->getCurrentLanguage(); - } - - public static function getLanguageDefault() - { - self::triggerDeprecationNotice(); - return self::getTranslator()->getDefaultLanguage(); - } - - /** - * Generate javascript translations array - */ - public static function getJavascriptTranslations() - { - self::triggerDeprecationNotice(); - return self::getTranslator()->getJavascriptTranslations(); - } - - public static function findTranslationKeyForTranslation($translation) - { - self::triggerDeprecationNotice(); - return self::getTranslator()->findTranslationKeyForTranslation($translation); - } - - /** - * @return Translator - */ - private static function getTranslator() - { - return StaticContainer::get('Piwik\Translation\Translator'); - } - - public static function loadAllTranslations() - { - self::triggerDeprecationNotice(); - self::loadCoreTranslation(); - Manager::getInstance()->loadPluginTranslations(); - } - - protected static function triggerDeprecationNotice() - { - if (Development::isEnabled()) { - Log::warning('Using \Piwik\Translate is deprecated. Use \Piwik\Translation\Translator instead.'); - } - } -} diff --git a/core/Updater.php b/core/Updater.php index 89a967e3e6..36f5bcd2cc 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -620,19 +620,6 @@ class Updater return $migration; } - /** - * Performs database update(s) - * - * @param string $file Update script filename - * @param array $sqlarray An array of SQL queries to be executed - * @throws UpdaterErrorException - * @deprecated - */ - public static function updateDatabase($file, $sqlarray) - { - self::$activeInstance->executeMigrations($file, $sqlarray); - } - /** * Record version of successfully completed component update * diff --git a/core/Updates/3.13.1-b2.php b/core/Updates/3.13.1-b2.php index 3def0a5121..e2bc0517af 100644 --- a/core/Updates/3.13.1-b2.php +++ b/core/Updates/3.13.1-b2.php @@ -35,9 +35,10 @@ class Updates_3_13_1_b2 extends PiwikUpdates public function getMigrations(Updater $updater) { + $geoIpLiteUrl = 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz'; $optionTable = Common::prefixTable('option'); $migration1 = $this->migration->db->boundSql("UPDATE `$optionTable` SET option_value = ? WHERE option_name = ? AND option_value = ?", - [GeoIp2::getDbIpLiteUrl(), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, GeoIp2::GEO_LITE_URL]); + [GeoIp2::getDbIpLiteUrl(), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, $geoIpLiteUrl]); $migration2 = $this->migration->db->boundSql("UPDATE `$optionTable` SET option_value = ? WHERE option_name = ? AND option_value = ?", [GeoIp2::getDbIpLiteUrl('country'), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, self::GEO_LITE_COUNTRY_URL]); return [$migration1, $migration2]; diff --git a/core/View/HtmlReportEmailHeaderView.php b/core/View/HtmlReportEmailHeaderView.php index a709c3cf68..2320146e52 100644 --- a/core/View/HtmlReportEmailHeaderView.php +++ b/core/View/HtmlReportEmailHeaderView.php @@ -67,7 +67,6 @@ class HtmlReportEmailHeaderView extends View $emailStyles = EmailStyles::get(); $view->currentPath = SettingsPiwik::getPiwikUrl(); - $view->logoHeader = API::getInstance()->getHeaderLogoUrl(); $view->themeStyles = $themeStyles; $view->emailStyles = $emailStyles; diff --git a/plugins/API/API.php b/plugins/API/API.php index 3cc54e0db3..7d961f02ab 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -111,7 +111,7 @@ class API extends \Piwik\Plugin\API /** * Get Matomo version * @return string - * @deprecated + * @deprecated Deprecated but we keep it for historical reasons to not break BC */ public function getPiwikVersion() { @@ -139,19 +139,6 @@ class API extends \Piwik\Plugin\API return Config::getInstance()->APISettings; } - /** - * Default translations for many core metrics. - * This is used for exports with translated labels. The exports contain columns that - * are not visible in the UI and not present in the API meta data. These columns are - * translated here. - * @return array - * @deprecated since Matomo 2.15.1 - */ - public function getDefaultMetricTranslations() - { - return Metrics::getDefaultMetricTranslations(); - } - /** * Returns all available measurable types. * Marked as deprecated so it won't appear in API page. It won't be a public API for now. @@ -240,56 +227,6 @@ class API extends \Piwik\Plugin\API return $values; } - /** - * Returns the url to application logo (~280x110px) - * - * @param bool $pathOnly If true, returns path relative to doc root. Otherwise, returns a URL. - * @return string - * @deprecated since Matomo 2.15.1 - */ - public function getLogoUrl($pathOnly = false) - { - $logo = new CustomLogo(); - return $logo->getLogoUrl($pathOnly); - } - - /** - * Returns the url to header logo (~127x50px) - * - * @param bool $pathOnly If true, returns path relative to doc root. Otherwise, returns a URL. - * @return string - * @deprecated since Matomo 2.15.1 - */ - public function getHeaderLogoUrl($pathOnly = false) - { - $logo = new CustomLogo(); - return $logo->getHeaderLogoUrl($pathOnly); - } - - /** - * Returns the URL to application SVG Logo - * - * @ignore - * @param bool $pathOnly If true, returns path relative to doc root. Otherwise, returns a URL. - * @return string - */ - public function getSVGLogoUrl($pathOnly = false) - { - $logo = new CustomLogo(); - return $logo->getSVGLogoUrl($pathOnly); - } - - /** - * Returns whether there is an SVG Logo available. - * @ignore - * @return bool - */ - public function hasSVGLogo() - { - $logo = new CustomLogo(); - return $logo->hasSVGLogo(); - } - /** * Loads reports metadata, then return the requested one, * matching optional API parameters. diff --git a/plugins/CoreHome/angularjs/common/services/piwik-api.js b/plugins/CoreHome/angularjs/common/services/piwik-api.js index 97a6d28bfa..c98d13260a 100644 --- a/plugins/CoreHome/angularjs/common/services/piwik-api.js +++ b/plugins/CoreHome/angularjs/common/services/piwik-api.js @@ -340,9 +340,6 @@ var hasBlockedContent = false; post: post, fetch: fetch, addPostParams: addPostParams, - /** - * @deprecated - */ abort: abort, abortAll: abortAll, mixinDefaultGetParams: mixinDefaultGetParams diff --git a/plugins/CoreHome/angularjs/history/history.service.js b/plugins/CoreHome/angularjs/history/history.service.js index 6e3f0a3a13..b2ffa769ce 100644 --- a/plugins/CoreHome/angularjs/history/history.service.js +++ b/plugins/CoreHome/angularjs/history/history.service.js @@ -13,7 +13,7 @@ * * Should only be used by the broadcast object. * - * @deprecated in 3.2.2, will be removed in Piwik 4 + * @deprecated in 3.2.2, will be removed in Matomo 5 */ (function (window, $, broadcast) { angular.module('piwikApp').service('historyService', historyService); diff --git a/plugins/CoreHome/javascripts/broadcast.js b/plugins/CoreHome/javascripts/broadcast.js index bb92ae9abf..06517de5aa 100644 --- a/plugins/CoreHome/javascripts/broadcast.js +++ b/plugins/CoreHome/javascripts/broadcast.js @@ -53,7 +53,7 @@ var broadcast = { /** * Initializes broadcast object * - * @deprecated in 3.2.2, will be removed in Piwik 4 + * @deprecated in 3.2.2, will be removed in Matomo 5 * * @return {void} */ @@ -81,7 +81,7 @@ var broadcast = { * * * Note: the method is manipulated in Overlay/javascripts/Piwik_Overlay.js - keep this in mind when making changes. * - * @deprecated since 3.2.2, will be removed in Piwik 4 + * @deprecated since 3.2.2, will be removed in Matomo 5 * * @param {string} hash to load page with * @return {void} @@ -199,7 +199,7 @@ var broadcast = { * * NOTE: this method will only make ajax call and replacing main content. * - * @deprecated in 3.2.2, will be removed in Piwik 4. + * @deprecated in 3.2.2, will be removed in Matomo 5. * * @param {string} ajaxUrl querystring with parameters to be updated * @param {boolean} [disableHistory] the hash change won't be available in the browser history diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index 4eda3739ad..da005443f2 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -150,22 +150,6 @@ class Controller extends Plugin\ControllerAdmin return $view->render(); } - /** - * @deprecated - */ - public function browsePlugins() - { - $this->redirectToIndex('Marketplace', 'overview'); - } - - /** - * @deprecated - */ - public function browseThemes() - { - $this->redirectToIndex('Marketplace', 'overview', null, null, null, array('show' => 'themes')); - } - public function tagManagerTeaser() { $this->dieIfPluginsAdminIsDisabled(); diff --git a/plugins/CorePluginsAdmin/templates/macros.twig b/plugins/CorePluginsAdmin/templates/macros.twig index d5cb16bdff..db19df33df 100644 --- a/plugins/CorePluginsAdmin/templates/macros.twig +++ b/plugins/CorePluginsAdmin/templates/macros.twig @@ -290,9 +290,9 @@ {% if displayAdminLinks %} {% endif %} diff --git a/plugins/CorePluginsAdmin/templates/plugins.twig b/plugins/CorePluginsAdmin/templates/plugins.twig index e1b825ded6..14943ba94a 100644 --- a/plugins/CorePluginsAdmin/templates/plugins.twig +++ b/plugins/CorePluginsAdmin/templates/plugins.twig @@ -19,7 +19,7 @@ {% if isMarketplaceEnabled or isPluginUploadEnabled %} {{ 'CorePluginsAdmin_TeaserExtendPiwikByPlugin'|translate( - '', + '', '', '', '' diff --git a/plugins/CorePluginsAdmin/templates/themes.twig b/plugins/CorePluginsAdmin/templates/themes.twig index d898c3c799..32a4e56444 100644 --- a/plugins/CorePluginsAdmin/templates/themes.twig +++ b/plugins/CorePluginsAdmin/templates/themes.twig @@ -15,7 +15,7 @@ {{ 'CorePluginsAdmin_ThemesDescription'|translate }} {% if isMarketplaceEnabled %} - {{ 'CorePluginsAdmin_TeaserExtendPiwikByTheme'|translate('', '')|raw }} + {{ 'CorePluginsAdmin_TeaserExtendPiwikByTheme'|translate('', '')|raw }} {% endif %} {% if otherUsersCount > 0 %} diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index 1d5eaa0161..79821d287c 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -35,22 +35,6 @@ class CoreUpdater extends \Piwik\Plugin ); } - /** - * @deprecated - */ - public static function updateComponents(PiwikCoreUpdater $updater, $componentsWithUpdateFile) - { - return $updater->updateComponents($componentsWithUpdateFile); - } - - /** - * @deprecated - */ - public static function getComponentUpdates(PiwikCoreUpdater $updater) - { - return $updater->getComponentUpdates(); - } - public function dispatch() { if (!SettingsPiwik::isAutoUpdateEnabled()) { diff --git a/plugins/CustomVariables/Model.php b/plugins/CustomVariables/Model.php index b5ffec9060..bdc28f22f7 100644 --- a/plugins/CustomVariables/Model.php +++ b/plugins/CustomVariables/Model.php @@ -10,6 +10,7 @@ namespace Piwik\Plugins\CustomVariables; use Piwik\Common; use Piwik\Container\StaticContainer; +use Piwik\DataAccess\TableMetadata; use Piwik\DataTable; use Piwik\Db; use Piwik\Log; @@ -133,7 +134,8 @@ class Model private function getCustomVarColumnNames() { - $columns = Db::getColumnNamesFromTable($this->table); + $tableMetadataAccess = new TableMetadata(); + $columns = $tableMetadataAccess->getColumns($this->table); $customVarColumns = array_filter($columns, function ($column) { return false !== strpos($column, 'custom_var_'); diff --git a/plugins/DevicesDetection/API.php b/plugins/DevicesDetection/API.php index b3b416630f..acc635ac88 100644 --- a/plugins/DevicesDetection/API.php +++ b/plugins/DevicesDetection/API.php @@ -225,25 +225,6 @@ class API extends \Piwik\Plugin\API return $dataTable; } - /** - * Gets datatable displaying number of visits by Browser family (eg. Firefox, InternetExplorer) - * @param int $idSite - * @param string $period - * @param string $date - * @param bool|string $segment - * @return DataTable - * - * @deprecated since 2.9.0 Use {@link getBrowsers} instead. - */ - public function getBrowserFamilies($idSite, $period, $date, $segment = false) - { - $table = $this->getBrowsers($idSite, $period, $date, $segment); - // this one will not be sorted automatically by nb_visits since there is no Report class for it. - $table->filter('Sort', array(Metrics::INDEX_NB_VISITS, 'desc')); - - return $table; - } - /** * Gets datatable displaying number of visits by Browser (Without version) * @param int $idSite diff --git a/plugins/Diagnostics/Diagnostic/DbMaxPacket.php b/plugins/Diagnostics/Diagnostic/DbMaxPacket.php index a771ba564d..65d2d5bcce 100644 --- a/plugins/Diagnostics/Diagnostic/DbMaxPacket.php +++ b/plugins/Diagnostics/Diagnostic/DbMaxPacket.php @@ -3,10 +3,10 @@ namespace Piwik\Plugins\Diagnostics\Diagnostic; use Piwik\Db; -use Piwik\MetricsFormatter; use Piwik\Piwik; use Piwik\SettingsPiwik; use Piwik\Translation\Translator; +use Piwik\Metrics\Formatter; /** * Check if Piwik is connected with database through ssl. @@ -40,7 +40,8 @@ class DbMaxPacket implements Diagnostic $minSize = self::MIN_VALUE_MAX_PACKET_MB * 1000 * 1000; // not using 1024 just in case... this amount be good enough if (!empty($maxPacketBytes['Value']) && $maxPacketBytes['Value'] < $minSize) { $status = DiagnosticResult::STATUS_WARNING; - $pretty = MetricsFormatter::getPrettySizeFromBytes($maxPacketBytes['Value'], 'M'); + $formatter = new Formatter\Html(); + $pretty = $formatter->getPrettySizeFromBytes($maxPacketBytes['Value'], 'M', $precision = 1); $configured = str_replace(array(' M', ' M'), 'MB', $pretty); $comment = Piwik::translate('Diagnostics_MysqlMaxPacketSizeWarning', array('64MB', $configured)); } diff --git a/plugins/ExampleAPI/API.php b/plugins/ExampleAPI/API.php index ba1d77c1b8..4e4a84de0f 100644 --- a/plugins/ExampleAPI/API.php +++ b/plugins/ExampleAPI/API.php @@ -32,16 +32,6 @@ class API extends \Piwik\Plugin\API return Version::VERSION; } - /** - * Get Matomo version - * @return string - * @deprecated - */ - public function getPiwikVersion() - { - return $this->getMatomoVersion(); - } - /** * Get Answer to Life * @return integer diff --git a/plugins/GeoIp2/GeoIP2AutoUpdater.php b/plugins/GeoIp2/GeoIP2AutoUpdater.php index 65903e94d7..3f2b7b1baf 100644 --- a/plugins/GeoIp2/GeoIP2AutoUpdater.php +++ b/plugins/GeoIp2/GeoIP2AutoUpdater.php @@ -8,8 +8,6 @@ */ namespace Piwik\Plugins\GeoIp2; -require_once PIWIK_INCLUDE_PATH . "/core/ScheduledTask.php"; // for the tracker which doesn't include this file - use Exception; use GeoIp2\Database\Reader; use Piwik\Common; diff --git a/plugins/GeoIp2/LocationProvider/GeoIp2.php b/plugins/GeoIp2/LocationProvider/GeoIp2.php index 3a17da686d..f418c035ef 100644 --- a/plugins/GeoIp2/LocationProvider/GeoIp2.php +++ b/plugins/GeoIp2/LocationProvider/GeoIp2.php @@ -21,8 +21,6 @@ use Piwik\Plugins\UserCountry\LocationProvider; */ abstract class GeoIp2 extends LocationProvider { - /** @deprecated */ - const GEO_LITE_URL = 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz'; const TEST_IP = '194.57.91.215'; const SWITCH_TO_ISO_REGIONS_OPTION_NAME = 'usercountry.switchtoisoregions'; @@ -113,24 +111,6 @@ abstract class GeoIp2 extends LocationProvider return StaticContainer::get('path.geoip2') . $filename; } - /** - * Returns test IP used by isWorking and expected result. - * - * @return array eg. array('1.2.3.4', array(self::COUNTRY_CODE_KEY => ...)) - * @deprecated - */ - protected function getTestIpAndResult() - { - static $result = null; - if (is_null($result)) { - $expected = array(self::COUNTRY_CODE_KEY => 'FR', - self::REGION_CODE_KEY => 'BFC', - self::CITY_NAME_KEY => 'Besançon'); - $result = array(self::TEST_IP, $expected); - } - return $result; - } - public function activate() { $option = Option::get(self::SWITCH_TO_ISO_REGIONS_OPTION_NAME); diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php index 0550c61e9b..e39b088f1d 100644 --- a/plugins/Goals/API.php +++ b/plugins/Goals/API.php @@ -54,8 +54,6 @@ use Piwik\Validators\WhitelistedValue; class API extends \Piwik\Plugin\API { const AVG_PRICE_VIEWED = 'avg_price_viewed'; - /** @deprecated Use VisitFrequency\API::NEW_VISITOR_SEGMENT */ - const NEW_VISIT_SEGMENT = 'visitorType==new'; /** * Return a single goal. diff --git a/plugins/LanguagesManager/API.php b/plugins/LanguagesManager/API.php index 59e6814916..5bc5628bbe 100644 --- a/plugins/LanguagesManager/API.php +++ b/plugins/LanguagesManager/API.php @@ -80,15 +80,6 @@ class API extends \Piwik\Plugin\API */ Piwik::postEvent('LanguagesManager.getAvailableLanguages', array(&$languages)); - /** - * Hook called after loading available language files. - * - * @param array - * - * @deprecated since v3.9.0 use LanguagesManager.getAvailableLanguages instead. Will be removed in Matomo 4.0.0 - */ - Piwik::postEvent('LanguageManager.getAvailableLanguages', array(&$languages)); - $this->languageNames = $languages; return $languages; } diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 883cab4c76..69eeff0c4e 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -123,28 +123,6 @@ class API extends \Piwik\Plugin\API return $show && !$hide; } - /** - * The same functionality can be obtained using segment=visitorId==$visitorId with getLastVisitsDetails - * - * @deprecated - * @ignore - * @param int $visitorId - * @param int $idSite - * @param int $filter_limit - * @param bool $flat Whether to flatten the visitor details array - * - * @return DataTable - */ - public function getLastVisitsForVisitor($visitorId, $idSite, $filter_limit = 10, $flat = false) - { - Piwik::checkUserHasViewAccess($idSite); - - $table = $this->loadLastVisitsDetailsFromDatabase($idSite, $period = false, $date = false, $segment = false, $offset = 0, $filter_limit, $minTimestamp = false, $filterSortOrder = false, $visitorId); - $this->addFilterToCleanVisitors($table, $idSite, $flat); - - return $table; - } - /** * Returns the last visits tracked in the specified website * You can define any number of filters: none, one, many or all parameters can be defined @@ -234,26 +212,6 @@ class API extends \Piwik\Plugin\API $profile = new VisitorProfile($idSite); $result = $profile->makeVisitorProfile($visits, $visitorId, $segment, $limitVisits); - /** - * Triggered in the Live.getVisitorProfile API method. Plugins can use this event - * to discover and add extra data to visitor profiles. - * - * This event is deprecated, use [VisitorDetails](/api-reference/Piwik/Plugins/Live/VisitorDetailsAbstract#extendVisitorDetails) classes instead. - * - * For example, if an email address is found in a custom variable, a plugin could load the - * gravatar for the email and add it to the visitor profile, causing it to display in the - * visitor profile popup. - * - * The following visitor profile elements can be set to augment the visitor profile popup: - * - * - **visitorAvatar**: A URL to an image to display in the top left corner of the popup. - * - **visitorDescription**: Text to be used as the tooltip of the avatar image. - * - * @param array &$visitorProfile The unaugmented visitor profile info. - * @deprecated - */ - Piwik::postEvent('Live.getExtraVisitorDetails', array(&$result)); - return $result; } @@ -327,14 +285,6 @@ class API extends \Piwik\Plugin\API return $dataTable; } - /** - * @deprecated - */ - public function getLastVisits($idSite, $filter_limit = 10, $minTimestamp = false) - { - return $this->getLastVisitsDetails($idSite, $period = false, $date = false, $segment = false, $filter_limit, $minTimestamp, $flat = false); - } - /** * For an array of visits, query the list of pages for this visit * as well as make the data human readable diff --git a/plugins/LogViewer b/plugins/LogViewer index 33bcbe0169..033e68f4d7 160000 --- a/plugins/LogViewer +++ b/plugins/LogViewer @@ -1 +1 @@ -Subproject commit 33bcbe01698ebe4e8f013018a816b04acfa924e2 +Subproject commit 033e68f4d76869597ebe9ffb8c4e0f1c5c26a3bf diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index a3bad430ba..4dde95f476 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -189,13 +189,5 @@ class Login extends \Piwik\Plugin && (Piwik::getAction() == '' || Piwik::getAction() == 'index'); } - /** - * @param $auth - * @deprecated authenticating via cookie is handled in core by SessionAuth - */ - public static function initAuthenticationFromCookie(\Piwik\Auth $auth, $activateCookieAuth) - { - // empty - } } diff --git a/plugins/Login/SessionInitializer.php b/plugins/Login/SessionInitializer.php index d8d304dc4b..64d24d177a 100644 --- a/plugins/Login/SessionInitializer.php +++ b/plugins/Login/SessionInitializer.php @@ -21,11 +21,6 @@ use Piwik\ProxyHttp; use Piwik\Session; /** - * This SessionInitializer is no longer used, but is kept for backwards compatibility. - * Session management no longer uses the piwik_auth cookie. - * - * @deprecated - * @api */ class SessionInitializer { diff --git a/plugins/ProfessionalServices/ProfessionalServices.php b/plugins/ProfessionalServices/ProfessionalServices.php index 77bf1d2118..a2d96f8b28 100644 --- a/plugins/ProfessionalServices/ProfessionalServices.php +++ b/plugins/ProfessionalServices/ProfessionalServices.php @@ -21,7 +21,6 @@ class ProfessionalServices extends \Piwik\Plugin { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'Request.getRenamedModuleAndAction' => 'renameProfessionalServicesModule', 'Template.afterGoalConversionOverviewReport' => array('function' => 'getGoalOverviewPromo', 'after' => true), 'Template.afterGoalCannotAddNewGoal' => array('function' => 'getGoalOverviewPromo', 'after' => true), 'Template.endGoalEditTable' => array('function' => 'getGoalFunnelOverviewPromo', 'after' => true), @@ -40,26 +39,6 @@ class ProfessionalServices extends \Piwik\Plugin $stylesheets[] = 'plugins/ProfessionalServices/stylesheets/widget.less'; } - /** - * @deprecated Can be removed in Piwik 3.0 - * @param $module - * @param $action - */ - public function renameProfessionalServicesModule(&$module, &$action) - { - if ($module == 'ProfessionalServices') { - $module = 'ProfessionalServices'; - - if($action == 'promoPiwikPro') { - $action = 'promoServices'; - } - - if ($action == 'rssPiwikPro') { - $action = 'rss'; - } - } - } - public function isRequestForDashboardWidget() { $isWidget = Common::getRequestVar('widget', 0, 'int'); diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php index 02d3cb6380..b343b9e83f 100644 --- a/plugins/Proxy/Controller.php +++ b/plugins/Proxy/Controller.php @@ -74,39 +74,6 @@ class Controller extends \Piwik\Plugin\Controller ProxyHttp::serverStaticFile($uiAsset->getAbsoluteLocation(), self::JS_MIME_TYPE); } - /** - * Output redirection page instead of linking directly to avoid - * exposing the referrer on the Piwik demo. - * - * @internal param string $url (via $_GET) - * @deprecated @since 3.6.0 - */ - public function redirect() - { - $url = Common::getRequestVar('url', '', 'string', $_GET); - if (!UrlHelper::isLookLikeUrl($url)) { - die('Please check the &url= parameter: it should to be a valid URL'); - } - // validate referrer - $referrer = Url::getReferrer(); - if (empty($referrer) || !Url::isLocalUrl($referrer)) { - 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 referrer. - -

You can access the page at: ' . $url); - } - - // mask visits to *.piwik.org - if (!self::isPiwikUrl($url)) { - Piwik::checkUserHasSomeViewAccess(); - } - Common::sendHeader('Content-Type: text/html; charset=utf-8'); - echo ''; - - exit; - } - /** * Validate URL against *.piwik.org domains * diff --git a/plugins/Referrers/API.php b/plugins/Referrers/API.php index 8bc75044f8..02a37f5e7e 100644 --- a/plugins/Referrers/API.php +++ b/plugins/Referrers/API.php @@ -27,7 +27,6 @@ use Piwik\Site; * For example, "getKeywords" returns all search engine keywords (with general analytics metrics for each keyword), "getWebsites" returns referrer websites (along with the full Referrer URL if the parameter &expanded=1 is set). * "getReferrerType" returns the Referrer overview report. "getCampaigns" returns the list of all campaigns (and all campaign keywords if the parameter &expanded=1 is set). * - * The methods "getKeywordsForPageUrl" and "getKeywordsForPageTitle" are used to output the top keywords used to find a page. * @method static \Piwik\Plugins\Referrers\API getInstance() */ class API extends \Piwik\Plugin\API @@ -255,29 +254,6 @@ class API extends \Piwik\Plugin\API : $label; } - /** - * @deprecated will be removed in Matomo 4.0.0 - */ - public function getKeywordsForPageUrl($idSite, $period, $date, $url) - { - // Fetch the Top keywords for this page - $segment = 'entryPageUrl==' . $url; - $table = $this->getKeywords($idSite, $period, $date, $segment); - $this->filterOutKeywordNotDefined($table); - return $this->getLabelsFromTable($table); - } - - /** - * @deprecated will be removed in Matomo 4.0.0 - */ - public function getKeywordsForPageTitle($idSite, $period, $date, $title) - { - $segment = 'entryPageTitle==' . $title; - $table = $this->getKeywords($idSite, $period, $date, $segment); - $this->filterOutKeywordNotDefined($table); - return $this->getLabelsFromTable($table); - } - /** * @param DataTable $table */ diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index 3ec7b13efc..207e40e196 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -306,33 +306,6 @@ class API extends \Piwik\Plugin\API } } - /** - * Returns the list of the website IDs that received some visits since the specified timestamp. - * Requires Super User access. - * - * @param bool|int $timestamp - * @return array The list of website IDs - * @deprecated since 2.15 This method will be removed in Matomo 3.0, there is no replacement. - */ - public function getSitesIdWithVisits($timestamp = false) - { - Piwik::checkUserHasSuperUserAccess(); - - if (empty($timestamp)) $timestamp = time(); - - $time = Date::factory((int)$timestamp)->getDatetime(); - $now = Date::now()->addHour(1)->getDatetime(); - - $result = $this->getModel()->getSitesWithVisits($time, $now); - - $idSites = array(); - foreach ($result as $idSite) { - $idSites[] = $idSite['idsite']; - } - - return $idSites; - } - /** * Returns the list of websites with the 'admin' access for the current user. * For the superUser it returns all the websites in the database. @@ -1061,29 +1034,6 @@ class API extends \Piwik\Plugin\API Cache::deleteTrackerCache(); } - /** - * Returns true if site-specific user agent exclusion has been enabled. If it hasn't, - * only the global user agent substrings (see @setGlobalExcludedUserAgents) will be used. - * - * @return bool - * @deprecated Will be removed in Matomo 4.0 - */ - public function isSiteSpecificUserAgentExcludeEnabled() - { - return true; - } - - /** - * Sets whether it should be allowed to exclude different user agents for different - * websites. - * - * @param bool $enabled - * @deprecated Will be removed in Matomo 4.0 - */ - public function setSiteSpecificUserAgentExcludeEnabled($enabled) - { - } - /** * Returns true if the default behavior is to keep URL fragments when tracking, * false if otherwise. diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php index 3af7c4f44c..5888aaf60e 100644 --- a/plugins/SitesManager/Controller.php +++ b/plugins/SitesManager/Controller.php @@ -100,20 +100,6 @@ class Controller extends \Piwik\Plugin\ControllerAdmin return $toReturn; } - /** - * User will download a file called PiwikTracker.php that is the content of the actual script - * - * @deprecated seems unused and PiwikTracker is now MatomoTracker - */ - function downloadPiwikTracker() - { - $path = PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/'; - $filename = 'PiwikTracker.php'; - Common::sendHeader('Content-type: text/php'); - Common::sendHeader('Content-Disposition: attachment; filename="' . $filename . '"'); - return file_get_contents($path . $filename); - } - public function ignoreNoDataMessage() { Piwik::checkUserHasSomeViewAccess(); diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php index 481dcd881f..97179241d8 100644 --- a/plugins/VisitsSummary/Controller.php +++ b/plugins/VisitsSummary/Controller.php @@ -40,22 +40,22 @@ class Controller extends \Piwik\Plugin\Controller /** * @deprecated used to be a widgetized URL. There to not break widget URLs */ - public function getSparklines() + public function index() { - $_GET['forceView'] = '1'; - $_GET['viewDataTable'] = Sparklines::ID; + $_GET['containerId'] = 'VisitOverviewWithGraph'; - return FrontController::getInstance()->fetchDispatch('VisitsSummary', 'get'); + return FrontController::getInstance()->fetchDispatch('CoreHome', 'renderWidgetContainer'); } /** * @deprecated used to be a widgetized URL. There to not break widget URLs */ - public function index() + public function getSparklines() { - $_GET['containerId'] = 'VisitOverviewWithGraph'; + $_GET['forceView'] = '1'; + $_GET['viewDataTable'] = Sparklines::ID; - return FrontController::getInstance()->fetchDispatch('CoreHome', 'renderWidgetContainer'); + return FrontController::getInstance()->fetchDispatch('VisitsSummary', 'get'); } public function getEvolutionGraph() diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index 57e914d362..c02f845cec 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -87,19 +87,9 @@ class Fixture extends \PHPUnit\Framework\Assert public $dbName = false; - /** - * @deprecated has no effect now. - */ - public $createConfig = true; - public $dropDatabaseInSetUp = true; public $dropDatabaseInTearDown = true; - /** - * @deprecated - */ - public $loadTranslations = true; - public $createSuperUser = true; public $removeExistingSuperUser = true; public $overwriteExisting = true; @@ -962,13 +952,6 @@ class Fixture extends \PHPUnit\Framework\Assert $dbConfig['dbname'] = $oldDbName; } - /** - * @deprecated - */ - public static function createAccessInstance() - { - } - public function dropDatabase($dbName = null) { $dbName = $dbName ?: $this->dbName ?: self::getConfig()->database_tests['dbname']; @@ -998,17 +981,6 @@ class Fixture extends \PHPUnit\Framework\Assert } } - /** - * @param $type - * @param bool $sanitize - * @deprecated Use XssTesting - */ - public static function makeXssContent($type, $sanitize = false) - { - $xssTesting = new XssTesting(); - return $xssTesting->forTwig($type, $sanitize); - } - public static function updateDatabase($force = false) { Cache::deleteTrackerCache(); diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php index 60a343aaf2..20ebb007bb 100644 --- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php +++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php @@ -773,22 +773,6 @@ abstract class SystemTestCase extends TestCase DbHelper::deleteArchiveTables(); } - /** - * @deprecated - */ - public function assertHttpResponseText($expectedResponseText, $url, $message = '') - { - self::assertThat($url, new HttpResponseText($expectedResponseText), $message); - } - - /** - * @deprecated - */ - public function assertResponseCode($expectedResponseCode, $url, $message = '') - { - self::assertThat($url, new ResponseCode($expectedResponseCode), $message); - } - public function assertNotDbConnectionCreated($message = 'A database connection was created but should not.') { self::assertFalse(Db::hasDatabaseObject(), $message); diff --git a/tests/PHPUnit/Framework/TestRequest/Collection.php b/tests/PHPUnit/Framework/TestRequest/Collection.php index 6082909351..0510b7df4b 100644 --- a/tests/PHPUnit/Framework/TestRequest/Collection.php +++ b/tests/PHPUnit/Framework/TestRequest/Collection.php @@ -314,10 +314,6 @@ class Collection ((strpos($methodName, 'get') !== 0 && $methodName != 'generateReport') || in_array($moduleName, $this->apiNotToCall) === true || in_array($apiId, $this->apiNotToCall) === true - || $methodName == 'getLogoUrl' - || $methodName == 'getSVGLogoUrl' - || $methodName == 'hasSVGLogo' - || $methodName == 'getHeaderLogoUrl' ) ) { // Excluded modules from test return true; diff --git a/tests/PHPUnit/Integration/Columns/DimensionTest.php b/tests/PHPUnit/Integration/Columns/DimensionTest.php index 6b4d375a9e..7b91fb09c6 100644 --- a/tests/PHPUnit/Integration/Columns/DimensionTest.php +++ b/tests/PHPUnit/Integration/Columns/DimensionTest.php @@ -278,14 +278,6 @@ class ColumnDimensionTest extends IntegrationTestCase $this->assertEquals("Test.DimensionTest", $this->dimension->getId()); } - public function test_factory_ShouldCreateDimensionFromDimensionId() - { - Manager::getInstance()->loadPlugins(array('ExampleTracker')); - - $dimension = Dimension::factory("ExampleTracker.ExampleDimension"); - $this->assertInstanceOf('Piwik\Plugins\ExampleTracker\Columns\ExampleDimension', $dimension); - } - /** * @dataProvider getFormatValueProvider diff --git a/tests/PHPUnit/Integration/Columns/DimensionsProviderTest.php b/tests/PHPUnit/Integration/Columns/DimensionsProviderTest.php new file mode 100644 index 0000000000..c1e89b9608 --- /dev/null +++ b/tests/PHPUnit/Integration/Columns/DimensionsProviderTest.php @@ -0,0 +1,38 @@ +provider = new DimensionsProvider(); + } + + public function test_factory() + { + Manager::getInstance()->loadPlugins(array('ExampleTracker')); + $dimension = $this->provider->factory("ExampleTracker.ExampleDimension"); + $this->assertInstanceOf('Piwik\Plugins\ExampleTracker\Columns\ExampleDimension', $dimension); + } + +} diff --git a/tests/PHPUnit/Integration/DbTest.php b/tests/PHPUnit/Integration/DbTest.php index c111ff312a..4c276d1eae 100644 --- a/tests/PHPUnit/Integration/DbTest.php +++ b/tests/PHPUnit/Integration/DbTest.php @@ -10,6 +10,7 @@ namespace Piwik\Tests\Integration; use Piwik\Common; use Piwik\Config; +use Piwik\DataAccess\TableMetadata; use Piwik\Db; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; @@ -124,7 +125,8 @@ class DbTest extends IntegrationTestCase private function assertColumnNames($tableName, $expectedColumnNames) { - $colmuns = Db::getColumnNamesFromTable(Common::prefixTable($tableName)); + $tableMetadataAccess = new TableMetadata(); + $colmuns = $tableMetadataAccess->getColumns(Common::prefixTable($tableName)); $this->assertEquals($expectedColumnNames, $colmuns); } diff --git a/tests/PHPUnit/Integration/FrontControllerTest.php b/tests/PHPUnit/Integration/FrontControllerTest.php index e0b1ff755c..8699da62ea 100644 --- a/tests/PHPUnit/Integration/FrontControllerTest.php +++ b/tests/PHPUnit/Integration/FrontControllerTest.php @@ -48,7 +48,7 @@ FORMAT; $this->assertEquals('error', $response['result']); $expectedFormat = <<assertStringMatchesFormat($expectedFormat, $response['message']); } diff --git a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php index aa8aca8522..981c223cdb 100644 --- a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php +++ b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php @@ -165,7 +165,6 @@ class BackwardsCompatibility1XTest extends SystemTestCase // those reports generate a different segment as a different raw value was stored that time 'DevicesDetection.getOsVersions', - 'DevicesDetection.getBrowserFamilies', 'DevicesDetection.getBrowserVersions', 'DevicesDetection.getBrowserEngines', 'DevicesDetection.getBrowsers', diff --git a/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php b/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php index 47e9d37b55..d805428d19 100644 --- a/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php +++ b/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php @@ -77,7 +77,7 @@ class PeriodIsRangeDateIsLastNMetadataAndNormalAPITest extends SystemTestCase 'testSuffix' => $testSuffix, 'otherRequestParameters' => array( 'lastMinutes' => 60 * 24 * 2, - 'visitorId' => $visitorId, // testing getLastVisitsForVisitor requires a visitor ID + 'visitorId' => $visitorId, 'hideColumns' => 'serverDate,lastActionTimestamp,lastActionDateTime,serverTimestamp,'. 'firstActionTimestamp,serverTimePretty,serverDatePretty,'. 'serverDatePrettyFirstAction,serverTimePrettyFirstAction' diff --git a/tests/PHPUnit/System/UrlNormalizationTest.php b/tests/PHPUnit/System/UrlNormalizationTest.php index 3b1fc15107..bcc66165d9 100644 --- a/tests/PHPUnit/System/UrlNormalizationTest.php +++ b/tests/PHPUnit/System/UrlNormalizationTest.php @@ -80,14 +80,6 @@ class UrlNormalizationTest extends SystemTestCase 'date' => $dateTime, 'segment' => 'referrerUrl==http://www.google.com/search?q=piwik', )); - $return[] = array('Referrers.getKeywordsForPageUrl', array( - 'testSuffix' => '_keywords', - 'idSite' => $idSite, - 'date' => $dateTime, - 'otherRequestParameters' => array( - 'url' => 'http://WWW.example.org/foo/bar.html' - ) - )); return $return; } diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png b/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png index 52b44fffcd..0b9237c8d1 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_api_listing.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:229a00c7fa3c345e213fd3a1f46072fa2e40868300934c8686d152863b1c4c67 -size 4941994 +oid sha256:9c1090b268fc8079be7251734ee6a3758453124e50bc6b7da48caf8a7bf7b31d +size 4934942 -- cgit v1.2.3