diff --git a/plugins/CoreConsole/Commands/GenerateController.php b/plugins/CoreConsole/Commands/GenerateController.php
deleted file mode 100644
index fb82b2d4518125d77720b1d7c024f985a7f2c690..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateController.php
+++ /dev/null
@@ -1,54 +0,0 @@
-setName('generate:controller')
- ->setDescription('Adds a Controller to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have a Controller yet');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $exampleFolder = Manager::getPluginDirectory('ExamplePlugin');
- $replace = array('ExamplePlugin' => $pluginName);
- $whitelistFiles = array('/Controller.php', '/templates', '/templates/index.twig');
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('Controller for %s generated.', $pluginName),
- 'You can now start adding Controller actions',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNamesHavingNotSpecificFile('Controller.php');
- $invalidName = 'You have to enter the name of an existing plugin which does not already have a Controller';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateDimension.php b/plugins/CoreConsole/Commands/GenerateDimension.php
deleted file mode 100644
index 72cff88261a18142927a8c5588ebee62d35debd0..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateDimension.php
+++ /dev/null
@@ -1,265 +0,0 @@
-setName('generate:dimension')
- ->setDescription('Adds a new dimension to an existing plugin. This allows you to persist new values during tracking.')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have a menu defined yet')
- ->addRequiredValueOption('type', null, 'Whether you want to create a "Visit", an "Action" or a "Conversion" dimension')
- ->addRequiredValueOption('dimensionname', null, 'A human readable name of the dimension which will be for instance visible in the UI')
- ->addRequiredValueOption('columnname', null, 'The name of the column in the MySQL database the dimension will be stored under')
- ->addRequiredValueOption('columntype', null, 'The MySQL type for your dimension, for instance "VARCHAR(255) NOT NULL".');
- }
-
- /**
- * @throws \InvalidArgumentException
- */
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $type = $this->getDimensionType();
- $dimensionName = $this->getDimensionName();
-
- if ('non-tracking-dimension' === $type) {
- $columnName = '';
- $columType = '';
- } else {
- $columnName = $this->getColumnName($type);
- $columType = $this->getColumnType();
- }
-
- $dimensionClassName = $this->getDimensionClassName($dimensionName);
- $translatedDimensionName = $this->makeTranslationIfPossible($pluginName, ucfirst($dimensionName));
-
- $exampleFolder = Manager::getPluginDirectory('ExampleTracker');
- $replace = array('example_action_dimension' => strtolower($columnName),
- 'example_visit_dimension' => strtolower($columnName),
- 'example_conversion_dimension' => strtolower($columnName),
- 'INTEGER(11) DEFAULT 0 NULL' => strtoupper($columType),
- 'VARCHAR(255) DEFAULT NULL' => strtoupper($columType),
- 'ExampleDimension' => $dimensionClassName,
- 'ExampleVisitDimension' => $dimensionClassName,
- 'ExampleActionDimension' => $dimensionClassName,
- 'ExampleConversionDimension' => $dimensionClassName,
- 'ExampleTracker_DimensionName' => $translatedDimensionName,
- 'ExampleTracker' => $pluginName,
- );
-
- $whitelistFiles = array('/Columns');
-
- if ('visit' == $type) {
- $whitelistFiles[] = '/Columns/ExampleVisitDimension.php';
- } elseif ('action' == $type) {
- $whitelistFiles[] = '/Columns/ExampleActionDimension.php';
- } elseif ('conversion' == $type) {
- $whitelistFiles[] = '/Columns/ExampleConversionDimension.php';
- } elseif ('non-tracking-dimension' == $type) {
- $whitelistFiles[] = '/Columns/ExampleDimension.php';
- } else {
- throw new \InvalidArgumentException('This dimension type is not available');
- }
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('Columns/%s.php for %s generated.', ucfirst($dimensionClassName), $pluginName),
- 'You should now implement the events within this file',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- private function getDimensionClassName($dimensionName)
- {
- $dimensionName = trim($dimensionName);
- $dimensionName = str_replace(' ', '', $dimensionName);
- $dimensionName = preg_replace("/[^A-Za-z0-9]/", '', $dimensionName);
-
- $dimensionName = ucfirst($dimensionName);
-
- return $dimensionName;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getDimensionName()
- {
- $input = $this->getInput();
-
- $validate = function ($dimensionName) {
- if (empty($dimensionName)) {
- throw new \InvalidArgumentException('Please enter the name of your dimension');
- }
-
- if (preg_match("/[^A-Za-z0-9 ]/", $dimensionName)) {
- throw new \InvalidArgumentException('Only alpha numerical characters and whitespaces are allowed');
- }
-
- return $dimensionName;
- };
-
- $dimensionName = $input->getOption('dimensionname');
-
- if (empty($dimensionName)) {
- $dimensionName = $this->askAndValidate(
- 'Enter a human readable name of your dimension, for instance "Browser": ',
- $validate
- );
- } else {
- $validate($dimensionName);
- }
-
- $dimensionName = ucfirst($dimensionName);
-
- return $dimensionName;
- }
-
- /**
- * @param string $type
- * @return string
- * @throws \RuntimeException
- */
- protected function getColumnName($type)
- {
- $input = $this->getInput();
-
- $validate = function ($columnName) use ($type) {
- if (empty($columnName)) {
- throw new \InvalidArgumentException('Please enter the name of the dimension column');
- }
-
- if (preg_match("/[^A-Za-z0-9_ ]/", $columnName)) {
- throw new \InvalidArgumentException('Only alpha numerical characters, underscores and whitespaces are allowed');
- }
-
- if ('visit' == $type) {
- $columns = array_keys(DbHelper::getTableColumns(Common::prefixTable('log_visit')));
- } elseif ('action' == $type) {
- $columns = array_keys(DbHelper::getTableColumns(Common::prefixTable('log_link_visit_action')));
- } elseif ('conversion' == $type) {
- $columns = array_keys(DbHelper::getTableColumns(Common::prefixTable('log_conversion')));
- } else {
- $columns = array();
- }
-
- foreach ($columns as $column) {
- if (strtolower($column) === strtolower($columnName)) {
- throw new \InvalidArgumentException('This column name is already in use.');
- }
- }
-
- return $columnName;
- };
-
- $columnName = $input->getOption('columnname');
-
- if (empty($columnName)) {
- $columnName = $this->askAndValidate(
- 'Enter the name of the column under which it should be stored in the MySQL database, for instance "visit_total_time": ',
- $validate
- );
- } else {
- $validate($columnName);
- }
-
- return $columnName;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getColumnType()
- {
- $input = $this->getInput();
-
- $validate = function ($columnType) {
- if (empty($columnType)) {
- throw new \InvalidArgumentException('Please enter the type of the dimension column');
- }
-
- return $columnType;
- };
-
- $columnType = $input->getOption('columntype');
-
- if (empty($columnType)) {
- $columnType = $this->askAndValidate(
- 'Enter the type of the column under which it should be stored in the MySQL database, for instance "VARCHAR(255) NOT NULL": ',
- $validate
- );
- } else {
- $validate($columnType);
- }
-
- return $columnType;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getDimensionType()
- {
- $input = $this->getInput();
- $acceptedValues = array('visit', 'action', 'conversion', 'non-tracking-dimension');
-
- $validate = function ($type) use ($acceptedValues) {
- if (empty($type) || !in_array($type, $acceptedValues)) {
- throw new \InvalidArgumentException('Please enter a valid dimension type (' . implode(', ', $acceptedValues) . '). Choose "non-tracking-dimension" if you only need a blank dimension having a name: ');
- }
-
- return $type;
- };
-
- $type = $input->getOption('type');
-
- if (empty($type)) {
- $type = $this->askAndValidate(
- 'Please choose the type of dimension you want to create (' . implode(
- ', ',
- $acceptedValues
- ) . '). Choose "non-tracking-dimension" if you only need a blank dimension having a name: ',
- $validate,
- null,
- $acceptedValues
- );
- } else {
- $validate($type);
- }
-
- return $type;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNames();
- $invalidName = 'You have to enter a name of an existing plugin.';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateMenu.php b/plugins/CoreConsole/Commands/GenerateMenu.php
deleted file mode 100644
index 8effe738c8556055029968e4b06a1b997f60f2e2..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateMenu.php
+++ /dev/null
@@ -1,54 +0,0 @@
-setName('generate:menu')
- ->setDescription('Adds a plugin menu class to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have a menu defined yet');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $exampleFolder = Manager::getPluginDirectory('ExamplePlugin');
- $replace = array('ExamplePlugin' => $pluginName);
- $whitelistFiles = array('/Menu.php');
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('Menu.php for %s generated.', $pluginName),
- 'You can now start defining your plugin menu',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNamesHavingNotSpecificFile('Menu.php');
- $invalidName = 'You have to enter the name of an existing plugin which does not already have a menu defined';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GeneratePlugin.php b/plugins/CoreConsole/Commands/GeneratePlugin.php
deleted file mode 100644
index 4d5dde035cb80b03f6d503c95b8b244cf7a36543..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GeneratePlugin.php
+++ /dev/null
@@ -1,198 +0,0 @@
-setName('generate:plugin')
- ->setAliases(array('generate:theme'))
- ->setDescription('Generates a new plugin/theme including all needed files')
- ->addRequiredValueOption('name', null, 'Plugin name ([a-Z0-9_-])')
- ->addRequiredValueOption('description', null, 'Plugin description, max 150 characters')
- ->addOptionalValueOption('pluginversion', null, 'Plugin version')
- ->addNoValueOption('overwrite', null, 'Generate even if plugin directory already exists.');
- }
-
- protected function doExecute(): int
- {
- $isTheme = $this->isTheme();
- $pluginName = $this->getPluginName();
- $description = $this->getPluginDescription();
- $version = $this->getPluginVersion();
-
- $this->generatePluginFolder($pluginName);
-
- $plugin = new ExamplePlugin();
- $info = $plugin->getInformation();
- $exampleDescription = $info['description'];
-
- if ($isTheme) {
- $exampleFolder = Plugin\Manager::getPluginDirectory('ExampleTheme');
- $replace = array(
- 'ExampleTheme' => $pluginName,
- $exampleDescription => $description,
- '0.1.0' => $version,
- '3.0.0-b1' => Version::VERSION,
- );
- $whitelistFiles = array();
- } else {
- $exampleFolder = Plugin\Manager::getPluginDirectory('ExamplePlugin');
- $replace = array(
- 'ExamplePlugin' => $pluginName,
- $exampleDescription => $description,
- '0.1.0' => $version,
- '3.0.0-b1' => Version::VERSION,
- );
- $whitelistFiles = array(
- '/ExamplePlugin.php',
- '/plugin.json',
- '/README.md',
- '/CHANGELOG.md',
- '/screenshots',
- '/screenshots/.gitkeep',
- '/docs',
- '/docs/faq.md',
- '/docs/index.md',
- '/config',
- '/config/config.php',
- '/config/tracker.php',
- );
- }
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- if ($isTheme) {
- $this->writeSuccessMessage(array(
- sprintf('Theme %s %s generated.', $pluginName, $version),
- 'If you have not done yet check out our Theming guide https://developer.matomo.org/guides/theming',
- 'Enjoy!',
- ));
- } else {
- $this->writeSuccessMessage(array(
- sprintf('Plugin %s %s generated.', $pluginName, $version),
- 'Our developer guides will help you developing this plugin, check out https://developer.matomo.org/guides',
- 'To see a list of available generators execute ./console list generate',
- 'Enjoy!',
- ));
- }
-
- return self::SUCCESS;
- }
-
- /**
- * @return bool
- */
- private function isTheme()
- {
- $commandName = $this->getInput()->getFirstArgument();
-
- return false !== strpos($commandName, 'theme');
- }
-
- protected function generatePluginFolder($pluginName)
- {
- $pluginPath = $this->getPluginPath($pluginName);
- Filesystem::mkdir($pluginPath);
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $overwrite = $this->getInput()->getOption('overwrite');
-
- $self = $this;
-
- $validate = function ($pluginName) use ($self, $overwrite) {
- if (empty($pluginName)) {
- throw new \RuntimeException('You have to enter a plugin name');
- }
-
- if (!Plugin\Manager::getInstance()->isValidPluginName($pluginName)) {
- throw new \RuntimeException(sprintf('The plugin name %s is not valid. The name must be no longer than 60 characters and start with a letter and is only allowed to contain numbers and letters.', $pluginName));
- }
-
- $pluginPath = $self->getPluginPath($pluginName);
-
- if (
- file_exists($pluginPath)
- && !$overwrite
- ) {
- throw new \RuntimeException('A plugin with this name already exists');
- }
-
- return $pluginName;
- };
-
- $pluginName = $this->getInput()->getOption('name');
-
- if (empty($pluginName)) {
- $pluginName = $this->askAndValidate('Enter a plugin name: ', $validate);
- } else {
- $validate($pluginName);
- }
-
- $pluginName = ucfirst($pluginName);
-
- return $pluginName;
- }
-
- /**
- * @return mixed
- * @throws \RuntimeException
- */
- protected function getPluginDescription()
- {
- $validate = function ($description) {
- if (empty($description)) {
- throw new \RuntimeException('You have to enter a description');
- }
- if (150 < strlen($description)) {
- throw new \RuntimeException('Description is too long, max 150 characters allowed.');
- }
-
- return $description;
- };
-
- $description = $this->getInput()->getOption('description');
-
- if (empty($description)) {
- $description = $this->askAndValidate('Enter a plugin description: ', $validate);
- } else {
- $validate($description);
- }
-
- return $description;
- }
-
- /**
- * @return string
- */
- protected function getPluginVersion()
- {
- $version = $this->getInput()->getOption('pluginversion');
-
- if (is_null($version)) {
- $version = $this->ask('Enter a plugin version number (default to 0.1.0): ', '0.1.0');
- }
-
- return $version;
- }
-}
diff --git a/plugins/CoreConsole/Commands/GeneratePluginBase.php b/plugins/CoreConsole/Commands/GeneratePluginBase.php
deleted file mode 100644
index 681207e749d5c837e1301816c7b00452196df38a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GeneratePluginBase.php
+++ /dev/null
@@ -1,431 +0,0 @@
-throwErrorIfNotGitInstalled();
- }
-
- public function isEnabled()
- {
- return Development::isEnabled();
- }
-
- public function getPluginPath($pluginName)
- {
- return Manager::getPluginDirectory($pluginName);
- }
-
- private function createFolderWithinPluginIfNotExists($pluginNameOrCore, $folder)
- {
- if ($pluginNameOrCore === 'core') {
- $pluginPath = $this->getPathToCore();
- } else {
- $pluginPath = $this->getPluginPath($pluginNameOrCore);
- }
-
- if (!file_exists($pluginPath . $folder)) {
- Filesystem::mkdir($pluginPath . $folder);
- }
- }
-
- protected function createFileWithinPluginIfNotExists($pluginNameOrCore, $fileName, $content)
- {
- if ($pluginNameOrCore === 'core') {
- $pluginPath = $this->getPathToCore();
- } else {
- $pluginPath = $this->getPluginPath($pluginNameOrCore);
- }
-
- if (!file_exists($pluginPath . $fileName)) {
- file_put_contents($pluginPath . $fileName, $content);
- }
- }
-
- /**
- * Creates a lang/en.json within the plugin in case it does not exist yet and adds a translation for the given
- * text.
- *
- * @param $pluginName
- * @param $translatedText
- * @param string $translationKey Optional, by default the key will be generated automatically
- * @return string Either the generated translation key or the original text if a different translation for this
- * generated translation key already exists.
- */
- protected function makeTranslationIfPossible($pluginName, $translatedText, $translationKey = '')
- {
- $defaultLang = array($pluginName => array());
-
- $this->createFolderWithinPluginIfNotExists($pluginName, '/lang');
- $this->createFileWithinPluginIfNotExists($pluginName, '/lang/en.json', $this->toJson($defaultLang));
-
- $langJsonPath = $this->getPluginPath($pluginName) . '/lang/en.json';
- $translations = file_get_contents($langJsonPath);
- $translations = json_decode($translations, true);
-
- if (empty($translations[$pluginName])) {
- $translations[$pluginName] = array();
- }
-
- if (!empty($translationKey)) {
- $key = $translationKey;
- } else {
- $key = $this->buildTranslationKey($translatedText);
- }
-
- if (array_key_exists($key, $translations[$pluginName])) {
- // we do not want to overwrite any existing translations
- if ($translations[$pluginName][$key] === $translatedText) {
- return $pluginName . '_' . $key;
- }
-
- return $translatedText;
- }
-
- $translations[$pluginName][$key] = $this->removeNonJsonCompatibleCharacters($translatedText);
-
- file_put_contents($langJsonPath, $this->toJson($translations));
-
- return $pluginName . '_' . $key;
- }
-
- protected function checkAndUpdateRequiredPiwikVersion($pluginName)
- {
- $output = $this->getOutput();
- $pluginJsonPath = $this->getPluginPath($pluginName) . '/plugin.json';
- $relativePluginJson = Manager::getPluginDirectory($pluginName) . '/plugin.json';
-
- if (!file_exists($pluginJsonPath) || !is_writable($pluginJsonPath)) {
- return;
- }
-
- $pluginJson = file_get_contents($pluginJsonPath);
- $pluginJson = json_decode($pluginJson, true);
-
- if (empty($pluginJson)) {
- return;
- }
-
- if (empty($pluginJson['require'])) {
- $pluginJson['require'] = array();
- }
-
- $piwikVersion = Version::VERSION;
- $nextMajorVersion = (int) substr($piwikVersion, 0, strpos($piwikVersion, '.')) + 1;
- $secondPartPiwikVersionRequire = ',<' . $nextMajorVersion . '.0.0-b1';
- if (false === strpos($piwikVersion, '-')) {
- // see https://github.com/composer/composer/issues/4080 we need to specify -stable otherwise it would match
- // $piwikVersion-dev meaning it would also match all pre-released. However, we only want to match a stable
- // release
- $piwikVersion .= '-stable';
- }
-
- $newRequiredVersion = sprintf('>=%s,<%d.0.0-b1', $piwikVersion, $nextMajorVersion);
-
- if (!empty($pluginJson['require']['piwik'])) {
- $pluginJson['require']['matomo'] = $pluginJson['require']['piwik'];
- unset($pluginJson['require']['piwik']);
- }
-
- if (!empty($pluginJson['require']['matomo'])) {
- $requiredVersion = trim($pluginJson['require']['matomo']);
-
- if ($requiredVersion === $newRequiredVersion) {
- // there is nothing to updated
- return;
- }
-
- // our generated versions look like ">=2.25.4,<3.0.0-b1".
- // We only updated the Piwik version in the first part if the piwik version looks like that or if it has only
- // one piwik version defined. In all other cases, eg user uses || etc we do not update it as user has customized
- // the piwik version.
-
- foreach (['<>','!=', '<=','==', '^'] as $comparison) {
- if (strpos($requiredVersion, $comparison) === 0) {
- // user is using custom piwik version require, we do not overwrite anything.
- return;
- }
- }
-
- if (strpos($requiredVersion, '||') !== false || strpos($requiredVersion, ' ') !== false) {
- // user is using custom piwik version require, we do not overwrite anything.
- return;
- }
-
- $requiredPiwikVersions = explode(',', (string) $requiredVersion);
- $numRequiredPiwikVersions = count($requiredPiwikVersions);
-
- if ($numRequiredPiwikVersions > 2) {
- // user is using custom piwik version require, we do not overwrite anything.
- return;
- }
-
- if (
- $numRequiredPiwikVersions === 2 &&
- !Common::stringEndsWith($requiredVersion, $secondPartPiwikVersionRequire)
- ) {
- // user is using custom piwik version require, we do not overwrite anything
- return;
- }
-
- // if only one piwik version is defined we update it to make sure it does now specify an upper version limit
-
- $dependency = new Dependency();
- $missingVersion = $dependency->getMissingVersions($piwikVersion, $requiredVersion);
-
- if (!empty($missingVersion)) {
- $msg = sprintf(
- 'We cannot generate this component as the plugin "%s" requires the Piwik version "%s" in the ' .
- 'file "%s". Generating this component requires "%s". If you know your plugin is compatible with your ' .
- 'Piwik version remove the required Piwik version in "%s" and try to execute this command again.',
- $pluginName,
- $requiredVersion,
- $relativePluginJson,
- $newRequiredVersion,
- $relativePluginJson
- );
-
- throw new \Exception($msg);
- }
-
- $output->writeln('');
- $output->writeln(sprintf(
- 'We have updated the required Piwik version from "%s" to "%s" in "%s".',
- $requiredVersion,
- $newRequiredVersion,
- $relativePluginJson
- ));
- } else {
- $output->writeln('');
- $output->writeln(sprintf(
- 'We have updated your "%s" to require the Piwik version "%s".',
- $relativePluginJson,
- $newRequiredVersion
- ));
- }
-
- $pluginJson['require']['matomo'] = $newRequiredVersion;
- file_put_contents($pluginJsonPath, $this->toJson($pluginJson));
- }
-
- private function toJson($value)
- {
- if (defined('JSON_PRETTY_PRINT')) {
- return json_encode($value, JSON_PRETTY_PRINT);
- }
-
- return json_encode($value);
- }
-
- private function buildTranslationKey($translatedText)
- {
- $translatedText = preg_replace('/(\s+)/', '', $translatedText);
- $translatedText = preg_replace("/[^A-Za-z0-9]/", '', $translatedText);
- $translatedText = trim($translatedText);
-
- return $this->removeNonJsonCompatibleCharacters($translatedText);
- }
-
- private function removeNonJsonCompatibleCharacters($text)
- {
- return preg_replace('/[^(\x00-\x7F)]*/', '', $text);
- }
-
- /**
- * Copies the given method and all needed use statements into an existing class. The target class name will be
- * built based on the given $replace argument.
- * @param string $sourceClassName
- * @param string $methodName
- * @param array $replace
- */
- protected function copyTemplateMethodToExisitingClass($sourceClassName, $methodName, $replace)
- {
- $targetClassName = $this->replaceContent($replace, $sourceClassName);
-
- if (Development::methodExists($targetClassName, $methodName)) {
- // we do not want to add the same method twice
- return;
- }
-
- Development::checkMethodExists($sourceClassName, $methodName, 'Cannot copy template method: ');
-
- $targetClass = new \ReflectionClass($targetClassName);
- $file = new \SplFileObject($targetClass->getFileName());
-
- $methodCode = Development::getMethodSourceCode($sourceClassName, $methodName);
- $methodCode = $this->replaceContent($replace, $methodCode);
- $methodLine = $targetClass->getEndLine() - 1;
-
- $sourceUses = Development::getUseStatements($sourceClassName);
- $targetUses = Development::getUseStatements($targetClassName);
- $usesToAdd = array_diff($sourceUses, $targetUses);
- if (empty($usesToAdd)) {
- $useCode = '';
- } else {
- $useCode = "\nuse " . implode("\nuse ", $usesToAdd) . "\n";
- }
-
- // search for namespace line before the class starts
- $useLine = 0;
- foreach (new \LimitIterator($file, 0, $targetClass->getStartLine()) as $index => $line) {
- if (0 === strpos(trim($line), 'namespace ')) {
- $useLine = $index + 1;
- break;
- }
- }
-
- $newClassCode = '';
- foreach (new \LimitIterator($file) as $index => $line) {
- if ($index == $methodLine) {
- $newClassCode .= $methodCode;
- }
-
- if (0 !== $useLine && $index == $useLine) {
- $newClassCode .= $useCode;
- }
-
- $newClassCode .= $line;
- }
-
- file_put_contents($targetClass->getFileName(), $newClassCode);
- }
-
- /**
- * @param string $templateFolder full path like /home/...
- * @param string $pluginName
- * @param array $replace array(key => value) $key will be replaced by $value in all templates
- * @param array $whitelistFiles If not empty, only given files/directories will be copied.
- * For instance array('/Controller.php', '/templates', '/templates/index.twig')
- */
- protected function copyTemplateToPlugin($templateFolder, $pluginName, array $replace = [], $whitelistFiles = [])
- {
- $replace['PLUGINNAME'] = $pluginName;
-
- $files = array_merge(
- Filesystem::globr($templateFolder, '*'),
- // Also copy files starting with . such as .gitignore
- Filesystem::globr($templateFolder, '.*')
- );
-
- foreach ($files as $file) {
- $fileNamePlugin = str_replace($templateFolder, '', $file);
-
- if (!empty($whitelistFiles) && !in_array($fileNamePlugin, $whitelistFiles)) {
- continue;
- }
-
- if (is_dir($file)) {
- $fileNamePlugin = $this->replaceContent($replace, $fileNamePlugin);
- $this->createFolderWithinPluginIfNotExists($pluginName, $fileNamePlugin);
- } else {
- $template = file_get_contents($file);
- $template = $this->replaceContent($replace, $template);
-
- $fileNamePlugin = $this->replaceContent($replace, $fileNamePlugin);
-
- $this->createFileWithinPluginIfNotExists($pluginName, $fileNamePlugin, $template);
- }
- }
- }
-
- protected function getPluginNames()
- {
- $pluginNames = array();
- foreach (Manager::getPluginsDirectories() as $pluginsDir) {
- $pluginDirs = \_glob($pluginsDir . '*', GLOB_ONLYDIR);
-
- foreach ($pluginDirs as $pluginDir) {
- $pluginNames[] = basename($pluginDir);
- }
- }
-
- return $pluginNames;
- }
-
- protected function getPluginNamesHavingNotSpecificFile($filename)
- {
- $pluginNames = array();
- foreach (Manager::getPluginsDirectories() as $pluginsDir) {
- $pluginDirs = \_glob($pluginsDir . '*', GLOB_ONLYDIR);
-
- foreach ($pluginDirs as $pluginDir) {
- if (!file_exists($pluginDir . '/' . $filename)) {
- $pluginNames[] = basename($pluginDir);
- }
- }
- }
- return $pluginNames;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function askPluginNameAndValidate($pluginNames, $invalidArgumentException)
- {
- $input = $this->getInput();
-
- $validate = function ($pluginName) use ($pluginNames, $invalidArgumentException) {
- if (!in_array($pluginName, $pluginNames)) {
- throw new \InvalidArgumentException($invalidArgumentException);
- }
-
- return $pluginName;
- };
-
- $pluginName = $input->getOption('pluginname');
-
- if (empty($pluginName)) {
- $pluginName = $this->askAndValidate('Enter the name of your plugin: ', $validate, false, $pluginNames);
- } else {
- $validate($pluginName);
- }
-
- return $pluginName;
- }
-
- private function getPathToCore()
- {
- $path = PIWIK_INCLUDE_PATH . '/core';
- return $path;
- }
-
- private function replaceContent($replace, $contentToReplace)
- {
- foreach ((array) $replace as $key => $value) {
- $contentToReplace = str_replace($key, $value, $contentToReplace);
- }
-
- return $contentToReplace;
- }
-
- protected function throwErrorIfNotGitInstalled()
- {
- if (!SettingsPiwik::isGitDeployment()) {
- $url = 'https://developer.matomo.org/guides/getting-started-part-1';
- throw new NotGitInstalledException(
- "This development feature requires Matomo to be checked out from git. For more information please visit {$url}."
- );
- }
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateReport.php b/plugins/CoreConsole/Commands/GenerateReport.php
deleted file mode 100644
index dba0f9c258040cf3d2506ab4ac6495f0d6a9d62b..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateReport.php
+++ /dev/null
@@ -1,311 +0,0 @@
-setName('generate:report')
- ->setDescription('Adds a new report to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have a menu defined yet')
- ->addRequiredValueOption('reportname', null, 'The name of the report you want to create')
- ->addRequiredValueOption('category', null, 'The name of the category the report belongs to')
- ->addOptionalValueOption('dimension', null, 'The name of the dimension in case your report has a dimension')
- ->addRequiredValueOption('documentation', null, 'A documentation that explains what your report is about');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $reportName = $this->getReportName();
- $category = $this->getCategory($pluginName);
- $documentation = $this->getDocumentation();
- [$dimension, $dimensionClass] = $this->getDimension($pluginName);
-
- $order = $this->getOrder($category);
- $apiName = $this->getApiName($reportName);
-
- $exampleFolder = Manager::getPluginDirectory('ExampleReport');
- $replace = array('GetExampleReport' => ucfirst($apiName),
- 'getExampleReport' => lcfirst($apiName),
- 'getApiReport' => lcfirst($apiName),
- 'ExampleCategory' => $category,
- 'ExampleReportName' => $this->makeTranslationIfPossible($pluginName, $reportName),
- 'ExampleReportDocumentation' => $documentation,
- '999' => $order,
- 'new ExitPageUrl()' => $dimension,
- 'use Piwik\Plugins\Actions\Columns\ExitPageUrl;' => $dimensionClass,
- 'ExampleReport' => $pluginName,
- );
-
- $whitelistFiles = array('/Reports', '/Reports/Base.php', '/Reports/GetExampleReport.php');
-
- if (file_exists($this->getPluginPath($pluginName) . '/API.php')) {
- $this->copyTemplateMethodToExisitingClass('Piwik\Plugins\ExampleReport\API', 'getExampleReport', $replace);
- } else {
- $whitelistFiles[] = '/API.php';
- }
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('plugins/%s/Reports/%s.php for %s generated.', $pluginName, ucfirst($apiName), $pluginName),
- 'You should now implement the method called "' . lcfirst($apiName) . '()" in API.php',
- // 'Read more about this here: link to developer guide',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- private function getOrder($category)
- {
- $order = 1;
-
- $reports = new ReportsProvider();
-
- foreach ($reports->getAllReports() as $report) {
- if ($report->getCategoryId() === $category) {
- if ($report->getOrder() > $order) {
- $order = $report->getOrder() + 1;
- }
- }
- }
-
- return $order;
- }
-
- private function getApiName($reportName)
- {
- $reportName = trim($reportName);
- $reportName = str_replace(' ', '', $reportName);
- $reportName = preg_replace("/[^A-Za-z0-9]/", '', $reportName);
-
- $apiName = 'get' . ucfirst($reportName);
-
- return $apiName;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getReportName()
- {
- $input = $this->getInput();
- $validate = function ($reportName) {
- if (empty($reportName)) {
- throw new \InvalidArgumentException('Please enter the name of your report');
- }
-
- if (preg_match("/[^A-Za-z0-9 ]/", $reportName)) {
- throw new \InvalidArgumentException('Only alpha numerical characters and whitespaces are allowed');
- }
-
- return $reportName;
- };
-
- $reportName = $input->getOption('reportname');
-
- if (empty($reportName)) {
- $reportName = $this->askAndValidate(
- 'Enter the name of your report, for instance "Browser Families": ',
- $validate
- );
- } else {
- $validate($reportName);
- }
-
- $reportName = ucfirst($reportName);
-
- return $reportName;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getDocumentation()
- {
- $input = $this->getInput();
- $validate = function ($documentation) {
- if (empty($documentation)) {
- return '';
- }
-
- return $documentation;
- };
-
- $documentation = $input->getOption('documentation');
-
- if (empty($documentation)) {
- $documentation = $this->askAndValidate(
- 'Enter a documentation that describes the data of your report (you can leave it empty and define it later): ',
- $validate
- );
- } else {
- $validate($documentation);
- }
-
- $documentation = ucfirst($documentation);
-
- return $documentation;
- }
-
- /**
- * @param string $pluginName
- * @return string
- * @throws \RuntimeException
- */
- protected function getCategory($pluginName)
- {
- $input = $this->getInput();
- $path = $this->getPluginPath($pluginName) . '/Reports/Base.php';
- if (file_exists($path)) {
- // category is already defined in base.php
- return '';
- }
-
- $validate = function ($category) {
- if (empty($category)) {
- throw new \InvalidArgumentException('Please enter the name of the category your report belongs to');
- }
-
- return $category;
- };
-
- $category = $input->getOption('category');
-
- $reports = new ReportsProvider();
-
- $categories = array();
- foreach ($reports->getAllReports() as $report) {
- if ($report->getCategoryId()) {
- $categories[] = Piwik::translate($report->getCategoryId());
- }
- }
- $categories = array_values(array_unique($categories));
-
- if (empty($category)) {
- $category = $this->askAndValidate(
- 'Enter the report category, for instance "Visitor" (you can reuse any existing category or define a new one): ',
- $validate,
- false,
- $categories
- );
- } else {
- $validate($category);
- }
-
- $translationKey = StaticContainer::get('Piwik\Translation\Translator')->findTranslationKeyForTranslation($category);
- if (!empty($translationKey)) {
- return $translationKey;
- }
-
- $category = ucfirst($category);
-
- return $category;
- }
-
- /**
- * @param string $pluginName
- * @return array
- * @throws \RuntimeException
- */
- protected function getDimension($pluginName)
- {
- $input = $this->getInput();
- $dimensions = array();
- $dimensionNames = array();
-
- $reports = new ReportsProvider();
-
- foreach ($reports->getAllReports() as $report) {
- $dimension = $report->getDimension();
- if (is_object($dimension)) {
- $name = $dimension->getName();
- if (!empty($name)) {
- $dimensions[$name] = get_class($dimension);
- $dimensionNames[] = $name;
- }
- }
- }
-
- $plugin = Manager::getInstance()->loadPlugin($pluginName);
- $dimensions = Dimension::getAllDimensions();
- $dimensions = array_merge($dimensions, Dimension::getDimensions($plugin));
-
- foreach ($dimensions as $dimension) {
- $name = $dimension->getName();
- if (!empty($name)) {
- $dimensions[$name] = get_class($dimension);
- $dimensionNames[] = $name;
- }
- }
-
- $dimensionNames = array_values(array_unique($dimensionNames));
-
- $validate = function ($dimension) use ($dimensions) {
- if (empty($dimension)) {
- return '';
- }
-
- if (!empty($dimension) && !array_key_exists($dimension, $dimensions)) {
- throw new \InvalidArgumentException('Leave dimension either empty or use an existing one. You can also create a new dimension by calling .console generate:dimension before generating this report.');
- }
-
- return $dimension;
- };
-
- $actualDimension = $input->getOption('dimension');
-
- if (null === $actualDimension) {
- $actualDimension = $this->askAndValidate(
- 'Enter the report dimension, for instance "Browser" (you can leave it either empty or use an existing one): ',
- $validate,
- null,
- $dimensionNames
- );
- } else {
- $validate($actualDimension);
- }
-
- if (empty($actualDimension)) {
- return array('null', '');
- }
-
- $className = $dimensions[$actualDimension];
- $parts = explode('\\', $className);
- $name = end($parts);
-
- return array('new ' . $name . '()', 'use ' . $className . ';');
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNames();
- $invalidName = 'You have to enter a name of an existing plugin.';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateScheduledTask.php b/plugins/CoreConsole/Commands/GenerateScheduledTask.php
deleted file mode 100644
index f7b119bca0dc99dcf8760af9b833c9fe6f2b8171..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateScheduledTask.php
+++ /dev/null
@@ -1,54 +0,0 @@
-setName('generate:scheduledtask')
- ->setDescription('Adds a tasks class to an existing plugin which allows you to specify scheduled tasks')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have any tasks defined yet');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $exampleFolder = Manager::getPluginDirectory('ExamplePlugin');
- $replace = array('ExamplePlugin' => $pluginName);
- $whitelistFiles = array('/Tasks.php');
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('Tasks.php for %s generated.', $pluginName),
- 'You can now start specifying your scheduled tasks',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNamesHavingNotSpecificFile('Tasks.php');
- $invalidName = 'You have to enter the name of an existing plugin which does not already have any tasks defined';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateSettings.php b/plugins/CoreConsole/Commands/GenerateSettings.php
deleted file mode 100644
index 70ec1773eeb9f264aff602e8c0bd97292942a810..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateSettings.php
+++ /dev/null
@@ -1,93 +0,0 @@
-setName('generate:settings')
- ->setDescription('Adds a SystemSetting, UserSetting or MeasurableSetting class to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have settings yet')
- ->addRequiredValueOption('settingstype', null, 'The type of settings you want to create. Should be one of these values: ' . implode(', ', $this->getSettingTypes()));
- }
-
- protected function doExecute(): int
- {
- $settingsType = $this->getSettingsType();
- $settingsFilename = $settingsType . '.php';
-
- $pluginName = $this->getPluginName($settingsType, $settingsFilename);
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $exampleFolder = Manager::getPluginDirectory('ExampleSettingsPlugin');
- $replace = array('ExampleSettingsPlugin' => $pluginName);
- $whitelistFiles = array('/' . $settingsFilename);
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('%s for %s generated.', $settingsFilename, $pluginName),
- 'You can now start defining your ' . $settingsType,
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- private function getSettingTypes()
- {
- return array('system', 'user', 'measurable');
- }
-
- private function getSettingsType()
- {
- $input = $this->getInput();
- $availableTypes = $this->getSettingTypes();
-
- $validate = function ($type) use ($availableTypes) {
- if (empty($type) || !in_array($type, $availableTypes)) {
- throw new \InvalidArgumentException('Please enter a valid settings type (' . implode(', ', $availableTypes) . '). ');
- }
-
- return $type;
- };
-
- $settingsType = $input->getOption('settingstype');
-
- if (empty($settingsType)) {
- $settingsType = $this->askAndValidate(
- 'Please choose the type of settings you want to create (' . implode(', ', $availableTypes) . '): ',
- $validate,
- null,
- $availableTypes
- );
- } else {
- $validate($settingsType);
- }
-
- return ucfirst($settingsType) . 'Settings';
- }
-
- /**
- * @param string $settingsType
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName($settingsType, $settingsFile)
- {
- $pluginNames = $this->getPluginNamesHavingNotSpecificFile($settingsFile);
- $invalidName = 'You have to enter the name of an existing plugin which does not already have ' . $settingsType;
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateSystemCheck.php b/plugins/CoreConsole/Commands/GenerateSystemCheck.php
deleted file mode 100644
index 964396668847d26fb53eeec2fb9b69a8b8546f28..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateSystemCheck.php
+++ /dev/null
@@ -1,103 +0,0 @@
-setName('generate:system-check')
- ->setDescription('Adds a new system check to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have a menu defined yet')
- ->addRequiredValueOption('checkname', null, 'The name of the system check you want to create');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $checkName = $this->getSystemCheckName();
- $className = ucfirst(str_replace(' ', '', $checkName));
- if (!Common::stringEndsWith($className, 'check') && !Common::stringEndsWith($className, 'Check')) {
- $className .= 'Check';
- }
-
- $exampleFolder = Manager::getPluginDirectory('ExamplePlugin');
- $replace = array('ExampleCheck' => $className,
- 'Example Check' => $checkName,
- 'ExamplePlugin' => $pluginName,
- );
-
- $whitelistFiles = array('/Diagnostic', '/Diagnostic/ExampleCheck.php');
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('plugins/%s/Diagnostic/%s.php for %s generated.', $pluginName, $className, $pluginName),
- sprintf('You should now implement the method called execute in %s.php', $className),
- 'You also need to make the diagnostic check known to Matomo in your "plugins/' . $pluginName . '/config/config.php".',
- 'Read more about this here: https://developer.matomo.org/guides/system-check',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getSystemCheckName()
- {
- $input = $this->getInput();
- $validate = function ($checkName) {
- if (empty($checkName)) {
- throw new \InvalidArgumentException('Please enter the name of your system check');
- }
-
- if (preg_match("/[^A-Za-z0-9 ]/", $checkName)) {
- throw new \InvalidArgumentException('Only alpha numerical characters and whitespaces are allowed');
- }
-
- return $checkName;
- };
-
- $checkName = $input->getOption('checkname');
-
- if (empty($checkName)) {
- $checkName = $this->askAndValidate(
- 'Enter the name of your system check, for example "PDF PHP Extension Check": ',
- $validate
- );
- } else {
- $validate($checkName);
- }
-
- $checkName = ucfirst($checkName);
-
- return $checkName;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNames();
- $invalidName = 'You have to enter a name of an existing plugin.';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateTest.php b/plugins/CoreConsole/Commands/GenerateTest.php
deleted file mode 100644
index 2d4194228bc48b2b1ace1403c299fae817c009ef..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateTest.php
+++ /dev/null
@@ -1,190 +0,0 @@
-setName('generate:test')
- ->setDescription('Adds a test to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin')
- ->addRequiredValueOption('testname', null, 'The name of the test to create')
- ->addRequiredValueOption('testtype', null, 'Whether you want to create a "unit", "integration", "system", or "ui" test');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $testType = $this->getTestType();
- $testName = $this->getTestName($testType);
-
- $exampleFolder = Manager::getPluginDirectory('ExamplePlugin');
- $replace = array(
- 'ExamplePlugin' => $pluginName,
- 'SimpleTest' => $testName,
- 'SimpleSystemTest' => $testName,
- 'SimpleUITest_spec.js' => $testName . '_spec.js',
- 'SimpleUITest' => $testName,
- );
-
- $whitelistFiles = $this->getTestFilesWhitelist($testType);
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $messages = array(
- sprintf('Test %s for plugin %s generated.', $testName, $pluginName),
- );
-
- if (strtolower($testType) === 'ui') {
- $messages[] = 'To run this test execute the command: ';
- $messages[] = '' . sprintf('./console tests:run-ui %s', $testName) . '';
- } else {
- $messages[] = 'To run all your plugin tests, execute the command: ';
- $messages[] = '' . sprintf('./console tests:run %s', $pluginName) . '';
- $messages[] = 'To run only this test: ';
- $messages[] = '' . sprintf('./console tests:run %s', $testName) . '';
- }
-
- $messages[] = 'Enjoy!';
-
- $this->writeSuccessMessage($messages);
-
- return self::SUCCESS;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- private function getTestName($testType)
- {
- $testname = $this->getInput()->getOption('testname');
-
- $validate = function ($testname) {
- if (empty($testname)) {
- throw new \InvalidArgumentException('You have to enter a valid test name ');
- }
-
- return $testname;
- };
-
- if (empty($testname)) {
- $testname = $this->askAndValidate('Enter the name of the test: ', $validate);
- } else {
- $validate($testname);
- }
-
- if (strtolower($testType) !== 'ui' && !Common::stringEndsWith(strtolower($testname), 'test')) {
- $testname = $testname . 'Test';
- }
-
- $testname = ucfirst($testname);
-
- return $testname;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNames();
- $invalidName = 'You have to enter the name of an existing plugin';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-
- public function getValidTypes()
- {
- return array('unit', 'integration', 'system', 'ui');
- }
-
- /**
- * @return string Unit, Integration, System
- */
- private function getTestType()
- {
- $testtype = $this->getInput()->getOption('testtype');
-
- $self = $this;
-
- $validate = function ($testtype) use ($self) {
- if (empty($testtype) || !in_array($testtype, $self->getValidTypes())) {
- throw new \InvalidArgumentException('You have to enter a valid test type: ' . implode(" or ", $self->getValidTypes()));
- }
- return $testtype;
- };
-
- if (empty($testtype)) {
- $testtype = $this->askAndValidate(
- 'Enter the type of the test to generate (' . implode(", ", $this->getValidTypes()) . '): ',
- $validate,
- null,
- $this->getValidTypes()
- );
- } else {
- $validate($testtype);
- }
-
- $testtype = ucfirst($testtype);
- return $testtype;
- }
-
- /**
- * @return array
- */
- protected function getTestFilesWhitelist($testType)
- {
- if ('Ui' == $testType) {
- return array(
- '/tests',
- '/tests/UI',
- '/tests/UI/.gitignore',
- '/tests/UI/expected-screenshots',
- '/tests/UI/expected-screenshots/.gitkeep',
- '/tests/UI/SimpleUITest_spec.js',
- );
- }
-
- if ('System' == $testType) {
- return array(
- '/.gitignore',
- '/tests',
- '/tests/System',
- '/tests/System/SimpleSystemTest.php',
- '/tests/System/expected',
- '/tests/System/expected/test___API.get_day.xml',
- '/tests/System/expected/test___Goals.getItemsSku_day.xml',
- '/tests/System/processed',
- '/tests/System/processed/.gitignore',
- '/tests/Fixtures',
- '/tests/Fixtures/SimpleFixtureTrackFewVisits.php',
- );
- }
-
- if ('Integration' == $testType) {
- return array(
- '/tests',
- '/tests/Integration',
- '/tests/Integration/SimpleTest.php',
- );
- }
-
- return array(
- '/tests',
- '/tests/Unit',
- '/tests/Unit/SimpleTest.php',
- );
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateUpdate.php b/plugins/CoreConsole/Commands/GenerateUpdate.php
deleted file mode 100644
index 2bbc03a132b0406fe580b57ff292480682d6a87e..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateUpdate.php
+++ /dev/null
@@ -1,120 +0,0 @@
-setName('generate:update')
- ->setDescription('Adds a new update to an existing plugin or "core"')
- ->addRequiredValueOption('component', null, 'The name of an existing plugin or "core"');
- }
-
- protected function doExecute(): int
- {
- $component = $this->getComponent();
-
- $version = $this->getVersion($component);
- $namespace = $this->getNamespace($component);
- $className = $this->getUpdateClassName($component, $version);
-
- $exampleFolder = Plugin\Manager::getPluginDirectory('ExamplePlugin');
- $replace = array('Piwik\Plugins\ExamplePlugin\Updates' => $namespace,
- 'ExamplePlugin' => $component,
- 'Updates_0_0_2' => $className,
- '0.0.2' => $version);
- $whitelistFiles = array('/Updates', '/Updates/0.0.2.php');
-
- $this->copyTemplateToPlugin($exampleFolder, $component, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('Updates/%s.php for %s generated.', $version, $component),
- 'You should have a look at the method update() or getSql() now.',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- private function getUpdateClassName($component, $version)
- {
- $updater = new Updater();
- $className = $updater->getUpdateClassName($component, $version);
- $parts = explode('\\', $className);
-
- return end($parts);
- }
-
- private function getVersion($component)
- {
- if ($component === 'core') {
- return Version::VERSION;
- }
-
- $pluginManager = Plugin\Manager::getInstance();
-
- if ($pluginManager->isPluginLoaded($component)) {
- $plugin = $pluginManager->getLoadedPlugin($component);
- } else {
- $plugin = new Plugin($component);
- }
-
- return $plugin->getVersion();
- }
-
- private function getNamespace($component)
- {
- $updater = new Updater();
- $className = $updater->getUpdateClassName($component, 'xx');
- $className = str_replace('Updates_xx', '', $className);
- $className = trim($className, '\\');
-
- return $className;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- private function getComponent()
- {
- $input = $this->getInput();
- $components = $this->getPluginNames();
- $components[] = 'core';
-
- $validate = function ($component) use ($components) {
- if (!in_array($component, $components)) {
- throw new \InvalidArgumentException('You have to enter a name of an existing plugin or "core".');
- }
-
- return $component;
- };
-
- $component = $input->getOption('component');
-
- if (empty($component)) {
- $component = $this->askAndValidate(
- 'Enter the name of your plugin or "core": ',
- $validate,
- null,
- $components
- );
- } else {
- $validate($component);
- }
-
- return $component;
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateVisualizationPlugin.php b/plugins/CoreConsole/Commands/GenerateVisualizationPlugin.php
deleted file mode 100644
index 32b42cfe96b5462e3a3d32b321abf0fe3daedc11..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateVisualizationPlugin.php
+++ /dev/null
@@ -1,88 +0,0 @@
-setName('generate:visualizationplugin')
- ->setDescription('Generates a new visualization plugin including all needed files')
- ->addRequiredValueOption('name', null, 'Plugin name ([a-Z0-9_-])')
- ->addRequiredValueOption('visualizationname', null, 'Visualization name ([a-Z0-9])')
- ->addRequiredValueOption('description', null, 'Plugin description, max 150 characters')
- ->addOptionalValueOption('pluginversion', null, 'Plugin version')
- ->addNoValueOption('overwrite', null, 'Generate even if plugin directory already exists.')
- ->addOptionalValueOption('full', null, 'If a value is set, an API and a Controller will be created as well. Option is only available for creating plugins, not for creating themes.');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
- $description = $this->getPluginDescription();
- $version = $this->getPluginVersion();
- $visualizationName = $this->getVisualizationName();
-
- $this->generatePluginFolder($pluginName);
-
- $exampleFolder = Manager::getPluginDirectory('ExampleVisualization');
- $replace = array(
- 'SimpleTable' => $visualizationName,
- 'simpleTable' => lcfirst($visualizationName),
- 'Simple Table' => $this->makeTranslationIfPossible($pluginName, $visualizationName),
- 'ExampleVisualization' => $pluginName,
- 'ExampleVisualizationDescription' => $description,
- );
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $allowListFiles = array());
-
- $this->writeSuccessMessage(array(
- sprintf('Visualization plugin %s %s generated.', $pluginName, $version),
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- private function getVisualizationName()
- {
- $input = $this->getInput();
- $validate = function ($visualizationName) {
- if (empty($visualizationName)) {
- throw new \RuntimeException('You have to enter a visualization name');
- }
-
- if (!ctype_alnum($visualizationName)) {
- throw new \RuntimeException(sprintf('The visualization name %s is not valid (only AlNum allowed)', $visualizationName));
- }
-
- return $visualizationName;
- };
-
- $visualizationName = $input->getOption('visualizationname');
-
- if (empty($visualizationName)) {
- $visualizationName = $this->askAndValidate('Enter a visualization name (only AlNum allowed): ', $validate);
- } else {
- $validate($visualizationName);
- }
-
- $visualizationName = ucfirst($visualizationName);
-
- return $visualizationName;
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateVueConstructBase.php b/plugins/CoreConsole/Commands/GenerateVueConstructBase.php
deleted file mode 100644
index 03a76f3b71a4b65bd4b77a65b40be9afa51377ab..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateVueConstructBase.php
+++ /dev/null
@@ -1,58 +0,0 @@
-getInput()->getOption($optionName);
-
- $validate = function ($testname) use ($constructType) {
- if (empty($testname)) {
- throw new \InvalidArgumentException("You have to enter a name for the $constructType");
- }
-
- if (!ctype_alnum($testname)) {
- throw new \InvalidArgumentException("Only alphanumeric characters are allowed as a $constructType "
- . "name. Use CamelCase if the name of your $constructType contains multiple words.");
- }
-
- return $testname;
- };
-
- if (empty($testname)) {
- $testname = $this->askAndValidate(
- "Enter the name of the $constructType you want to create: ",
- $validate
- );
- } else {
- $validate($testname);
- }
-
- $testname = ucfirst($testname);
-
- return $testname;
- }
-
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNames();
- $invalidName = 'You have to enter the name of an existing plugin';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GenerateWidget.php b/plugins/CoreConsole/Commands/GenerateWidget.php
deleted file mode 100644
index 213134ffee752dea53a7ba4a5aa2c197c0899795..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GenerateWidget.php
+++ /dev/null
@@ -1,172 +0,0 @@
-setName('generate:widget')
- ->setDescription('Adds a plugin widget class to an existing plugin')
- ->addRequiredValueOption('pluginname', null, 'The name of an existing plugin which does not have any widgets defined yet')
- ->addRequiredValueOption('widgetname', null, 'The name of the widget you want to create')
- ->addRequiredValueOption('category', null, 'The name of the category the widget should belong to');
- }
-
- protected function doExecute(): int
- {
- $pluginName = $this->getPluginName();
- $this->checkAndUpdateRequiredPiwikVersion($pluginName);
-
- $widgetName = $this->getWidgetName();
- $category = $this->getCategory();
-
- if ($category === Piwik::translate($category)) {
- // no translation found...
- $category = $this->makeTranslationIfPossible($pluginName, $category);
- }
-
- $widgetMethod = $this->getWidgetMethodName($widgetName);
- $widgetClass = ucfirst($widgetMethod);
-
- $exampleFolder = Manager::getPluginDirectory('ExamplePlugin');
- $replace = array('ExamplePlugin' => $pluginName,
- 'MyExampleWidget' => $widgetClass,
- 'Example Widget Name' => $this->makeTranslationIfPossible($pluginName, $widgetName),
- 'About Matomo' => $category);
- $whitelistFiles = array('/Widgets', '/Widgets/MyExampleWidget.php');
-
- $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
-
- $this->writeSuccessMessage(array(
- sprintf('plugins/%s/Widgets/%s.php generated.', $pluginName, $widgetClass),
- 'You can now start implementing the render() method.',
- 'Enjoy!',
- ));
-
- return self::SUCCESS;
- }
-
- private function getWidgetMethodName($methodName)
- {
- $methodName = trim($methodName);
- $methodName = str_replace(' ', '', $methodName);
- $methodName = preg_replace("/[^A-Za-z0-9]/", '', $methodName);
-
- if (0 !== strpos(strtolower($methodName), 'get')) {
- $methodName = 'get' . ucfirst($methodName);
- }
-
- return lcfirst($methodName);
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getWidgetName()
- {
- $validate = function ($widgetName) {
- if (empty($widgetName)) {
- throw new \InvalidArgumentException('Please enter the name of your widget');
- }
-
- if (preg_match("/[^A-Za-z0-9 ]/", $widgetName)) {
- throw new \InvalidArgumentException('Only alpha numerical characters and whitespaces are allowed');
- }
-
- return $widgetName;
- };
-
- $widgetName = $this->getInput()->getOption('widgetname');
-
- if (empty($widgetName)) {
- $widgetName = $this->askAndValidate(
- 'Enter the name of your Widget, for instance "Browser Families": ',
- $validate
- );
- } else {
- $validate($widgetName);
- }
-
- $widgetName = ucfirst($widgetName);
-
- return $widgetName;
- }
-
- protected function getExistingCategories()
- {
- $categories = array();
- foreach (WidgetsList::get()->getWidgetConfigs() as $widget) {
- if ($widget->getCategoryId()) {
- $categories[] = Piwik::translate($widget->getCategoryId());
- }
- }
- $categories = array_values(array_unique($categories));
-
- return $categories;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getCategory()
- {
- $input = $this->getInput();
- $validate = function ($category) {
- if (empty($category)) {
- throw new \InvalidArgumentException('Please enter the name of the category your widget should belong to');
- }
-
- return $category;
- };
-
- $category = $input->getOption('category');
- $categories = $this->getExistingCategories();
-
- if (empty($category)) {
- $category = $this->askAndValidate(
- 'Enter the widget category, for instance "Visitor" (you can reuse any existing category or define a new one): ',
- $validate,
- null,
- $categories
- );
- } else {
- $validate($category);
- }
-
- $translationKey = StaticContainer::get('Piwik\Translation\Translator')->findTranslationKeyForTranslation($category);
- if (!empty($translationKey)) {
- return $translationKey;
- }
-
- $category = ucfirst($category);
-
- return $category;
- }
-
- /**
- * @return string
- * @throws \RuntimeException
- */
- protected function getPluginName()
- {
- $pluginNames = $this->getPluginNames();
- $invalidName = 'You have to enter a name of an existing plugin.';
-
- return $this->askPluginNameAndValidate($pluginNames, $invalidName);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GetSegmentSql.php b/plugins/CoreConsole/Commands/GetSegmentSql.php
deleted file mode 100644
index 2f7372de26182338fffb3ab0c812441559224879..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GetSegmentSql.php
+++ /dev/null
@@ -1,108 +0,0 @@
-setName('development:get-segment-sql');
- $this->setDescription('Print out the SQL used to query for a segment. Used for debugging or diagnosing segment issues. The site ID and dates are hardcoded in the query.');
- $this->addRequiredValueOption('segment', null, 'The segment, correctly encoded.');
- $this->addRequiredValueOption('idSites', null, 'Comma separated list of site IDs for the segment. (optional)');
- $this->addRequiredValueOption('queryType', null, 'The query type to generate: visit, action or conversion');
- }
-
- protected function doExecute(): int
- {
- $input = $this->getInput();
- $output = $this->getOutput();
- $idSites = $input->getOption('idSites') ?: '';
- $idSites = explode(',', $idSites);
- $idSites = array_map('intval', $idSites);
- $idSites = array_filter($idSites);
-
- $queryType = $input->getOption('queryType');
-
- $segment = $input->getOption('segment');
- $segment = new Segment($segment, $idSites);
-
- $model = new Model();
- $allIdSites = $model->getSitesId();
- $idSiteInQuery = reset($allIdSites);
-
- $params = new Parameters(new Site($idSiteInQuery), Factory::build('day', 'today'), $segment);
-
- $logAggregator = new LogAggregator($params);
- switch ($queryType) {
- case 'visit':
- $query = $logAggregator->generateQuery(
- implode(LogAggregator::FIELDS_SEPARATOR, [
- Metrics::INDEX_NB_UNIQ_VISITORS => "count(distinct " . LogAggregator::LOG_VISIT_TABLE . ".idvisitor)",
- Metrics::INDEX_NB_VISITS => "count(*)",
- ]),
- [LogAggregator::LOG_VISIT_TABLE],
- $logAggregator->getWhereStatement(LogAggregator::LOG_VISIT_TABLE, LogAggregator::VISIT_DATETIME_FIELD),
- '',
- ''
- );
- break;
- case 'action':
- $query = $logAggregator->generateQuery(
- implode(LogAggregator::FIELDS_SEPARATOR, [
- Metrics::INDEX_NB_VISITS => "count(distinct " . LogAggregator::LOG_ACTIONS_TABLE . ".idvisit)",
- Metrics::INDEX_NB_UNIQ_VISITORS => "count(distinct " . LogAggregator::LOG_ACTIONS_TABLE . ".idvisitor)",
- Metrics::INDEX_NB_ACTIONS => "count(*)",
- ]),
- [LogAggregator::LOG_ACTIONS_TABLE],
- $logAggregator->getWhereStatement(LogAggregator::LOG_ACTIONS_TABLE, LogAggregator::ACTION_DATETIME_FIELD),
- '',
- ''
- );
- break;
- case 'conversion':
- $query = $logAggregator->generateQuery(
- implode(LogAggregator::FIELDS_SEPARATOR, [
- Metrics::INDEX_GOAL_NB_CONVERSIONS => "count(*)",
- Metrics::INDEX_GOAL_NB_VISITS_CONVERTED => "count(distinct " . LogAggregator::LOG_CONVERSION_TABLE . ".idvisit)",
- ]),
- [LogAggregator::LOG_CONVERSION_TABLE],
- $logAggregator->getWhereStatement(LogAggregator::LOG_CONVERSION_TABLE, LogAggregator::CONVERSION_DATETIME_FIELD),
- '',
- ''
- );
- break;
- default:
- throw new \InvalidArgumentException('Invalid value for --queryType, must be one of the following: visit, action, conversion');
- }
-
- $output->writeln("QUERY: " . $query['sql']);
- foreach ($query['bind'] as $key => $value) {
- $output->writeln(' BIND #' . $key . ': ' . $value);
- }
-
- return self::SUCCESS;
- }
-}
diff --git a/plugins/CoreConsole/Commands/GitCommit.php b/plugins/CoreConsole/Commands/GitCommit.php
deleted file mode 100644
index dcac773f3477bb4f3a448a8818ade0448639e6d8..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GitCommit.php
+++ /dev/null
@@ -1,146 +0,0 @@
-setName('git:commit')
- ->setDescription('Commit')
- ->addRequiredValueOption('message', 'm', 'Commit Message');
- }
-
- protected function doExecute(): int
- {
- $input = $this->getInput();
- $output = $this->getOutput();
- $submodules = $this->getSubmodulePaths();
-
- foreach ($submodules as $submodule) {
- if (empty($submodule)) {
- continue;
- }
-
- $status = $this->getStatusOfSubmodule($submodule);
- if (false !== strpos($status, '?? ')) {
- $output->writeln(sprintf('%s has untracked files or folders. Delete or add them and try again.', $submodule));
- $output->writeln('Status:');
- $output->writeln(sprintf('%s', $status));
- return self::FAILURE;
- }
- }
-
- $commitMessage = $input->getOption('message');
-
- if (empty($commitMessage)) {
- $output->writeln('No message specified. Use option -m or --message.');
- return self::FAILURE;
- }
-
- if (!$this->hasChangesToBeCommitted()) {
- $question = 'There are no changes to be committed in the super repo, do you just want to commit and converge submodules?';
- if (!$this->askForConfirmation($question, false)) {
- $output->writeln('Cool, nothing done. Stage files using "git add" and try again.');
- return self::SUCCESS;
- }
- }
-
- foreach ($submodules as $submodule) {
- if (empty($submodule)) {
- continue;
- }
-
- $status = $this->getStatusOfSubmodule($submodule);
- if (empty($status)) {
- $output->writeln(sprintf('%s has no changes, will ignore', $submodule));
- continue;
- }
-
- $cmd = sprintf('cd %s/%s && git pull && git add . && git commit -am "%s"', PIWIK_DOCUMENT_ROOT, $submodule, $commitMessage);
- $this->passthru($cmd);
- }
-
- if ($this->hasChangesToBeCommitted()) {
- $cmd = sprintf('cd %s && git commit -m "%s"', PIWIK_DOCUMENT_ROOT, $commitMessage);
- $this->passthru($cmd);
- }
-
- foreach ($submodules as $submodule) {
- if (empty($submodule)) {
- continue;
- }
-
- $cmd = sprintf('cd %s && git add %s', PIWIK_DOCUMENT_ROOT, $submodule);
- $this->passthru($cmd);
- }
-
- if ($this->hasChangesToBeCommitted()) {
- $cmd = sprintf('cd %s && git commit -m "Updating submodules"', PIWIK_DOCUMENT_ROOT);
- $this->passthru($cmd);
- }
-
- return self::SUCCESS;
- }
-
- private function passthru($cmd)
- {
- $this->getOutput()->writeln('Executing command: ' . $cmd);
- passthru($cmd);
- }
-
- private function hasChangesToBeCommitted()
- {
- $cmd = sprintf('cd %s && git status --porcelain', PIWIK_DOCUMENT_ROOT);
- $result = shell_exec($cmd);
- $result = trim($result);
-
- if (false !== strpos($result, 'M ')) {
- // stages
- return true;
- }
-
- if (false !== strpos($result, 'MM ')) {
- // staged and modified
- return true;
- }
-
- return false;
- }
-
- /**
- * @return array
- */
- private function getSubmodulePaths()
- {
- $cmd = sprintf("grep path .gitmodules | sed 's/.*= //'");
- $submodules = shell_exec($cmd);
- $submodules = explode("\n", $submodules);
-
- return $submodules;
- }
-
- protected function getStatusOfSubmodule($submodule)
- {
- $cmd = sprintf('cd %s/%s && git status --porcelain', PIWIK_DOCUMENT_ROOT, $submodule);
- $status = trim(shell_exec($cmd) ?? '');
-
- return $status;
- }
-}
diff --git a/plugins/CoreConsole/Commands/GitPull.php b/plugins/CoreConsole/Commands/GitPull.php
deleted file mode 100644
index c1167c68731326a8ac60abf057571d37fd1f355e..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GitPull.php
+++ /dev/null
@@ -1,57 +0,0 @@
-setName('git:pull');
- $this->setDescription('Pull Piwik repo and all submodules');
- }
-
- protected function getBranchName()
- {
- $cmd = sprintf('cd %s && git rev-parse --abbrev-ref HEAD', PIWIK_DOCUMENT_ROOT);
- $branch = shell_exec($cmd);
-
- return trim($branch);
- }
-
- protected function doExecute(): int
- {
- if ('master' != $this->getBranchName()) {
- $this->getOutput()->writeln('Doing nothing because you are not on the master branch in super repo.');
- return self::SUCCESS;
- }
-
- $cmd = sprintf('cd %s && git checkout master && git pull && git submodule update --init --recursive --remote', PIWIK_DOCUMENT_ROOT);
- $this->passthru($cmd);
-
- $cmd = 'git submodule foreach "(git checkout master; git pull)&"';
- $this->passthru($cmd);
-
- return self::SUCCESS;
- }
-
- private function passthru($cmd)
- {
- $this->getOutput()->writeln('Executing command: ' . $cmd);
- passthru($cmd);
- }
-}
diff --git a/plugins/CoreConsole/Commands/GitPush.php b/plugins/CoreConsole/Commands/GitPush.php
deleted file mode 100644
index b71f012bc07ca34ebba7eb02ac7d4106b7ce65ef..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/GitPush.php
+++ /dev/null
@@ -1,37 +0,0 @@
-setName('git:push');
- $this->setDescription('Push Piwik repo and all submodules');
- }
-
- protected function doExecute(): int
- {
- $cmd = sprintf('cd %s && git push --recurse-submodules=on-demand', PIWIK_DOCUMENT_ROOT);
- $this->getOutput()->writeln('Executing command: ' . $cmd);
- passthru($cmd);
-
- return self::SUCCESS;
- }
-}
diff --git a/plugins/CoreConsole/Commands/TestEmail.php b/plugins/CoreConsole/Commands/TestEmail.php
deleted file mode 100644
index 43d08a46b1e6c72ff6472cf85be1c92210bfdd70..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/TestEmail.php
+++ /dev/null
@@ -1,46 +0,0 @@
-setName('core:test-email');
- $this->setDescription('Send a test email');
- $this->addRequiredArgument('emailAddress', 'The destination email address');
- }
-
- protected function doExecute(): int
- {
- $config = Config::getInstance();
-
- $email = $this->getInput()->getArgument('emailAddress');
- $matomoUrl = SettingsPiwik::getPiwikUrl();
- $body = "Hello, world!
This is a test email sent from $matomoUrl";
- $subject = "This is a test email sent from $matomoUrl";
-
- $mail = new Mail();
- $mail->setSmtpDebug(true);
- $mail->addTo($email, 'Matomo User');
- $mail->setFrom($config->General['noreply_email_address'], $config->General['noreply_email_name']);
- $mail->setSubject($subject);
- $mail->setWrappedHtmlBody($body);
- $mail->send();
- $this->getOutput()->writeln('Message sent to ' . $email);
-
- return self::SUCCESS;
- }
-}
diff --git a/plugins/CoreConsole/Commands/WatchLog.php b/plugins/CoreConsole/Commands/WatchLog.php
deleted file mode 100644
index 72ad20b6be7a903cf9c5a8c7549d06d615e850c1..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/Commands/WatchLog.php
+++ /dev/null
@@ -1,33 +0,0 @@
-setName('log:watch');
- $this->setDescription('Outputs the last parts of the log files and follows as the log file grows. Does not work on Windows');
- }
-
- protected function doExecute(): int
- {
- $path = StaticContainer::get('path.tmp') . '/logs/';
- $cmd = sprintf('tail -f %s*.log', $path);
-
- $this->getOutput()->writeln('Executing command: ' . $cmd);
- passthru($cmd);
-
- return self::SUCCESS;
- }
-}
diff --git a/plugins/CoreConsole/CoreConsole.php b/plugins/CoreConsole/CoreConsole.php
deleted file mode 100644
index 7d22ee01fb4f29d2c08beede26bde6cc38938bca..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/CoreConsole.php
+++ /dev/null
@@ -1,14 +0,0 @@
-idSite, '2012-08-09 16:00:00');
- if ($ip) {
- $t->setIp($ip);
- }
- $t->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148');
- $t->setUrl('http://pastwebsite.com/here/we/go');
- Fixture::checkResponse($t->doTrackPageView('a page title'));
-
- // update ts_archived for archives in 2012_08 so they will be invalidated and rearchived
- $sql = "UPDATE " . ArchiveTableCreator::getNumericTable(Date::factory('2012-08-01'), true) . " SET ts_archived = ?";
- Db::query($sql, [Date::now()->subHour(2)->getDatetime()]);
- }
-
- private static function addNewSegmentToPast()
- {
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
- self::$fixture->getTestEnvironment()->save();
-
- Rules::setBrowserTriggerArchiving(false);
-
- // add one segment and set it's created/updated time to some time in the past so we don't re-archive for it
- $idSegment = API::getInstance()->add(self::NEW_SEGMENT_NAME, self::NEW_SEGMENT, self::$fixture->idSite, $autoArchive = 1, $enabledAllUsers = 1);
-
- // add another segment w/ special encoded value (but do it through the API which will use a definition query param which is not
- // encoded the same as Request::getRawSegmentFromRequest()
- $url = Fixture::getTestRootUrl() . '?' . http_build_query([
- 'module' => 'API',
- 'method' => 'SegmentEditor.add',
- 'name' => self::ENCODED_SEGMENT_NAME,
- 'definition' => self::ENCODED_SEGMENT,
- 'idSite' => self::$fixture->idSite,
- 'autoArchive' => 1,
- 'enabledAllUsers' => 1,
- 'format' => 'json',
- 'token_auth' => Fixture::getTokenAuth(),
- ]);
- self::assertStringContainsString(urlencode(self::ENCODED_SEGMENT), $url);
-
- $idSegment2 = Http::sendHttpRequest($url, 10);
- $idSegment2 = json_decode($idSegment2, $isAssoc = true);
- $idSegment2 = $idSegment2['value'];
-
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 1;
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 1);
- self::$fixture->getTestEnvironment()->save();
-
- Rules::setBrowserTriggerArchiving(true);
-
- Db::exec("UPDATE " . Common::prefixTable('segment') . ' SET ts_created = \'2015-01-02 00:00:00\', ts_last_edit = \'2015-01-02 00:00:00\' WHERE idsegment IN (' . $idSegment . ", " . $idSegment2 . ")");
- }
-
- private static function trackVisitsForToday()
- {
- $startTime = Date::today()->addHour(12)->getDatetime();
-
- $t = Fixture::getTracker(self::$fixture->idSite, $startTime);
- $t->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148');
- $t->setUrl('http://awebsite.com/here/we/go');
- Fixture::checkResponse($t->doTrackPageView('a page title'));
-
- $t->setUrl('http://awebsite.com/another/page');
- $t->setForceVisitDateTime(Date::factory($startTime)->addHour(1));
- Fixture::checkResponse($t->doTrackPageView('a second page title'));
- }
-
- public function getApiForTesting()
- {
- $apiRequiringSegments = ['Goals.get', 'VisitFrequency.get'];
-
- $results = array();
-
- foreach (self::$fixture->getDefaultSegments() as $segmentName => $info) {
- $results[] = array('VisitsSummary.get', array('idSite' => 'all',
- 'date' => '2012-08-09',
- 'periods' => array('day', 'week', 'month', 'year'),
- 'segment' => $info['definition'],
- 'testSuffix' => '_' . $segmentName));
- }
-
- $results[] = array('VisitsSummary.get', array('idSite' => 'all',
- 'date' => 'today',
- 'periods' => ['day', 'week', 'month', 'year'],
- 'segment' => self::NEW_SEGMENT,
- 'testSuffix' => '_' . self::NEW_SEGMENT_NAME));
-
- $results[] = array('VisitsSummary.get', array('idSite' => 'all',
- 'date' => 'today',
- 'periods' => ['day', 'week', 'month', 'year'],
- 'segment' => self::ENCODED_SEGMENT,
- 'testSuffix' => '_' . self::ENCODED_SEGMENT_NAME));
-
- // ExamplePlugin metric
- $results[] = ['ExamplePlugin.getExampleArchivedMetric', [
- 'idSite' => 'all',
- 'date' => '2007-04-05',
- 'periods' => ['day', 'week'],
- ]];
- $results[] = ['Actions.get', [
- 'idSite' => 'all',
- 'date' => '2007-04-05',
- 'periods' => ['day', 'week'],
- 'testSuffix' => '_examplePluginNoMetricsBecauseNoOtherPluginsArchived',
- ]];
-
- // API Call Without segments
- $results[] = array('VisitsSummary.get', array('idSite' => 'all',
- 'date' => '2012-08-09',
- 'periods' => array('day', 'month', 'year', 'week')));
-
- $results[] = array($apiRequiringSegments, array('idSite' => 'all',
- 'date' => '2012-08-09',
- 'periods' => array('month')));
-
- $results[] = array('VisitsSummary.get', array('idSite' => 'all',
- 'date' => '2012-08-09',
- 'periods' => array('day', 'week', 'month', 'year'),
- 'segment' => 'browserCode==EP',
- 'testSuffix' => '_nonPreArchivedSegment'));
-
- $segments = array(ManySitesImportedLogs::SEGMENT_PRE_ARCHIVED,
- ManySitesImportedLogs::SEGMENT_PRE_ARCHIVED_CONTAINS_ENCODED,
- );
- foreach ($segments as $index => $segment) {
- // Test with a pre-processed segment
- $results[] = array(array('VisitsSummary.get', 'Live.getLastVisitsDetails', 'VisitFrequency.get'),
- array('idSite' => '1',
- 'date' => '2012-08-09',
- 'periods' => array('day', 'year'),
- 'segment' => $segment,
- 'testSuffix' => '_preArchivedSegment' . $index,
- 'otherRequestParameters' => array(
- 'hideColumns' => 'latitude,longitude',
- ),
- 'xmlFieldsToRemove' => array(
- 'fingerprint',
- ),
- ),
- );
- }
-
- return $results;
- }
-
- public function testArchivePhpCron()
- {
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'browser_archiving_disabled_enforce', 1);
- self::$fixture->getTestEnvironment()->save();
-
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
- Config::getInstance()->General['browser_archiving_disabled_enforce'] = 1;
-
- Rules::setBrowserTriggerArchiving(false);
-
- $dateToTest = '2007-04-05';
-
- // invalidate exampleplugin only archives in past
- $invalidator = StaticContainer::get(ArchiveInvalidator::class);
- $invalidator->markArchivesAsInvalidated(
- [1],
- [$dateToTest],
- 'day',
- new Segment('', [1]),
- false,
- false,
- 'ExamplePlugin'
- );
-
- // track a visit in 2007-04-05 so it will fully archive (ExamplePlugin wouldn't archive without visit)
- $tracker = Fixture::getTracker(1, $dateToTest);
- $tracker->setUrl('http://example.com/test/url');
- Fixture::checkResponse($tracker->doTrackPageView('abcdefg'));
-
- $invalidationEntries = $this->getInvalidatedArchiveTableEntries();
- // there should be 4 invalidations (day, week, month, year) for ExamplePlugin
- self::assertCount(4, $invalidationEntries);
- self::assertEquals(['done.ExamplePlugin'], array_unique(array_column($invalidationEntries, 'name')));
-
- // empty the list so nothing is invalidated during core:archive (so we only archive ExamplePlugin and not all plugins)
- $invalidator->forgetRememberedArchivedReportsToInvalidate(1, Date::factory($dateToTest));
-
- $this->runArchivePhpCron();
-
- $table = ArchiveTableCreator::getNumericTable(Date::factory($dateToTest), true);
- $doneFlags = Db::fetchAll("SELECT `period`, `date1`, `date2`, `value` FROM `$table` WHERE name LIKE 'done.ExamplePlugin%' ORDER BY `period` ASC , `date1` ASC, `date2` ASC");
- $expectedDoneFlags = [
- ['period' => Day::PERIOD_ID, 'date1' => '2007-04-05', 'date2' => '2007-04-05', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Week::PERIOD_ID, 'date1' => '2007-04-02', 'date2' => '2007-04-08', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Month::PERIOD_ID, 'date1' => '2007-04-01', 'date2' => '2007-04-30', 'value' => ArchiveWriter::DONE_OK],
- // Year flag is stored in other table
- ];
- self::assertEquals($expectedDoneFlags, $doneFlags);
-
- // add new segment w/ edited created/edit time so it will not trigger segment re-archiving, then track a visit
- // so the segments will be archived w/ other invalidation. this also runs core:archive forcing CURL requests.
- try {
- self::forceCurlCliMulti();
- self::addNewSegmentToPast();
- self::trackVisitsForToday();
- self::trackVisitInPast(); // tracks visit on 2012-08-09, so we end up invalidating and rearchiving a past month
- $output = $this->runArchivePhpCron();
- } finally {
- self::undoForceCurlCliMulti();
- }
-
- // re archiving should not produce any ExamplePlugin specific archives, but 382 done flags for certain periods and segments
- $table = ArchiveTableCreator::getNumericTable(Date::factory('2012-08-09'), true);
- self::assertEquals(0, Db::fetchOne("SELECT count(*) FROM `$table` WHERE name LIKE 'done.ExamplePlugin%'"));
- self::assertEquals(382, Db::fetchOne("SELECT count(*) FROM `$table` WHERE name LIKE 'done%'"));
-
- foreach ($this->getApiForTesting() as $testInfo) {
- [$api, $params] = $testInfo;
-
- if (!isset($params['testSuffix'])) {
- $params['testSuffix'] = '';
- }
- $params['testSuffix'] .= '_noOptions';
- $params['disableArchiving'] = true;
-
- $success = $this->runApiTests($api, $params);
-
- if (!$success) {
- var_dump($output);
- }
- }
- }
-
- /**
- * @depends testArchivePhpCron
- */
- public function testArchivePhpCronWithSingleReportRearchive()
- {
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'browser_archiving_disabled_enforce', 1);
- self::$fixture->getTestEnvironment()->save();
-
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
- Config::getInstance()->General['browser_archiving_disabled_enforce'] = 1;
-
- Rules::setBrowserTriggerArchiving(false);
-
- // request a different date than other tests so we can test that only the single requested metric is archived
- $dateToRequest = '2007-04-04';
-
- // track a visit so archiving will go through
- $tracker = Fixture::getTracker(1, $dateToRequest);
- $tracker->setUrl('http://example.com/test/url2');
- Fixture::checkResponse($tracker->doTrackPageView('jkl'));
-
- $invalidator = StaticContainer::get(ArchiveInvalidator::class);
- $invalidator->forgetRememberedArchivedReportsToInvalidate(1, Date::factory($dateToRequest));
-
- $table = ArchiveTableCreator::getNumericTable(Date::factory($dateToRequest), true);
-
- // three whole plugin archives from previous tests
- $doneFlags = Db::fetchAll("SELECT `period`, `date1`, `date2`, `value` FROM `$table` WHERE name LIKE 'done.ExamplePlugin%' ORDER BY `period` ASC , `date1` ASC, `date2` ASC, `value` ASC");
- $expectedDoneFlags = [
- ['period' => Day::PERIOD_ID, 'date1' => '2007-04-05', 'date2' => '2007-04-05', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Week::PERIOD_ID, 'date1' => '2007-04-02', 'date2' => '2007-04-08', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Month::PERIOD_ID, 'date1' => '2007-04-01', 'date2' => '2007-04-30', 'value' => ArchiveWriter::DONE_OK],
- // Year flag is stored in other table
- ];
- self::assertEquals($expectedDoneFlags, $doneFlags);
-
- // invalidate a report so we get a partial archive (using the metric that gets incremented each time it is archived)
- // (do it after the last run so we don't end up just re-using the ExamplePlugin archive)
- $invalidator->markArchivesAsInvalidated([1], [$dateToRequest], 'day', new Segment('', [1]), false, false, 'ExamplePlugin.ExamplePlugin_example_metric');
-
- $output = $this->runArchivePhpCron(['-vvv' => null]);
-
- $this->runApiTests('ExamplePlugin.getExampleArchivedMetric', [
- 'idSite' => 'all',
- 'date' => $dateToRequest,
- 'periods' => ['day', 'week'],
- 'testSuffix' => '_singleMetric',
- ]);
-
- // test that latest archives for ExamplePlugin are partial
- $doneFlags = Db::fetchAll("SELECT `period`, `date1`, `date2`, `value` FROM `$table` WHERE name LIKE 'done.ExamplePlugin%' ORDER BY `period` ASC , `date1` ASC, `date2` ASC, `value` ASC");
- $expectedDoneFlags = [
- ['period' => Day::PERIOD_ID, 'date1' => '2007-04-04', 'date2' => '2007-04-04', 'value' => ArchiveWriter::DONE_PARTIAL],
- ['period' => Day::PERIOD_ID, 'date1' => '2007-04-05', 'date2' => '2007-04-05', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Week::PERIOD_ID, 'date1' => '2007-04-02', 'date2' => '2007-04-08', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Week::PERIOD_ID, 'date1' => '2007-04-02', 'date2' => '2007-04-08', 'value' => ArchiveWriter::DONE_PARTIAL],
- ['period' => Month::PERIOD_ID, 'date1' => '2007-04-01', 'date2' => '2007-04-30', 'value' => ArchiveWriter::DONE_OK],
- ['period' => Month::PERIOD_ID, 'date1' => '2007-04-01', 'date2' => '2007-04-30', 'value' => ArchiveWriter::DONE_PARTIAL],
- ];
- self::assertEquals($expectedDoneFlags, $doneFlags);
- }
-
- /**
- * @depends testArchivePhpCronWithSingleReportRearchive
- */
- public function testArchivePhpCronArchivesFullRanges()
- {
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'archiving_range_force_on_browser_request', 0);
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'archiving_custom_ranges', ['2012-08-09,2012-08-13']);
- self::$fixture->getTestEnvironment()->save();
-
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
- Config::getInstance()->General['archiving_range_force_on_browser_request'] = 0;
- Config::getInstance()->General['archiving_custom_ranges'][] = '';
-
- Rules::setBrowserTriggerArchiving(false);
-
- $output = $this->runArchivePhpCron(['--force-periods' => 'range', '--force-idsites' => 1]);
-
- $expectedInvalidations = [];
- $invalidationEntries = $this->getInvalidatedArchiveTableEntries();
-
- $invalidationEntries = array_filter($invalidationEntries, function ($entry) {
- return $entry['period'] == 5;
- });
-
- $this->assertEquals($expectedInvalidations, $invalidationEntries);
-
- $this->runApiTests(
- array(
- 'VisitsSummary.get', 'Actions.get', 'DevicesDetection.getType'),
- array('idSite' => '1',
- 'date' => '2012-08-09,2012-08-13',
- 'periods' => array('range'),
- 'testSuffix' => '_range_archive')
- );
- }
-
- /**
- * @depends testArchivePhpCronArchivesFullRanges
- */
- public function testRangeBrowserArchivingWorksWhenInvalidatedByVisit()
- {
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
- // remove the value, since the default is to always force archiving on browser request
- self::$fixture->getTestEnvironment()->removeOverriddenConfig('General', 'archiving_range_force_on_browser_request');
- self::$fixture->getTestEnvironment()->save();
-
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
- unset(Config::getInstance()->General['archiving_range_force_on_browser_request']);
-
- $table = ArchiveTableCreator::getNumericTable(Date::factory('2012-08-09'), true);
- $blobTable = ArchiveTableCreator::getBlobTable(Date::factory('2012-08-09'), true);
-
- // remove existing range archives
- $idArchives = Db::fetchAll("SELECT DISTINCT idarchive FROM `$table` WHERE period = 5");
- $idArchives = array_column($idArchives, 'idarchive');
-
- $model = new Model();
- $model->deleteArchiveIds($table, $blobTable, $idArchives);
-
- // process archives once
- $this->runApiTests(
- array(
- 'VisitsSummary.get', 'Actions.get', 'DevicesDetection.getType'),
- array('idSite' => '1',
- 'date' => '2012-08-09,2012-08-13',
- 'periods' => array('range'),
- 'testSuffix' => '_range_archive_before_invalidate')
- );
-
- $this->trackVisitInPast($ip = '124.56.23.23');
-
- $cronArchive = new CronArchive();
- $cronArchive->init();
- $cronArchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain(1);
-
- // process day archive so range archive will process below (if we don't, then we'll skip processing the range archive,
- // since it wouldn't trigger the child day archive. then later the day archive would be updated, and not the range, resulting
- // in inaccurate data)
- Rules::setBrowserTriggerArchiving(true);
- \Piwik\Plugins\VisitsSummary\API::getInstance()->get(1, 'day', '2012-08-09');
- Rules::setBrowserTriggerArchiving(false);
-
- $rangeArchivesInvalid = Db::fetchAll("SELECT idarchive, name, date1, date2 FROM " . $table . " WHERE period = 5 and name LIKE 'done.%' and value = " . ArchiveWriter::DONE_INVALIDATED);
- $this->assertNotEmpty($rangeArchivesInvalid);
-
- // cron archive not run, but ranges should still be rearchived
- $this->runApiTests(
- array(
- 'VisitsSummary.get', 'Actions.get', 'DevicesDetection.getType'),
- array('idSite' => '1',
- 'date' => '2012-08-09,2012-08-13',
- 'periods' => array('range'),
- 'testSuffix' => '_range_archive_rearchived')
- );
-
- $archivePurger = StaticContainer::get(ArchivePurger::class);
- $archivePurger->purgeInvalidatedArchivesFrom(Date::factory('2020-08-09'));
-
- $rangeArchivesStillInvalid = Db::fetchAll("SELECT idarchive, name, date1, date2 FROM " . $table . " WHERE period = 5 and name = 'done.%' and value = " . ArchiveWriter::DONE_INVALIDATED);
- $this->assertEmpty($rangeArchivesStillInvalid);
- }
-
- public function testArchivePhpScriptDoesNotFailWhenCommandHelpRequested()
- {
- $output = $this->runArchivePhpCron(array('--help' => null), PIWIK_INCLUDE_PATH . '/misc/cron/archive.php');
-
- $this->assertRegExp('/Usage:\s*core:archive/', $output);
- self::assertStringNotContainsString("Starting Piwik reports archiving...", $output);
- }
-
- public function testArchivePhpCronWithTimeLimit()
- {
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
- self::$fixture->getTestEnvironment()->overrideConfig('General', 'browser_archiving_disabled_enforce', 1);
- self::$fixture->getTestEnvironment()->save();
-
- Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
- Config::getInstance()->General['browser_archiving_disabled_enforce'] = 1;
-
- Rules::setBrowserTriggerArchiving(false);
-
- // track a visit so archiving will go through
- $tracker = Fixture::getTracker(1, '2005-09-04');
- $tracker->setUrl('http://example.com/test/url2');
- Fixture::checkResponse($tracker->doTrackPageView('jkl'));
-
- $output = $this->runArchivePhpCron(['-vvv --stop-processing-after=1' => null]);
-
- self::assertStringContainsString('Maximum time limit per execution has been reached.', $output);
-
- // Ensure work has stopped and some invalidations are left over
- self::assertNotEmpty($this->getInvalidatedArchiveTableEntries());
- }
-
- private function runArchivePhpCron($options = array(), $archivePhpScript = false)
- {
- $archivePhpScript = $archivePhpScript ?: PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/archive.php';
- $urlToProxy = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php';
-
- // create the command
- $cmd = "php \"$archivePhpScript\" --url=\"$urlToProxy\"";
- foreach ($options as $name => $value) {
- $cmd .= " $name";
- if ($value !== null) {
- $cmd .= "=" . escapeshellarg($value);
- }
- }
- $cmd .= " 2>&1";
-
- // run the command
- exec($cmd, $output, $result);
- $output = implode("\n", $output);
-
- if ($result !== 0 || strpos($output, "ERROR") || strpos($output, "Error")) {
- $this->fail("archive cron failed (result = $result): " . $output . "\n\ncommand used: $cmd");
- }
-
- return $output;
- }
-
- public static function provideContainerConfigBeforeClass()
- {
- Date::$now = strtotime('2015-01-01 00:00:00');
-
- return array(
- LoggerInterface::class => \Piwik\DI::get(Logger::class),
-
- // for some reason, w/o real translations archiving segments in CronArchive fails. the data returned by CliMulti
- // is a translation token, and nothing else.
- 'Piwik\Translation\Translator' => function (Container $c) {
- return new \Piwik\Translation\Translator($c->get('Piwik\Translation\Loader\LoaderInterface'));
- },
-
- 'Tests.log.allowAllHandlers' => true,
-
- CronArchive\SegmentArchiving::class => \Piwik\DI::autowire()
- // Oldest reports are for 2012, so ensure segments are processed for that year
- ->constructorParameter('beginningOfTimeLastNInYears', date('Y') - 2012),
- );
- }
-
- public static function getPathToTestDirectory()
- {
- return dirname(__FILE__);
- }
-
- private function getInvalidatedArchiveTableEntries()
- {
- return Db::fetchAll("SELECT idinvalidation, idarchive, idsite, date1, date2, period, name, status FROM " . Common::prefixTable('archive_invalidations'));
- }
-
- private static function undoForceCurlCliMulti()
- {
- $testVars = new TestingEnvironmentVariables();
- $testVars->forceCliMultiViaCurl = 0;
- $testVars->save();
- }
-
- private static function forceCurlCliMulti()
- {
- $testVars = new TestingEnvironmentVariables();
- $testVars->forceCliMultiViaCurl = 1;
- $testVars->save();
- }
-}
-
-ArchiveCronTest::$fixture = new ManySitesImportedLogs();
-ArchiveCronTest::$fixture->addSegments = true;
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest__ExamplePlugin.getExampleArchivedMetric_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest__ExamplePlugin.getExampleArchivedMetric_day.xml
deleted file mode 100644
index 2e1a657b1f3614a845f12ffc5e45dcd6068a9dc8..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest__ExamplePlugin.getExampleArchivedMetric_day.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 3382
- 51
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt
deleted file mode 100644
index c592c19adbfc50bcb5432027453335e88f5be824..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_archive_php_cron_output.txt
+++ /dev/null
@@ -1,107 +0,0 @@
-
--------------------------------------------------------
-Using this 'archive.php' script is no longer recommended.
-Please use '/path/to/php /home/travis/build/matomo-org/matomo/tests/PHPUnit/proxy/../../..//console core:archive --url=http://localhost/tests/PHPUnit/proxy/index.php --force-date-last-n=10' instead.
-To get help use '/path/to/php /home/travis/build/matomo-org/matomo/tests/PHPUnit/proxy/../../..//console core:archive --help'
-See also: https://matomo.org/docs/setup-auto-archiving/
-
-If you cannot use the console because it requires CLI
-try 'php archive.php --url=http://your.piwik/path'
--------------------------------------------------------
-
-
-INFO [2020-09-19 17:11:11] 10540 ---------------------------
-INFO [2020-09-19 17:11:11] 10540 INIT
-INFO [2020-09-19 17:11:11] 10540 Running Matomo 4.0.0-b2 as Super User
-INFO [2020-09-19 17:11:11] 10540 ---------------------------
-INFO [2020-09-19 17:11:11] 10540 NOTES
-INFO [2020-09-19 17:11:11] 10540 - If you execute this script at least once per hour (or more often) in a crontab, you may disable 'Browser trigger archiving' in Matomo UI > Settings > General Settings.
-INFO [2020-09-19 17:11:11] 10540 See the doc at: https://matomo.org/docs/setup-auto-archiving/
-INFO [2020-09-19 17:11:11] 10540 - Async process archiving supported, using CliMulti.
-INFO [2020-09-19 17:11:11] 10540 - Reports for today will be processed at most every 900 seconds. You can change this value in Matomo UI > Settings > General Settings.
-INFO [2020-09-19 17:11:12] 10540 ---------------------------
-INFO [2020-09-19 17:11:12] 10540 START
-INFO [2020-09-19 17:11:12] 10540 Starting Matomo reports archiving...
-INFO [2020-09-19 17:11:12] 10540 Start processing archives for site 1.
-INFO [2020-09-19 17:11:12] 10540 Archived website id 1, period = day, date = 2007-04-05, segment = '', plugin = ExamplePlugin, 1 visits found. Time elapsed: 0.524s
-INFO [2020-09-19 17:11:13] 10540 Archived website id 1, period = week, date = 2007-04-02, segment = '', plugin = ExamplePlugin, 1 visits found. Time elapsed: 0.536s
-INFO [2020-09-19 17:11:13] 10540 Archived website id 1, period = month, date = 2007-04-01, segment = '', plugin = ExamplePlugin, 1 visits found. Time elapsed: 0.537s
-INFO [2020-09-19 17:11:14] 10540 Archived website id 1, period = year, date = 2007-01-01, segment = '', plugin = ExamplePlugin, 1 visits found. Time elapsed: 0.533s
-INFO [2020-09-19 17:11:14] 10540 Checking for queued invalidations...
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2014-03-13 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2014-03-12 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2012-09-30 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2012-08-19 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2012-08-15 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2012-08-11 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2012-08-10 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Will invalidate archived reports for 2012-08-09 for following websites ids: 1
-INFO [2020-09-19 17:11:14] 10540 Segment "browserCode==IE" was created or changed recently and will therefore archive today (for site ID = 1)
-INFO [2020-09-19 17:11:14] 10540 Segment "visitCount<=5;pageUrl=@/blog/;countryCode==jp" was created or changed recently and will therefore archive today (for site ID = 1)
-INFO [2020-09-19 17:11:14] 10540 Segment "visitCount<=5;pageUrl=@%2Fblog%2F;countryCode==jp" was created or changed recently and will therefore archive today (for site ID = 1)
-INFO [2020-09-19 17:11:14] 10540 Done invalidating
-INFO [2020-09-19 17:11:17] 10540 Archived website id 1, period = day, date = 2014-03-13, segment = '', 11 visits found. Time elapsed: 1.033s
-INFO [2020-09-19 17:11:17] 10540 Archived website id 1, period = day, date = 2014-03-12, segment = '', 1 visits found. Time elapsed: 1.033s
-INFO [2020-09-19 17:11:17] 10540 Archived website id 1, period = day, date = 2012-09-30, segment = '', 1 visits found. Time elapsed: 1.033s
-INFO [2020-09-19 17:11:18] 10540 Archived website id 1, period = week, date = 2014-03-10, segment = '', 12 visits found. Time elapsed: 1.610s
-INFO [2020-09-19 17:11:18] 10540 Archived website id 1, period = week, date = 2012-09-24, segment = '', 1 visits found. Time elapsed: 1.610s
-INFO [2020-09-19 17:11:18] 10540 Archived website id 1, period = day, date = 2012-08-19, segment = '', 1 visits found. Time elapsed: 1.610s
-INFO [2020-09-19 17:11:20] 10540 Archived website id 1, period = month, date = 2014-03-01, segment = '', 12 visits found. Time elapsed: 1.613s
-INFO [2020-09-19 17:11:20] 10540 Archived website id 1, period = month, date = 2012-09-01, segment = '', 1 visits found. Time elapsed: 1.613s
-INFO [2020-09-19 17:11:20] 10540 Archived website id 1, period = day, date = 2012-08-15, segment = '', 2 visits found. Time elapsed: 1.613s
-INFO [2020-09-19 17:11:22] 10540 Archived website id 1, period = year, date = 2014-01-01, segment = '', 12 visits found. Time elapsed: 2.161s
-INFO [2020-09-19 17:11:22] 10540 Archived website id 1, period = week, date = 2012-08-13, segment = '', 3 visits found. Time elapsed: 2.161s
-INFO [2020-09-19 17:11:22] 10540 Archived website id 1, period = day, date = 2012-08-11, segment = '', 11 visits found. Time elapsed: 2.161s
-INFO [2020-09-19 17:11:23] 10540 Archived website id 1, period = year, date = 2014-01-01, segment = 'visitCount%3C%3D5%3BpageUrl%3D%40%2Fblog%2F%3BcountryCode%3D%3Djp', 0 visits found. Time elapsed: 0.759s
-INFO [2020-09-19 17:11:23] 10540 Archived website id 1, period = day, date = 2012-08-10, segment = '', 8 visits found. Time elapsed: 1.053s
-INFO [2020-09-19 17:11:23] 10540 Archived website id 1, period = day, date = 2012-08-09, segment = '', 11 visits found. Time elapsed: 1.053s
-INFO [2020-09-19 17:11:26] 10540 Archived website id 1, period = year, date = 2014-01-01, segment = 'browserCode%3D%3DIE', 1 visits found. Time elapsed: 2.475s
-INFO [2020-09-19 17:11:26] 10540 Archived website id 1, period = week, date = 2012-08-06, segment = '', 30 visits found. Time elapsed: 2.475s
-INFO [2020-09-19 17:11:27] 10540 Archived website id 1, period = month, date = 2012-08-01, segment = '', 33 visits found. Time elapsed: 1.073s
-INFO [2020-09-19 17:11:28] 10540 Archived website id 1, period = year, date = 2012-01-01, segment = '', 34 visits found. Time elapsed: 1.056s
-INFO [2020-09-19 17:11:32] 10540 Archived website id 1, period = year, date = 2012-01-01, segment = 'visitCount%3C%3D5%3BpageUrl%3D%40%2Fblog%2F%3BcountryCode%3D%3Djp', 7 visits found. Time elapsed: 3.689s
-INFO [2020-09-19 17:11:35] 10540 Archived website id 1, period = year, date = 2012-01-01, segment = 'browserCode%3D%3DIE', 6 visits found. Time elapsed: 3.181s
-INFO [2020-09-19 17:11:35] 10540 Checking for queued invalidations...
-INFO [2020-09-19 17:11:35] 10540 Done invalidating
-INFO [2020-09-19 17:11:35] 10540 Finished archiving for site 1, 25 API requests, Time elapsed: 23.792s [1 / 3 done]
-INFO [2020-09-19 17:11:35] 10540 Start processing archives for site 2.
-INFO [2020-09-19 17:11:35] 10540 Checking for queued invalidations...
-INFO [2020-09-19 17:11:35] 10540 Will invalidate archived reports for 2012-08-15 for following websites ids: 2
-INFO [2020-09-19 17:11:35] 10540 Done invalidating
-INFO [2020-09-19 17:11:36] 10540 Archived website id 2, period = day, date = 2012-08-15, segment = '', 1 visits found. Time elapsed: 0.542s
-INFO [2020-09-19 17:11:37] 10540 Archived website id 2, period = week, date = 2012-08-13, segment = '', 1 visits found. Time elapsed: 0.795s
-INFO [2020-09-19 17:11:38] 10540 Archived website id 2, period = month, date = 2012-08-01, segment = '', 1 visits found. Time elapsed: 1.064s
-INFO [2020-09-19 17:11:39] 10540 Archived website id 2, period = year, date = 2012-01-01, segment = '', 1 visits found. Time elapsed: 1.067s
-INFO [2020-09-19 17:11:39] 10540 Checking for queued invalidations...
-INFO [2020-09-19 17:11:39] 10540 Done invalidating
-INFO [2020-09-19 17:11:39] 10540 Finished archiving for site 2, 4 API requests, Time elapsed: 3.619s [2 / 3 done]
-INFO [2020-09-19 17:11:39] 10540 Start processing archives for site 3.
-INFO [2020-09-19 17:11:39] 10540 Checking for queued invalidations...
-INFO [2020-09-19 17:11:39] 10540 Will invalidate archived reports for 2014-03-13 for following websites ids: 3
-INFO [2020-09-19 17:11:39] 10540 Will invalidate archived reports for 2014-03-12 for following websites ids: 3
-INFO [2020-09-19 17:11:39] 10540 Will invalidate archived reports for 2012-08-15 for following websites ids: 3
-INFO [2020-09-19 17:11:39] 10540 Done invalidating
-INFO [2020-09-19 17:11:40] 10540 Archived website id 3, period = day, date = 2014-03-13, segment = '', 11 visits found. Time elapsed: 1.027s
-INFO [2020-09-19 17:11:40] 10540 Archived website id 3, period = day, date = 2014-03-12, segment = '', 1 visits found. Time elapsed: 1.027s
-INFO [2020-09-19 17:11:40] 10540 Archived website id 3, period = day, date = 2012-08-15, segment = '', 3 visits found. Time elapsed: 1.027s
-INFO [2020-09-19 17:11:42] 10540 Archived website id 3, period = week, date = 2014-03-10, segment = '', 12 visits found. Time elapsed: 1.449s
-INFO [2020-09-19 17:11:42] 10540 Archived website id 3, period = week, date = 2012-08-13, segment = '', 3 visits found. Time elapsed: 1.449s
-INFO [2020-09-19 17:11:44] 10540 Archived website id 3, period = month, date = 2014-03-01, segment = '', 12 visits found. Time elapsed: 1.411s
-INFO [2020-09-19 17:11:44] 10540 Archived website id 3, period = month, date = 2012-08-01, segment = '', 3 visits found. Time elapsed: 1.952s
-INFO [2020-09-19 17:11:46] 10540 Archived website id 3, period = year, date = 2014-01-01, segment = '', 12 visits found. Time elapsed: 2.012s
-INFO [2020-09-19 17:11:46] 10540 Archived website id 3, period = year, date = 2012-01-01, segment = '', 3 visits found. Time elapsed: 2.012s
-INFO [2020-09-19 17:11:46] 10540 Checking for queued invalidations...
-INFO [2020-09-19 17:11:46] 10540 Done invalidating
-INFO [2020-09-19 17:11:46] 10540 Finished archiving for site 3, 9 API requests, Time elapsed: 6.651s [3 / 3 done]
-INFO [2020-09-19 17:11:46] 10540 Done archiving!
-INFO [2020-09-19 17:11:46] 10540 ---------------------------
-INFO [2020-09-19 17:11:46] 10540 SUMMARY
-INFO [2020-09-19 17:11:46] 10540 Processed 38 archives.
-INFO [2020-09-19 17:11:46] 10540 Total API requests: 38
-INFO [2020-09-19 17:11:46] 10540 done: 38 req, 34209 ms, no error
-INFO [2020-09-19 17:11:46] 10540 Time elapsed: 34.209s
-INFO [2020-09-19 17:11:46] 10540 ---------------------------
-INFO [2020-09-19 17:11:46] 10540 SCHEDULED TASKS
-INFO [2020-09-19 17:11:46] 10540 Starting Scheduled tasks...
-INFO [2020-09-19 17:11:46] 10540 done
-INFO [2020-09-19 17:11:46] 10540 ---------------------------
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_examplePluginNoMetricsBecauseNoOtherPluginsArchived_noOptions__Actions.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_examplePluginNoMetricsBecauseNoOtherPluginsArchived_noOptions__Actions.get_day.xml
deleted file mode 100644
index dd52dc4ff40444a272c35ecbb3f94665561db11a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_examplePluginNoMetricsBecauseNoOtherPluginsArchived_noOptions__Actions.get_day.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_examplePluginNoMetricsBecauseNoOtherPluginsArchived_noOptions__Actions.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_examplePluginNoMetricsBecauseNoOtherPluginsArchived_noOptions__Actions.get_week.xml
deleted file mode 100644
index dd52dc4ff40444a272c35ecbb3f94665561db11a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_examplePluginNoMetricsBecauseNoOtherPluginsArchived_noOptions__Actions.get_week.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__ExamplePlugin.getExampleArchivedMetric_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__ExamplePlugin.getExampleArchivedMetric_day.xml
deleted file mode 100644
index 74f98a20a26b12751cb8cc909e9a8607cea99233..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__ExamplePlugin.getExampleArchivedMetric_day.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 3382
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__ExamplePlugin.getExampleArchivedMetric_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__ExamplePlugin.getExampleArchivedMetric_week.xml
deleted file mode 100644
index 74f98a20a26b12751cb8cc909e9a8607cea99233..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__ExamplePlugin.getExampleArchivedMetric_week.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 3382
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml
deleted file mode 100644
index c21c0db930c0af8726209f605a22ef4e18c46ed1..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__Goals.get_month.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- 32
- 32
- 160
- 94.12%
- 32
- 32
- 160
- 94.12%
- 0
- 0
- 0
- 0%
-
-
- 0
- 0
- 0
- 0%
- 0
- 0
- 0
- 0%
- 0
- 0
- 0
- 0%
-
-
- 0
- 0
- 0
- 0%
- 0
- 0
- 0
- 0%
- 0
- 0
- 0
- 0%
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
deleted file mode 100644
index ca128fdd1cc692ba9297b977efde70fd8d796d44..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitFrequency.get_month.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
- 34
- 1
- 34
- 37
- 32
- 32
- 305
- 3
- 94%
- 1.1
- 9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0%
- 0
- 0
-
-
- 1
- 0
- 1
- 1
- 0
- 1
- 0
- 1
- 100%
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0%
- 0
- 0
-
-
- 2
- 0
- 2
- 4
- 0
- 1
- 1
- 3
- 50%
- 2
- 1
- 1
- 0
- 1
- 1
- 0
- 1
- 0
- 1
- 100%
- 1
- 0
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 358388e453c95b97fe11a0ce35437f479d1e3edc..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 12
- 0
- 12
- 12
- 12
- 12
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index 972ae44a475ffd13a16c0219313ed5e5c1424e9f..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- 34
- 1
- 34
- 37
- 32
- 32
- 305
- 3
- 94%
- 1.1
- 9
-
-
- 1
- 0
- 1
- 1
- 0
- 1
- 0
- 1
- 100%
- 1
- 0
-
-
- 2
- 0
- 3
- 5
- 0
- 2
- 1
- 3
- 67%
- 1.7
- 0
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 4d2cc269e2da3b42721d55aa7002ecf7139f9858..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 31
- 1
- 31
- 34
- 29
- 29
- 305
- 3
- 94%
- 1.1
- 10
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index b503a2241000e80be35b0b7ea1912761bb4ec1bb..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
- 35
- 47
- 33
- 32
- 359
- 10
- 91%
- 1.3
- 10
-
-
- 1
- 1
- 0
- 1
- 0
- 1
- 100%
- 1
- 0
-
-
- 3
- 5
- 0
- 2
- 1
- 3
- 67%
- 1.7
- 0
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index dd52dc4ff40444a272c35ecbb3f94665561db11a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index dd52dc4ff40444a272c35ecbb3f94665561db11a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index dd52dc4ff40444a272c35ecbb3f94665561db11a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index dd52dc4ff40444a272c35ecbb3f94665561db11a..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_nonPreArchivedSegment_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__Live.getLastVisitsDetails_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__Live.getLastVisitsDetails_day.xml
deleted file mode 100644
index f7ca7b07d0150dd1dd19e2713890ffdfccea7c70..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__Live.getLastVisitsDetails_day.xml
+++ /dev/null
@@ -1,417 +0,0 @@
-
-
-
- 1
- 3
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 3
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 3
-
- http://piwik.net/blog/category/community/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Unknown
- Generic Desktop
- GNU/Linux
- GNU/Linux
- plugins/Morpheus/icons/dist/os/LIN.png
- LIN
-
- WebKit
- WebKit (Safari)
- GNOME Web 2.30
- GNOME Web
- plugins/Morpheus/icons/dist/browsers/EP.png
- EP
- 2.30
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:11:56
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 59
- 175.41.193.46
-
-
-
-
- action
- http://www.included4.com/blog/category/meta/
-
- 61
-
-
- 81
- 3574
- 0
- 0s
- 1
-
- http://www.included4.com/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 81
-
- http://www.included4.com/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:39
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 1
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 1
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 1
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__Live.getLastVisitsDetails_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__Live.getLastVisitsDetails_year.xml
deleted file mode 100644
index d92e4086cc9cb9be81aaab9c554714387cbe9937..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__Live.getLastVisitsDetails_year.xml
+++ /dev/null
@@ -1,1202 +0,0 @@
-
-
-
- 1
- 57
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 70
-
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 70
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 74
-
- 0
- 0s
- 5
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 78
-
- 52
- 52s
- 9
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/faq/
-
- 2
-
-
- 71
-
- 0
- 0s
- 2
-
- http://piwik.net/faq/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/faq/
-
- 2
-
-
- 75
-
- 0
- 0s
- 6
-
- http://piwik.net/faq/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/faq/
-
- 2
-
-
- 79
-
- 26
- 26s
- 10
-
- http://piwik.net/faq/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 72
-
- 0
- 0s
- 3
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 76
-
- 7
- 7s
- 7
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/docs/manage-websites/
-
- 4
-
-
- 73
-
- 1
- 1s
- 4
-
- http://piwik.net/docs/manage-websites/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/docs/manage-websites/
-
- 4
-
-
- 77
-
- 0
- 0s
- 8
-
- http://piwik.net/docs/manage-websites/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 54
- 54s
- 0
- 10
- 10
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Unknown
- plugins/Morpheus/icons/dist/devices/unknown.png
- Unknown
- Unknown
- Unknown
- Unknown
- plugins/Morpheus/icons/dist/os/UNK.png
- UNK
- UNK
-
- Unknown
- Unknown
- Unknown
- plugins/Morpheus/icons/dist/browsers/UNK.png
- UNK
-
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 25
- 175.41.192.41
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 28
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 28
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 20:15:41
- 20
- 0
- 0
- unknown
-
-
-
-
- Not-Bot
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) RockMelt/0.9.58.494 Chrome/11.0.696.71 Safari/534.24
-
-
-
-
- 1
- 19
- 175.41.192.41
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 19
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 19
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 16:10:38
- 16
- 0
- 0
- unknown
-
-
-
-
- Not-Bot
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) RockMelt/0.9.58.494 Chrome/11.0.696.71 Safari/534.24
-
-
-
-
- 1
- 58
- 175.41.193.45
-
-
-
-
- action
- http://included3.com/blog/category/meta/
-
- 60
-
-
- 80
- 3574
- 0
- 0s
- 1
-
- http://included3.com/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 80
-
- http://included3.com/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 3
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 3
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 3
-
- http://piwik.net/blog/category/community/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Unknown
- Generic Desktop
- GNU/Linux
- GNU/Linux
- plugins/Morpheus/icons/dist/os/LIN.png
- LIN
-
- WebKit
- WebKit (Safari)
- GNOME Web 2.30
- GNOME Web
- plugins/Morpheus/icons/dist/browsers/EP.png
- EP
- 2.30
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:11:56
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 59
- 175.41.193.46
-
-
-
-
- action
- http://www.included4.com/blog/category/meta/
-
- 61
-
-
- 81
- 3574
- 0
- 0s
- 1
-
- http://www.included4.com/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 81
-
- http://www.included4.com/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:39
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 1
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 1
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 1
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml
deleted file mode 100644
index de5c1efe17802589e42e430382f3c4be3cab6df4..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_day.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- 3
- 0
- 3
- 3
- 3
- 3
- 0
- 1
- 100%
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0%
- 0
- 0
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml
deleted file mode 100644
index 3a683d01fde306bde73128fc4edb4493f8354f5c..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitFrequency.get_year.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- 7
- 16
- 7
- 6
- 54
- 10
- 86%
- 2.3
- 8
- 0
- 0
- 0
- 0
- 0
- 0
- 0%
- 0
- 0
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 964d9c948f40c27971e0b4cd026eb3733fb45d02..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 3
- 0
- 3
- 3
- 3
- 3
- 0
- 1
- 100%
- 1
- 0
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 1c7f9fdb5912672b549aacace2bc97a45ca3a45d..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment0_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 7
- 16
- 7
- 6
- 54
- 10
- 86%
- 2.3
- 8
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__Live.getLastVisitsDetails_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__Live.getLastVisitsDetails_day.xml
deleted file mode 100644
index f7ca7b07d0150dd1dd19e2713890ffdfccea7c70..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__Live.getLastVisitsDetails_day.xml
+++ /dev/null
@@ -1,417 +0,0 @@
-
-
-
- 1
- 3
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 3
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 3
-
- http://piwik.net/blog/category/community/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Unknown
- Generic Desktop
- GNU/Linux
- GNU/Linux
- plugins/Morpheus/icons/dist/os/LIN.png
- LIN
-
- WebKit
- WebKit (Safari)
- GNOME Web 2.30
- GNOME Web
- plugins/Morpheus/icons/dist/browsers/EP.png
- EP
- 2.30
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:11:56
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 59
- 175.41.193.46
-
-
-
-
- action
- http://www.included4.com/blog/category/meta/
-
- 61
-
-
- 81
- 3574
- 0
- 0s
- 1
-
- http://www.included4.com/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 81
-
- http://www.included4.com/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:39
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 1
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 1
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 1
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__Live.getLastVisitsDetails_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__Live.getLastVisitsDetails_year.xml
deleted file mode 100644
index d92e4086cc9cb9be81aaab9c554714387cbe9937..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__Live.getLastVisitsDetails_year.xml
+++ /dev/null
@@ -1,1202 +0,0 @@
-
-
-
- 1
- 57
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 70
-
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 70
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 74
-
- 0
- 0s
- 5
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 78
-
- 52
- 52s
- 9
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/faq/
-
- 2
-
-
- 71
-
- 0
- 0s
- 2
-
- http://piwik.net/faq/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/faq/
-
- 2
-
-
- 75
-
- 0
- 0s
- 6
-
- http://piwik.net/faq/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/faq/
-
- 2
-
-
- 79
-
- 26
- 26s
- 10
-
- http://piwik.net/faq/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 72
-
- 0
- 0s
- 3
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 76
-
- 7
- 7s
- 7
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/docs/manage-websites/
-
- 4
-
-
- 73
-
- 1
- 1s
- 4
-
- http://piwik.net/docs/manage-websites/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- action
- http://piwik.net/docs/manage-websites/
-
- 4
-
-
- 77
-
- 0
- 0s
- 8
-
- http://piwik.net/docs/manage-websites/
-
- plugins/Morpheus/images/action.svg
-
- 0 M
-
-
- HTTP-code
- 200
-
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 54
- 54s
- 0
- 10
- 10
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Unknown
- plugins/Morpheus/icons/dist/devices/unknown.png
- Unknown
- Unknown
- Unknown
- Unknown
- plugins/Morpheus/icons/dist/os/UNK.png
- UNK
- UNK
-
- Unknown
- Unknown
- Unknown
- plugins/Morpheus/icons/dist/browsers/UNK.png
- UNK
-
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 25
- 175.41.192.41
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 28
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 28
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 20:15:41
- 20
- 0
- 0
- unknown
-
-
-
-
- Not-Bot
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) RockMelt/0.9.58.494 Chrome/11.0.696.71 Safari/534.24
-
-
-
-
- 1
- 19
- 175.41.192.41
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 19
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 19
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 16:10:38
- 16
- 0
- 0
- unknown
-
-
-
-
- Not-Bot
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) RockMelt/0.9.58.494 Chrome/11.0.696.71 Safari/534.24
-
-
-
-
- 1
- 58
- 175.41.193.45
-
-
-
-
- action
- http://included3.com/blog/category/meta/
-
- 60
-
-
- 80
- 3574
- 0
- 0s
- 1
-
- http://included3.com/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 80
-
- http://included3.com/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 3
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/community/
-
- 3
-
-
- 3
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/community/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 3
-
- http://piwik.net/blog/category/community/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Unknown
- Generic Desktop
- GNU/Linux
- GNU/Linux
- plugins/Morpheus/icons/dist/os/LIN.png
- LIN
-
- WebKit
- WebKit (Safari)
- GNOME Web 2.30
- GNOME Web
- plugins/Morpheus/icons/dist/browsers/EP.png
- EP
- 2.30
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:11:56
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 59
- 175.41.193.46
-
-
-
-
- action
- http://www.included4.com/blog/category/meta/
-
- 61
-
-
- 81
- 3574
- 0
- 0s
- 1
-
- http://www.included4.com/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 81
-
- http://www.included4.com/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:39
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
- 1
- 1
- 175.41.192.40
-
-
-
-
- action
- http://piwik.net/blog/category/meta/
-
- 1
-
-
- 1
- 3574
- 0
- 0s
- 1
-
- http://piwik.net/blog/category/meta/
-
- plugins/Morpheus/images/action.svg
-
- 3.5 K
-
-
- HTTP-code
- 200
-
-
-
-
- goal
- all
- 1
-
- 5
- 1
-
- http://piwik.net/blog/category/meta/
- direct
-
-
- plugins/Morpheus/images/goal.png
- plugins/Morpheus/images/goal.svg
- Goal conversion
- all ($5 revenue)
-
-
-
- 1
- USD
- $
-
-
-
-
- Piwik test
-
-
-
-
-
-
-
- new
-
- 1
- plugins/Morpheus/images/goal.svg
- 1
- none
-
- 0
- 0
- 0
-
- 0
- 0s
- 0
- 1
- 1
- direct
- Direct Entry
-
-
-
-
-
-
-
-
-
-
-
- Unknown
- Desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
- Apple
- Generic Desktop
- Mac 10.6
- Mac
- plugins/Morpheus/icons/dist/os/MAC.png
- MAC
- 10.6
- WebKit
- WebKit (Safari)
- RockMelt 0.9
- RockMelt
- plugins/Morpheus/icons/dist/browsers/RM.png
- RM
- 0.9
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- Asia
- asi
- Japan
- jp
- plugins/Morpheus/icons/dist/flags/jp.png
-
-
-
- Japan
- 08:10:38
- 8
- 0
- 0
- unknown
-
-
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml
deleted file mode 100644
index de5c1efe17802589e42e430382f3c4be3cab6df4..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_day.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- 3
- 0
- 3
- 3
- 3
- 3
- 0
- 1
- 100%
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0%
- 0
- 0
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml
deleted file mode 100644
index 3a683d01fde306bde73128fc4edb4493f8354f5c..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitFrequency.get_year.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- 7
- 16
- 7
- 6
- 54
- 10
- 86%
- 2.3
- 8
- 0
- 0
- 0
- 0
- 0
- 0
- 0%
- 0
- 0
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 964d9c948f40c27971e0b4cd026eb3733fb45d02..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 3
- 0
- 3
- 3
- 3
- 3
- 0
- 1
- 100%
- 1
- 0
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 1c7f9fdb5912672b549aacace2bc97a45ca3a45d..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_preArchivedSegment1_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 7
- 16
- 7
- 6
- 54
- 10
- 86%
- 2.3
- 8
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
deleted file mode 100644
index 6d0fc6f0649efe168bbf5d3d37dbca6648a2aabe..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 30
- 30
- 4
- 4
- 0
- 0
- 0
- 0
- 34
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
deleted file mode 100644
index 98df5eb1773f3232770c1497a3b3dc8aeea6afa7..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
-
- 26
- 29
- 3
- 305
- 24
- 25
-
-
- 25
- 25
- 125
-
-
- 25
- 125
- 26
- 1
- deviceType==desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
-
-
-
- 3
- 3
- 1
- 0
- 3
- 3
-
-
- 3
- 3
- 15
-
-
- 3
- 15
- 3
- 0
- deviceType==smartphone
- plugins/Morpheus/icons/dist/devices/smartphone.png
-
-
-
- 2
- 2
- 1
- 0
- 2
- 1
-
-
- 1
- 1
- 5
-
-
- 1
- 5
- 2
- 0
- plugins/Morpheus/icons/dist/devices/unknown.png
-
-
-
- 0
- deviceType==camera
- plugins/Morpheus/icons/dist/devices/camera.png
-
-
-
- 0
- deviceType==car+browser
- plugins/Morpheus/icons/dist/devices/car_browser.png
-
-
-
- 0
- deviceType==console
- plugins/Morpheus/icons/dist/devices/console.png
-
-
-
- 0
- deviceType==feature+phone
- plugins/Morpheus/icons/dist/devices/feature_phone.png
-
-
-
- 0
- deviceType==peripheral
- plugins/Morpheus/icons/dist/devices/peripheral.png
-
-
-
- 0
- deviceType==phablet
- plugins/Morpheus/icons/dist/devices/phablet.png
-
-
-
- 0
- deviceType==portable+media+player
- plugins/Morpheus/icons/dist/devices/portable_media_player.png
-
-
-
- 0
- deviceType==smart+display
- plugins/Morpheus/icons/dist/devices/smart_display.png
-
-
-
- 0
- deviceType==smart+speaker
- plugins/Morpheus/icons/dist/devices/smart_speaker.png
-
-
-
- 0
- deviceType==tablet
- plugins/Morpheus/icons/dist/devices/tablet.png
-
-
-
- 0
- deviceType==tv
- plugins/Morpheus/icons/dist/devices/tv.png
-
-
-
- 0
- deviceType==wearable
- plugins/Morpheus/icons/dist/devices/wearable.png
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
deleted file mode 100644
index af0d9b8c737fe9dc91e3f8035aabd6e722bde321..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 31
- 34
- 29
- 29
- 305
- 3
- 94%
- 1.1
- 10
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml
deleted file mode 100644
index 6d0fc6f0649efe168bbf5d3d37dbca6648a2aabe..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__Actions.get_range.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 30
- 30
- 4
- 4
- 0
- 0
- 0
- 0
- 34
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml
deleted file mode 100644
index 98df5eb1773f3232770c1497a3b3dc8aeea6afa7..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__DevicesDetection.getType_range.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
-
- 26
- 29
- 3
- 305
- 24
- 25
-
-
- 25
- 25
- 125
-
-
- 25
- 125
- 26
- 1
- deviceType==desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
-
-
-
- 3
- 3
- 1
- 0
- 3
- 3
-
-
- 3
- 3
- 15
-
-
- 3
- 15
- 3
- 0
- deviceType==smartphone
- plugins/Morpheus/icons/dist/devices/smartphone.png
-
-
-
- 2
- 2
- 1
- 0
- 2
- 1
-
-
- 1
- 1
- 5
-
-
- 1
- 5
- 2
- 0
- plugins/Morpheus/icons/dist/devices/unknown.png
-
-
-
- 0
- deviceType==camera
- plugins/Morpheus/icons/dist/devices/camera.png
-
-
-
- 0
- deviceType==car+browser
- plugins/Morpheus/icons/dist/devices/car_browser.png
-
-
-
- 0
- deviceType==console
- plugins/Morpheus/icons/dist/devices/console.png
-
-
-
- 0
- deviceType==feature+phone
- plugins/Morpheus/icons/dist/devices/feature_phone.png
-
-
-
- 0
- deviceType==peripheral
- plugins/Morpheus/icons/dist/devices/peripheral.png
-
-
-
- 0
- deviceType==phablet
- plugins/Morpheus/icons/dist/devices/phablet.png
-
-
-
- 0
- deviceType==portable+media+player
- plugins/Morpheus/icons/dist/devices/portable_media_player.png
-
-
-
- 0
- deviceType==smart+display
- plugins/Morpheus/icons/dist/devices/smart_display.png
-
-
-
- 0
- deviceType==smart+speaker
- plugins/Morpheus/icons/dist/devices/smart_speaker.png
-
-
-
- 0
- deviceType==tablet
- plugins/Morpheus/icons/dist/devices/tablet.png
-
-
-
- 0
- deviceType==tv
- plugins/Morpheus/icons/dist/devices/tv.png
-
-
-
- 0
- deviceType==wearable
- plugins/Morpheus/icons/dist/devices/wearable.png
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml
deleted file mode 100644
index af0d9b8c737fe9dc91e3f8035aabd6e722bde321..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_before_invalidate__VisitsSummary.get_range.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 31
- 34
- 29
- 29
- 305
- 3
- 94%
- 1.1
- 10
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml
deleted file mode 100644
index f766c8bfc8d66794e7dcfebe06b43ba988f6841e..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__Actions.get_range.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 31
- 31
- 4
- 4
- 0
- 0
- 0
- 0
- 35
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml
deleted file mode 100644
index a8f2821894dd6c85a2d52c362a17730f6cb3da0b..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__DevicesDetection.getType_range.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
-
- 26
- 29
- 3
- 305
- 24
- 25
-
-
- 25
- 25
- 125
-
-
- 25
- 125
- 26
- 1
- deviceType==desktop
- plugins/Morpheus/icons/dist/devices/desktop.png
-
-
-
- 4
- 4
- 1
- 0
- 4
- 4
-
-
- 4
- 4
- 20
-
-
- 4
- 20
- 4
- 0
- deviceType==smartphone
- plugins/Morpheus/icons/dist/devices/smartphone.png
-
-
-
- 2
- 2
- 1
- 0
- 2
- 1
-
-
- 1
- 1
- 5
-
-
- 1
- 5
- 2
- 0
- plugins/Morpheus/icons/dist/devices/unknown.png
-
-
-
- 0
- deviceType==camera
- plugins/Morpheus/icons/dist/devices/camera.png
-
-
-
- 0
- deviceType==car+browser
- plugins/Morpheus/icons/dist/devices/car_browser.png
-
-
-
- 0
- deviceType==console
- plugins/Morpheus/icons/dist/devices/console.png
-
-
-
- 0
- deviceType==feature+phone
- plugins/Morpheus/icons/dist/devices/feature_phone.png
-
-
-
- 0
- deviceType==peripheral
- plugins/Morpheus/icons/dist/devices/peripheral.png
-
-
-
- 0
- deviceType==phablet
- plugins/Morpheus/icons/dist/devices/phablet.png
-
-
-
- 0
- deviceType==portable+media+player
- plugins/Morpheus/icons/dist/devices/portable_media_player.png
-
-
-
- 0
- deviceType==smart+display
- plugins/Morpheus/icons/dist/devices/smart_display.png
-
-
-
- 0
- deviceType==smart+speaker
- plugins/Morpheus/icons/dist/devices/smart_speaker.png
-
-
-
- 0
- deviceType==tablet
- plugins/Morpheus/icons/dist/devices/tablet.png
-
-
-
- 0
- deviceType==tv
- plugins/Morpheus/icons/dist/devices/tv.png
-
-
-
- 0
- deviceType==wearable
- plugins/Morpheus/icons/dist/devices/wearable.png
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml
deleted file mode 100644
index 9af550f04de0a0b71914f92e7b2616dc3ba399a9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive_rearchived__VisitsSummary.get_range.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- 32
- 35
- 30
- 30
- 305
- 3
- 94%
- 1.1
- 10
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 907663817a20a47151a561925a2bff42b88f96f9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index 907663817a20a47151a561925a2bff42b88f96f9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 907663817a20a47151a561925a2bff42b88f96f9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 079f977d9b58104ba0d6e319595cbebf927f2350..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentForToday_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 63b6e48e2d7c49ffc01bdf0f40586aa8ab2f18b1..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 4
- 0
- 4
- 4
- 4
- 4
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index c545ab2bc595ea073b0cd176b6ed346d2eff7603..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- 12
- 0
- 12
- 15
- 11
- 10
- 305
- 3
- 83%
- 1.3
- 25
-
-
- 1
- 0
- 1
- 1
- 0
- 1
- 0
- 1
- 100%
- 1
- 0
-
-
- 1
- 0
- 1
- 3
- 0
- 0
- 1
- 3
- 0%
- 3
- 1
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 6a3bd088d67511eac114db7ed7c7eb69c3a1e69c..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 11
- 0
- 11
- 14
- 10
- 9
- 305
- 3
- 82%
- 1.3
- 28
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index d778df9708e9d473da3d21c8d9b2ed993689685b..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentNoAutoArchive_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
- 12
- 15
- 11
- 10
- 305
- 3
- 83%
- 1.3
- 25
-
-
- 1
- 1
- 0
- 1
- 0
- 1
- 100%
- 1
- 0
-
-
- 1
- 3
- 0
- 0
- 1
- 3
- 0%
- 3
- 1
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 2f05440facac8906468304047a1f4adb81f6eefe..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 1
- 1
- 1
- 1
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index 69cfb8ea524d1e59f26da40fd37dfdaa0816e6b2..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 6
- 0
- 6
- 6
- 6
- 6
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 3b8ee5ce75023dd11319e5e1ac81344b81197616..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 5
- 0
- 5
- 5
- 5
- 5
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 127cfeba900b3fa95b8ff36a9b22b19e5ddee0d9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentOnlyOneSite_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- 6
- 6
- 6
- 6
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 57d322baebbb2fb8102283be92718f15c6dc6e9c..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 3
- 0
- 3
- 3
- 3
- 3
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index 69cfb8ea524d1e59f26da40fd37dfdaa0816e6b2..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 6
- 0
- 6
- 6
- 6
- 6
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 69cfb8ea524d1e59f26da40fd37dfdaa0816e6b2..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 6
- 0
- 6
- 6
- 6
- 6
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 25bde1bf62c326aa3de5ca24e7fbeb4866d28761..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchivedWithUrlEncoding_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- 7
- 16
- 7
- 6
- 54
- 10
- 86%
- 2.3
- 8
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 57d322baebbb2fb8102283be92718f15c6dc6e9c..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 3
- 0
- 3
- 3
- 3
- 3
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index 69cfb8ea524d1e59f26da40fd37dfdaa0816e6b2..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 6
- 0
- 6
- 6
- 6
- 6
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 69cfb8ea524d1e59f26da40fd37dfdaa0816e6b2..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 6
- 0
- 6
- 6
- 6
- 6
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 25bde1bf62c326aa3de5ca24e7fbeb4866d28761..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentPreArchived_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- 7
- 16
- 7
- 6
- 54
- 10
- 86%
- 2.3
- 8
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_day.xml
deleted file mode 100644
index 907663817a20a47151a561925a2bff42b88f96f9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_day.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_month.xml
deleted file mode 100644
index 907663817a20a47151a561925a2bff42b88f96f9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_month.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_week.xml
deleted file mode 100644
index 907663817a20a47151a561925a2bff42b88f96f9..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_week.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 1
- 0
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_year.xml
deleted file mode 100644
index 079f977d9b58104ba0d6e319595cbebf927f2350..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_year.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- 2
- 2
- 2
- 2
- 0
- 1
- 100%
- 1
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml
deleted file mode 100644
index 049680a34c3dc105d2b88ab396840388ba2d0f13..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_day.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 3383
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml
deleted file mode 100644
index 14aaf18648a5ddbc490e79006139ae01a99db642..0000000000000000000000000000000000000000
--- a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_singleMetric__ExamplePlugin.getExampleArchivedMetric_week.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 6765
- 0
-
-
-
-
\ No newline at end of file
diff --git a/plugins/CoreHome/Categories/AIAssistantsCategory.php b/plugins/CoreHome/Categories/AIAssistantsCategory.php
deleted file mode 100644
index ae589b2bd119e95f4721e43064b97368ec48a991..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Categories/AIAssistantsCategory.php
+++ /dev/null
@@ -1,30 +0,0 @@
-' . Piwik::translate('CoreHome_DevicesSubcategoryHelp') . '
';
- }
-}
diff --git a/plugins/CoreHome/Categories/EngagementSubcategory.php b/plugins/CoreHome/Categories/EngagementSubcategory.php
deleted file mode 100644
index ac7f25bdd67cabe6ee47b1f4f4d36fc22687c176..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Categories/EngagementSubcategory.php
+++ /dev/null
@@ -1,26 +0,0 @@
-' . Piwik::translate('CoreHome_EngagementSubcategoryHelp1') . ''
- . '' . Piwik::translate('CoreHome_EngagementSubcategoryHelp2') . '
';
- }
-}
diff --git a/plugins/CoreHome/Categories/GenericCategory.php b/plugins/CoreHome/Categories/GenericCategory.php
deleted file mode 100644
index 82ef278278d65d62825c4d2802193b9895a96a78..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Categories/GenericCategory.php
+++ /dev/null
@@ -1,18 +0,0 @@
-' . Piwik::translate('CoreHome_SoftwareSubcategoryHelp') . '';
- }
-}
diff --git a/plugins/CoreHome/Categories/VisitorsCategory.php b/plugins/CoreHome/Categories/VisitorsCategory.php
deleted file mode 100644
index cdb41617d859a673a4ba31e7ff82de9a2e79107e..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Categories/VisitorsCategory.php
+++ /dev/null
@@ -1,30 +0,0 @@
-';
-
- $helpText = '' . Piwik::translate('CoreHome_VisitorsCategoryHelp1') . '
';
- $helpText .= '' . Piwik::translate('CoreHome_VisitorsCategoryHelp2', [$visitsLogUrl, '']) . '
';
-
- return $helpText;
- }
-}
diff --git a/plugins/CoreHome/Categories/VisitorsOverviewSubcategory.php b/plugins/CoreHome/Categories/VisitorsOverviewSubcategory.php
deleted file mode 100644
index 62fcf1984cb0597c5d854ae00e92a7a99f228abe..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Categories/VisitorsOverviewSubcategory.php
+++ /dev/null
@@ -1,25 +0,0 @@
-' . Piwik::translate('CoreHome_VisitorsOverviewHelp') . '';
- }
-}
diff --git a/plugins/CoreHome/Columns/IdSite.php b/plugins/CoreHome/Columns/IdSite.php
deleted file mode 100644
index e5a2af0d0fa77d82be0f0edb72ae49780019148b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/IdSite.php
+++ /dev/null
@@ -1,60 +0,0 @@
-getIdSite();
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
- {
- return $request->getIdSite();
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- try {
- return Site::getNameFor($value);
- } catch (\Exception $ex) {
- $formatted = parent::formatValue($value, $idSite, $formatter);
- return Piwik::translate('General_MeasurableId') . ': ' . $formatted;
- }
- }
-}
diff --git a/plugins/CoreHome/Columns/LinkVisitActionId.php b/plugins/CoreHome/Columns/LinkVisitActionId.php
deleted file mode 100644
index 147aac77d36b59c1423fd5053d17187de1348295..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/LinkVisitActionId.php
+++ /dev/null
@@ -1,34 +0,0 @@
-createMetric(ArchivedMetric::AGGREGATION_UNIQUE);
- $metric->setTranslatedName(Piwik::translate('General_ColumnHits'));
- $metric->setName('hits');
- $metricsList->addMetric($metric);
- }
-}
diff --git a/plugins/CoreHome/Columns/LinkVisitActionIdPages.php b/plugins/CoreHome/Columns/LinkVisitActionIdPages.php
deleted file mode 100644
index e8abad06f35bc7b29075a965451e054001da7f9b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/LinkVisitActionIdPages.php
+++ /dev/null
@@ -1,47 +0,0 @@
-createMetric(ArchivedMetric::AGGREGATION_UNIQUE);
- $metric->setTranslatedName(Piwik::translate('General_ColumnPageviews'));
- $metric->setDocumentation(Piwik::translate('General_ColumnPageviewsDocumentation'));
- $metric->setName('pageviews');
- $metricsList->addMetric($metric);
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/ActionsPerVisit.php b/plugins/CoreHome/Columns/Metrics/ActionsPerVisit.php
deleted file mode 100644
index eb38e4368c6b5ff2c5933950697210c512da27ef..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/ActionsPerVisit.php
+++ /dev/null
@@ -1,53 +0,0 @@
-getMetric($row, 'nb_actions');
- $visits = $this->getMetric($row, 'nb_visits');
-
- return Piwik::getQuotientSafe($actions, $visits, $precision = 1);
- }
-
- public function getTranslatedName()
- {
- return Piwik::translate('General_ColumnActionsPerVisit');
- }
-
- public function getDependentMetrics()
- {
- return array('nb_actions', 'nb_visits');
- }
-
- public function getSemanticType(): ?string
- {
- return Dimension::TYPE_NUMBER;
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/AverageTimeOnSite.php b/plugins/CoreHome/Columns/Metrics/AverageTimeOnSite.php
deleted file mode 100644
index 88c502f9302b51b1aee65b8ae2687659475d45f5..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/AverageTimeOnSite.php
+++ /dev/null
@@ -1,61 +0,0 @@
-getMetric($row, 'sum_visit_length');
- $nbVisits = $this->getMetric($row, 'nb_visits');
-
- return Piwik::getQuotientSafe($sumVisitLength, $nbVisits, $precision = 0);
- }
-
- public function format($value, Formatter $formatter)
- {
- return $formatter->getPrettyTimeFromSeconds($value, true);
- }
-
- public function getTranslatedName()
- {
- return Piwik::translate('General_ColumnAvgTimeOnSite');
- }
-
- public function getDependentMetrics()
- {
- return array('sum_visit_length', 'nb_visits');
- }
-
- public function getSemanticType(): ?string
- {
- return Dimension::TYPE_DURATION_S;
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/BounceRate.php b/plugins/CoreHome/Columns/Metrics/BounceRate.php
deleted file mode 100644
index 210f95a699b2f702a689d3d9ce4d70848e9f01b4..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/BounceRate.php
+++ /dev/null
@@ -1,60 +0,0 @@
-getPrettyPercentFromQuotient($value);
- }
-
- public function compute(Row $row)
- {
- $bounceCount = $this->getMetric($row, 'bounce_count');
- $visits = $this->getMetric($row, 'nb_visits');
-
- return Piwik::getQuotientSafe($bounceCount, $visits, $precision = 2);
- }
-
- public function getSemanticType(): ?string
- {
- return Dimension::TYPE_PERCENT;
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php b/plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php
deleted file mode 100644
index 1a3566ee1a0551cff967beb2da07bf74d40d559b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/CallableProcessedMetric.php
+++ /dev/null
@@ -1,56 +0,0 @@
-name = $name;
- $this->callback = $callback;
- $this->dependentMetrics = $dependentMetrics;
- $this->semanticType = $semanticType;
- }
-
- public function getName()
- {
- return $this->name;
- }
-
- public function compute(Row $row)
- {
- if ($this->callback) {
- return call_user_func($this->callback, $row);
- }
- }
-
- public function getTranslatedName()
- {
- return '';
- }
-
- public function getDependentMetrics()
- {
- return $this->dependentMetrics;
- }
-
- public function getSemanticType(): ?string
- {
- return $this->semanticType;
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/ConversionRate.php b/plugins/CoreHome/Columns/Metrics/ConversionRate.php
deleted file mode 100644
index 9d893f5f2531a3efd9ee58600793ddf7c69d9b2f..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/ConversionRate.php
+++ /dev/null
@@ -1,65 +0,0 @@
-getPrettyPercentFromQuotient($value);
- }
-
- public function compute(Row $row)
- {
- $nbVisitsConverted = $this->getMetric($row, 'nb_visits_converted');
- $nbVisits = $this->getMetric($row, 'nb_visits');
- return Piwik::getQuotientSafe($nbVisitsConverted, $nbVisits, $precision = 4);
- }
-
- public function getSemanticType(): ?string
- {
- return Dimension::TYPE_PERCENT;
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php b/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php
deleted file mode 100644
index fa866c1f18b64211d690e2940f47775446de9f85..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php
+++ /dev/null
@@ -1,288 +0,0 @@
-wrapped = $wrapped;
- $this->isLowerBetter = Metrics::isLowerValueBetter($this->wrapped);
- $this->pastData = $pastData;
- $this->currentData = $currentData;
-
- if (empty($evolutionMetricName)) {
- $wrappedName = $this->getWrappedName();
- $evolutionMetricName = $wrappedName . '_evolution';
- }
-
- $this->evolutionMetricTrendName = $evolutionMetricName . '_trend';
- $this->evolutionMetricName = $evolutionMetricName;
- $this->quotientPrecision = $quotientPrecision;
- }
-
- public function getName()
- {
- return $this->evolutionMetricName;
- }
-
- public function getTrendName()
- {
- return $this->evolutionMetricTrendName;
- }
-
- public function getTranslatedName()
- {
- if ($this->wrapped instanceof Metric) {
- $metricName = $this->wrapped->getTranslatedName();
- } else {
- $defaultMetricTranslations = Metrics::getDefaultMetricTranslations();
- $metricName = isset($defaultMetricTranslations[$this->wrapped]) ? $defaultMetricTranslations[$this->wrapped] : $this->wrapped;
- }
- return Piwik::translate('CoreHome_EvolutionMetricName', [$metricName]);
- }
-
- public function getTrendValue($computedValue = 0)
- {
- if ($this->isLowerBetter) {
- return ($computedValue < 0 ? 1 : ($computedValue > 0 ? -1 : 0));
- }
-
- return ($computedValue < 0 ? -1 : ($computedValue > 0 ? 1 : 0));
- }
-
- public function compute(Row $row)
- {
- $columnName = $this->getWrappedName();
- $pastRow = $this->getPastRowFromCurrent($row);
-
- $currentValue = $this->getMetric($row, $columnName);
- $pastValue = $pastRow ? $this->getMetric($pastRow, $columnName) : 0;
-
- if ($row->getMetadata('ratio') === false) {
- // Reduce past value proportionally to match the percent of the current period which is complete, if applicable
- $ratio = self::getRatio($this->currentData, $this->pastData, $row);
- $row->setMetadata('ratio', $ratio);
- }
-
- if ($row->getMetadata('currencySymbol') === false) {
- $row->setMetadata(
- 'currencySymbol',
- $row['label'] !== DataTable::ID_SUMMARY_ROW && $row['label'] !== DataTable::LABEL_TOTALS_ROW ? Site::getCurrencySymbolFor($row['label']) : API::getInstance()->getDefaultCurrency()
- );
- }
-
- $row->setMetadata('previous_' . $columnName, $pastValue);
-
- if ($row->getMetadata('previousRange') === false || $row->getMetadata('periodName') === false) {
- $period = $this->pastData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX);
- $row->setMetadata('periodName', $period->getLabel());
- $row->setMetadata('previousRange', $period->getLocalizedShortString());
- }
-
- $pastValue = ($pastValue * $row->getMetadata('ratio'));
-
- $dividend = $currentValue - $pastValue;
- $divisor = $pastValue;
-
- if ($dividend == 0) {
- return 0;
- } elseif ($divisor == 0) {
- return 1;
- } else {
- return Piwik::getQuotientSafe($dividend, $divisor, $this->quotientPrecision + 2);
- }
- }
-
- public function format($value, Formatter $formatter)
- {
- return $formatter->getPrettyPercentFromQuotient($value);
- }
-
- public function getDependentMetrics()
- {
- return array($this->getWrappedName());
- }
-
- public function beforeComputeSubtable(Row $row)
- {
- $this->labelPath[] = $row->getColumn('label');
- }
-
- public function afterComputeSubtable(Row $row)
- {
- array_pop($this->labelPath);
- }
-
- protected function getWrappedName()
- {
- return $this->wrapped instanceof Metric ? $this->wrapped->getName() : $this->wrapped;
- }
-
- /**
- * public for Insights use.
- */
- public function getPastRowFromCurrent(Row $row)
- {
- $pastData = $this->getPastDataTable();
- if (empty($pastData)) {
- return null;
- }
-
- $label = $row->getColumn('label');
- return $label ? $pastData->getRowFromLabel($label) : $pastData->getFirstRow();
- }
-
- private function getPastDataTable()
- {
- $result = $this->pastData;
- foreach ($this->labelPath as $label) {
- $row = $result->getRowFromLabel($label);
- if (empty($row)) {
- return null;
- }
-
- $subtable = $row->getSubtable();
- if (empty($subtable)) {
- return null;
- }
-
- $result = $subtable;
- }
- return $result;
- }
-
- /**
- * Calculate the ratio of time between a past period and current incomplete period
- *
- * eg. if today is Thursday at 12:00pm and the past period is a week then the ratio is 0.5, exactly half of the
- * current incomplete period has passed
- *
- * If the current period end is in the past then the ratio will always be 1, since the current period is complete.
- *
- * @return float|int
- * @throws \Exception
- */
- public static function getRatio(?DataTable $currentData, ?DataTable $pastData, Row $row)
- {
- $ratio = 1;
-
- if ($currentData != null && $pastData != null) {
- $p = $pastData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX);
-
- $pStart = $p->getDateStart()->setTime('00:00:00');
- $pEnd = $p->getDateEnd()->setTime('23:59:59');
-
- $c = $currentData->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX);
- $cStart = $c->getDateStart()->setTime('00:00:00');
- $cEnd = $c->getDateEnd()->setTime('23:59:59');
-
- $nowTS = Date::getNowTimestamp();
-
- // If we know the date the the datatable data was generated then use that instead of now
- $archivedDateStr = $row->getMetadata(DataTable::ARCHIVED_DATE_METADATA_NAME);
-
- if ($archivedDateStr) {
- $archivedDate = Date::factory($archivedDateStr);
- if ($archivedDate) {
- $nowTS = Date::factory($archivedDate)->getTimestamp();
- }
- }
-
- if ($cStart->getTimestamp() <= $nowTS && $cEnd->getTimestamp() >= $nowTS) {
- $secsInPastPeriod = $pEnd->getTimestamp() - $pStart->getTimestamp();
- $secsInCurrentPeriod = $nowTS - $cStart->getTimestamp();
- $ratio = $secsInCurrentPeriod / $secsInPastPeriod;
- }
- }
-
- return round($ratio, 3);
- }
-
- public function getSemanticType(): ?string
- {
- return Dimension::TYPE_PERCENT;
- }
-}
diff --git a/plugins/CoreHome/Columns/Metrics/VisitsPercent.php b/plugins/CoreHome/Columns/Metrics/VisitsPercent.php
deleted file mode 100644
index 60c838650b6a0630c090dc8a7354ac0a99b718f1..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Metrics/VisitsPercent.php
+++ /dev/null
@@ -1,86 +0,0 @@
-forceTotalVisits = $totalVisits;
- }
-
- public function getName()
- {
- return 'nb_visits_percentage';
- }
-
- public function getTranslatedName()
- {
- return Piwik::translate('General_ColumnPercentageVisits');
- }
-
- public function getDocumentation()
- {
- return Piwik::translate('General_ColumnPercentageVisitsDocumentation');
- }
-
- public function compute(Row $row)
- {
- $visits = $this->getMetric($row, 'nb_visits');
-
- return Piwik::getQuotientSafe($visits, $this->cachedTotalVisits, $precision = 2);
- }
-
- public function format($value, Formatter $formatter)
- {
- return $formatter->getPrettyPercentFromQuotient($value);
- }
-
- public function getDependentMetrics()
- {
- return array('nb_visits');
- }
-
- public function beforeCompute($report, DataTable $table)
- {
- if ($this->forceTotalVisits === null) {
- $this->cachedTotalVisits = array_sum($this->getMetricValues($table, 'nb_visits'));
- } else {
- $this->cachedTotalVisits = $this->forceTotalVisits;
- }
-
- return true; // always compute
- }
-
- public function getSemanticType(): ?string
- {
- return Dimension::TYPE_PERCENT;
- }
-}
diff --git a/plugins/CoreHome/Columns/Profilable.php b/plugins/CoreHome/Columns/Profilable.php
deleted file mode 100644
index a3f1958d3ee52237bb15686e4768a8caf58ee152..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/Profilable.php
+++ /dev/null
@@ -1,54 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return ['0', '1'];
- };
- }
-
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- $value = $request->getVisitorId();
-
- if (empty($value)) {
- return 0;
- }
-
- return 1;
- }
-
- public function onExistingVisit(Request $request, Visitor $visitor, $action)
- {
- if ($visitor->getVisitorColumn($this->columnName)) {
- // once it is 1, we don't set it back to 0 if user disables cookies later cause user would be still idenfied
- // for this same visit with the fingerprint
- return 1;
- }
-
- return $this->onNewVisit($request, $visitor, $action);
- }
-}
diff --git a/plugins/CoreHome/Columns/ServerMinute.php b/plugins/CoreHome/Columns/ServerMinute.php
deleted file mode 100644
index 892c3891e78077847e075c0f426baa7fd1f0fb82..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/ServerMinute.php
+++ /dev/null
@@ -1,35 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(59, $maxValuesToReturn));
- };
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/ServerTime.php b/plugins/CoreHome/Columns/ServerTime.php
deleted file mode 100644
index 6c73d0d0177370e5162e5460fbea5b304e50dd28..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/ServerTime.php
+++ /dev/null
@@ -1,57 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(23, $maxValuesToReturn));
- };
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- $hourInTz = VisitLastActionTime::convertHourToHourInSiteTimezone($value, $idSite);
- return \Piwik\Plugins\VisitTime\getTimeLabel($hourInTz);
- }
-
- public function install()
- {
- $changes = parent::install();
- $changes['log_link_visit_action'][] = "ADD INDEX index_idsite_servertime ( idsite, server_time )";
-
- return $changes;
- }
-
- public function onNewAction(Request $request, Visitor $visitor, Action $action)
- {
- $timestamp = $request->getCurrentTimestamp();
-
- return Date::getDatetimeFromTimestamp($timestamp);
- }
-}
diff --git a/plugins/CoreHome/Columns/UserId.php b/plugins/CoreHome/Columns/UserId.php
deleted file mode 100644
index 510ec8027ca7dea790b6a0be7ca4bc52197e9ab9..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/UserId.php
+++ /dev/null
@@ -1,156 +0,0 @@
-columnType = 'VARCHAR(' . self::MAXLENGTH . ') NULL';
-
- if (Plugin\Manager::getInstance()->isPluginActivated('UserId')) {
- $this->suggestedValuesApi = 'UserId.getUsers';
- }
- }
-
- public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
- {
- // Configure userId segment only if visitor profile is available
- if (Live::isVisitorProfileEnabled()) {
- parent::configureSegments($segmentsList, $dimensionSegmentFactory);
- }
- }
-
- /**
- * @param Action|null $action
- * @return mixed|false
- */
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- $value = $request->getForcedUserId();
- if (!empty($value)) {
- return mb_substr($value, 0, self::MAXLENGTH);
- }
- return $value;
- }
-
- /**
- * @param Action|null $action
- *
- * @return mixed|false
- */
- public function onExistingVisit(Request $request, Visitor $visitor, $action)
- {
- return $this->onNewVisit($request, $visitor, $action);
- }
-
- public function isUsedInAtLeastOneSite($idSites, $period, $date)
- {
- if ($period === 'day' || $period === 'week') {
- $period = 'month';
- }
-
- if ($period === 'range') {
- $period = 'day';
- }
-
- if (!empty($idSites)) {
- foreach ($idSites as $idSite) {
- if ($this->isUsedInSiteCached($idSite, $period, $date)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- private function isUsedInSiteCached($idSite, $period, $date)
- {
- $cache = Cache::getTransientCache();
- $key = sprintf('%d.%s.%s', $idSite, $period, $date);
-
- if (!$cache->contains($key)) {
- $result = $this->isUsedInSite($idSite, $period, $date);
- $cache->save($key, $result);
- }
-
- return $cache->fetch($key);
- }
-
- private function isUsedInSite($idSite, $period, $date)
- {
- $result = \Piwik\API\Request::processRequest('VisitsSummary.get', [
- 'columns' => 'nb_users',
- 'idSite' => $idSite,
- 'period' => $period,
- 'date' => $date,
- 'segment' => false,
- ], $default = []);
-
- return $this->hasDataTableUsers($result);
- }
-
- public function hasDataTableUsers(DataTable\DataTableInterface $result)
- {
- if ($result instanceof Map) {
- foreach ($result->getDataTables() as $table) {
- if ($this->hasDataTableUsers($table)) {
- return true;
- }
- }
- }
-
- if (!$result->getRowsCount()) {
- return false;
- }
-
- $firstRow = $result->getFirstRow();
- if ($firstRow instanceof DataTable\Row && $firstRow->hasColumn(Metrics::INDEX_NB_USERS)) {
- $metric = Metrics::INDEX_NB_USERS;
- } else {
- $metric = 'nb_users';
- }
-
- $numUsers = $result->getColumn($metric);
- $numUsers = array_sum($numUsers);
-
- return !empty($numUsers);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitFirstActionMinute.php b/plugins/CoreHome/Columns/VisitFirstActionMinute.php
deleted file mode 100644
index a3f7cd205bd66f1f708e51f18075497318a2f31c..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitFirstActionMinute.php
+++ /dev/null
@@ -1,45 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(59, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics to be generated
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitFirstActionTime.php b/plugins/CoreHome/Columns/VisitFirstActionTime.php
deleted file mode 100644
index d0eb65f2eb174b5da7f252a2609263696bec1c8a..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitFirstActionTime.php
+++ /dev/null
@@ -1,53 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(23, $maxValuesToReturn));
- };
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- $hourInTz = VisitLastActionTime::convertHourToHourInSiteTimezone($value, $idSite);
- return \Piwik\Plugins\VisitTime\getTimeLabel($hourInTz);
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- return Date::getDatetimeFromTimestamp($request->getCurrentTimestamp());
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitGoalBuyer.php b/plugins/CoreHome/Columns/VisitGoalBuyer.php
deleted file mode 100644
index b4fe3fe7f6d152016b6268a40602bb6e71561fb7..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitGoalBuyer.php
+++ /dev/null
@@ -1,140 +0,0 @@
- 'none',
- self::TYPE_BUYER_ORDERED => 'ordered',
- self::TYPE_BUYER_OPEN_CART => 'abandonedCart',
- self::TYPE_BUYER_ORDERED_AND_OPEN_CART => 'orderedThenAbandonedCart',
- );
-
- protected $columnName = 'visit_goal_buyer';
- protected $columnType = 'TINYINT(1) NULL';
- protected $segmentName = 'visitEcommerceStatus';
- protected $nameSingular = 'General_EcommerceVisitStatusDesc';
- protected $type = self::TYPE_ENUM;
-
- public function __construct()
- {
- $example = Piwik::translate('General_EcommerceVisitStatusEg', '"&segment=visitEcommerceStatus==ordered,visitEcommerceStatus==orderedThenAbandonedCart"');
- $this->acceptValues = implode(", ", self::$visitEcommerceStatus) . '. ' . $example;
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- switch ($value) {
- case 'none':
- case '0':
- case self::TYPE_BUYER_NONE:
- return Piwik::translate('UserCountryMap_None');
- case 'ordered':
- case '1':
- case self::TYPE_BUYER_ORDERED:
- return Piwik::translate('CoreHome_VisitStatusOrdered');
- case 'abandonedCart':
- case self::TYPE_BUYER_OPEN_CART:
- return Piwik::translate('Goals_AbandonedCart');
- case 'orderedThenAbandonedCart':
- case self::TYPE_BUYER_ORDERED_AND_OPEN_CART:
- return Piwik::translate('CoreHome_VisitStatusOrderedThenAbandoned');
- }
-
- return $value;
- }
-
- public function getEnumColumnValues()
- {
- return self::$visitEcommerceStatus;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- return $this->getBuyerType($request);
- }
-
- /**
- * @param Action|null $action
- * @return int|false
- */
- public function onExistingVisit(Request $request, Visitor $visitor, $action)
- {
- $goalBuyer = $visitor->getVisitorColumn($this->columnName);
-
- // Ecommerce buyer status
- $visitEcommerceStatus = $this->getBuyerType($request, $goalBuyer);
-
- if (
- $visitEcommerceStatus != self::TYPE_BUYER_NONE
- // only update if the value has changed (prevents overwriting the value in case a request has
- // updated it in the meantime)
- && $visitEcommerceStatus != $goalBuyer
- ) {
- return $visitEcommerceStatus;
- }
-
- return false;
- }
-
- /**
- * @ignore
- */
- public static function getVisitEcommerceStatusFromId($id)
- {
- if (!isset(self::$visitEcommerceStatus[$id])) {
- throw new \Exception("Unexpected ECommerce status value ");
- }
-
- return self::$visitEcommerceStatus[$id];
- }
-
- private function getBuyerType(Request $request, $existingType = self::TYPE_BUYER_NONE)
- {
- $isRequestEcommerce = $request->getMetadata('Ecommerce', 'isRequestEcommerce');
- if (!$isRequestEcommerce) {
- return $existingType;
- }
-
- $isGoalAnOrder = $request->getMetadata('Ecommerce', 'isGoalAnOrder');
- if ($isGoalAnOrder) {
- return self::TYPE_BUYER_ORDERED;
- }
-
- // request is Add to Cart
- if (
- $existingType == self::TYPE_BUYER_ORDERED
- || $existingType == self::TYPE_BUYER_ORDERED_AND_OPEN_CART
- ) {
- return self::TYPE_BUYER_ORDERED_AND_OPEN_CART;
- }
-
- return self::TYPE_BUYER_OPEN_CART;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitGoalConverted.php b/plugins/CoreHome/Columns/VisitGoalConverted.php
deleted file mode 100644
index 95484672f81254ec252587b819af879b26f500b1..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitGoalConverted.php
+++ /dev/null
@@ -1,61 +0,0 @@
-createCustomMetric('nb_visits_converted', Piwik::translate('General_ColumnVisitsWithConversions'), 'sum(case %s when 1 then 1 else 0 end)');
- $metric1->setType(Dimension::TYPE_NUMBER);
- $metricsList->addMetric($metric1);
-
- $metric = $dimensionMetricFactory->createComputedMetric($metric1->getName(), 'nb_visits', ComputedMetric::AGGREGATION_RATE);
- $metric->setTranslatedName(Piwik::translate('General_ColumnConversionRate'));
- $metric->setDocumentation(Piwik::translate('General_ColumnConversionRateDocumentation'));
- $metric->setName('visits_conversion_rate');
- $metricsList->addMetric($metric);
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- return 0;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onConvertedVisit(Request $request, Visitor $visitor, $action)
- {
- return 1;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitId.php b/plugins/CoreHome/Columns/VisitId.php
deleted file mode 100644
index a79384d2fef807cfb3c5d351a2f377e53c0d0855..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitId.php
+++ /dev/null
@@ -1,51 +0,0 @@
-setName('General_VisitId');
- $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_UNIQUE);
- $metric->setTranslatedName(Piwik::translate('General_ColumnNbVisits'));
- $metric->setDocumentation(Piwik::translate('General_ColumnNbVisitsDocumentation'));
- $metric->setName('nb_visits');
- $metricsList->addMetric($metric);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitIp.php b/plugins/CoreHome/Columns/VisitIp.php
deleted file mode 100644
index 8fca51c2ce9230e3b2a8bf83cdd648a282b0533c..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitIp.php
+++ /dev/null
@@ -1,53 +0,0 @@
-visitIp>13.54.122.0;visitIp<13.54.122.255']);
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- $value = Common::hex2bin($value);
- $value = IPUtils::binaryToStringIP($value);
- return $value;
- }
-
- public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
- {
- $segment = new Segment();
- $segment->setType(Segment::TYPE_METRIC); // we cannot remove this for now as it would assign dimension based on text type
- $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionDate.php b/plugins/CoreHome/Columns/VisitLastActionDate.php
deleted file mode 100644
index ae948835f95c76e75824211c3baf3ed70163063b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionDate.php
+++ /dev/null
@@ -1,53 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- if (defined('PIWIK_TEST_MODE') && PIWIK_TEST_MODE) {
- $date = Date::factory('2018-02-02');
- } else {
- $date = Date::now();
- }
- $return = array($date->toString());
- for ($i = 0; $i < $maxValuesToReturn; $i++) {
- $date = $date->subDay(1);
- $return[] = $date->toString();
- }
- return $return;
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionDayOfMonth.php b/plugins/CoreHome/Columns/VisitLastActionDayOfMonth.php
deleted file mode 100644
index ff54857b455824569033070ce7799e7e3168123a..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionDayOfMonth.php
+++ /dev/null
@@ -1,42 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(31, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionDayOfWeek.php b/plugins/CoreHome/Columns/VisitLastActionDayOfWeek.php
deleted file mode 100644
index 1c98079145f00f09b8d59f95dd5a8db690a65281..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionDayOfWeek.php
+++ /dev/null
@@ -1,44 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(1, min(7, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return \Piwik\Plugins\VisitTime\translateDayOfWeek($value);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionDayOfYear.php b/plugins/CoreHome/Columns/VisitLastActionDayOfYear.php
deleted file mode 100644
index 26051033cbbd7acb7a6a7234581c7c50f850cec6..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionDayOfYear.php
+++ /dev/null
@@ -1,42 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(1, min(366, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionMinute.php b/plugins/CoreHome/Columns/VisitLastActionMinute.php
deleted file mode 100644
index 96e510317f68db09a185eb0cf156e5580ca44659..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionMinute.php
+++ /dev/null
@@ -1,49 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(59, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionMonth.php b/plugins/CoreHome/Columns/VisitLastActionMonth.php
deleted file mode 100644
index 3216deb8fa240b21c076813aab023bfe2d112f3c..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionMonth.php
+++ /dev/null
@@ -1,44 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(1, min(12, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return \Piwik\Plugins\VisitTime\translateMonth($value);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionQuarter.php b/plugins/CoreHome/Columns/VisitLastActionQuarter.php
deleted file mode 100644
index 6bc0be0dd8fa7b38c72d5d3ce7d34d1edf3dcd07..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionQuarter.php
+++ /dev/null
@@ -1,42 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(1, min(4, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionSecond.php b/plugins/CoreHome/Columns/VisitLastActionSecond.php
deleted file mode 100644
index e241da64f87dcf0424c1d4d8a3c28c749ffdc3bb..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionSecond.php
+++ /dev/null
@@ -1,42 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(0, min(59, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionTime.php b/plugins/CoreHome/Columns/VisitLastActionTime.php
deleted file mode 100644
index 57533c607d8f39af10f9acfa17e7bc845a21749f..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionTime.php
+++ /dev/null
@@ -1,114 +0,0 @@
-getDateStart();
- } catch (\Exception $e) {
- // ignore any error eg if values are wrong...
- }
- }
- $timezone = Site::getTimezoneFor($idSite);
- $datetime = $date->toString() . ' ' . $hour . ':00:00';
- $hourInTz = (int)Date::factory($datetime, $timezone)->toString('H');
- return $hourInTz;
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- $hourInTz = self::convertHourToHourInSiteTimezone($value, $idSite);
-
- return \Piwik\Plugins\VisitTime\getTimeLabel($hourInTz);
- }
-
- // we do not install or define column definition here as we need to create this column when installing as there is
- // an index on it. Currently we do not define the index here... although we could overwrite the install() method
- // and add column 'visit_last_action_time' and add index. Problem is there is also an index
- // INDEX(idsite, config_id, visit_last_action_time) and we maybe not be sure whether idsite already exists at
- // installing point (we do not know whether idsite column will be added first).
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- return Date::getDatetimeFromTimestamp($request->getCurrentTimestamp());
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onExistingVisit(Request $request, Visitor $visitor, $action)
- {
- if ($request->getParam('ping') == 1) {
- return false;
- }
-
- $originalVisitLastActionTime = $visitor->getPreviousVisitColumn('visit_last_action_time');
-
- if (
- !empty($originalVisitLastActionTime)
- && Date::factory($originalVisitLastActionTime)->getTimestamp() > $request->getCurrentTimestamp()
- ) {
- // make sure to not set visit_last_action_time to an earlier time eg if tracking requests aren't sent in order
- return $originalVisitLastActionTime;
- }
-
- return $this->onNewVisit($request, $visitor, $action);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionWeekOfYear.php b/plugins/CoreHome/Columns/VisitLastActionWeekOfYear.php
deleted file mode 100644
index 5b0d22c9f4efc6fcf3d92cf48e117247d7a62dfe..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionWeekOfYear.php
+++ /dev/null
@@ -1,42 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(1, min(53, $maxValuesToReturn));
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitLastActionYear.php b/plugins/CoreHome/Columns/VisitLastActionYear.php
deleted file mode 100644
index 48816bd8c4e3890c6823b089edff179c766934fd..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitLastActionYear.php
+++ /dev/null
@@ -1,42 +0,0 @@
-suggestedValuesCallback = function ($idSite, $maxValuesToReturn) {
- return range(2016, 2016 + $maxValuesToReturn);
- };
- }
-
- public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory)
- {
- // no metrics for this dimension
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- return $value;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitTotalTime.php b/plugins/CoreHome/Columns/VisitTotalTime.php
deleted file mode 100644
index 7a013ee67ebf3818973236755c509258f1c45424..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitTotalTime.php
+++ /dev/null
@@ -1,89 +0,0 @@
-Tracker['default_time_one_page_visit'];
- $totalTime = $this->cleanupVisitTotalTime($totalTime);
-
- return $totalTime;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onExistingVisit(Request $request, Visitor $visitor, $action)
- {
- $firstActionTime = $visitor->getVisitorColumn('visit_first_action_time');
-
- $totalTime = 1 + $request->getCurrentTimestamp() - $firstActionTime;
- $totalTime = $this->cleanupVisitTotalTime($totalTime);
-
- return $totalTime;
- }
-
- /**
- * @param Action|null $action
- * @return int|false
- */
- public function onConvertedVisit(Request $request, Visitor $visitor, $action)
- {
- if (!$visitor->isVisitorKnown()) {
- return false;
- }
-
- $totalTime = $visitor->getVisitorColumn('visit_total_time');
-
- // If a pageview and goal conversion in the same second, with previously a goal conversion recorded
- // the request would not "update" the row since all values are the same as previous
- // therefore the request below throws exception, instead we make sure the UPDATE will affect the row
- $totalTime = $totalTime + $request->getParam('idgoal');
- // +2 to offset idgoal=-1 and idgoal=0
- $totalTime = $totalTime + 2;
-
- return $this->cleanupVisitTotalTime($totalTime);
- }
-
- public function getRequiredVisitFields()
- {
- return array('visit_first_action_time');
- }
-
- private function cleanupVisitTotalTime($t)
- {
- $t = (int)$t;
-
- if ($t < 0) {
- $t = 0;
- }
-
- return $t;
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php b/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php
deleted file mode 100644
index 4842b0afb460e9f3c2a3f1384cb597c49da76d8f..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php
+++ /dev/null
@@ -1,37 +0,0 @@
-setSegment('daysSinceFirstVisit');
- $segment->setName('General_DaysSinceFirstVisit');
- $segment->setCategory('General_Visitors');
- $segment->setSqlSegment('log_visit.visitor_seconds_since_first');
- $segment->setSqlFilterValue(function ($value) {
- return (int)$value * 86400;
- });
- $segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php b/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php
deleted file mode 100644
index 079cdd91613de51a25a6c42ee6f2a85d5a5c932c..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php
+++ /dev/null
@@ -1,22 +0,0 @@
-createMetric(ArchivedMetric::AGGREGATION_UNIQUE);
- $metric->setTranslatedName(Piwik::translate('General_VisitorFingerprint'));
- $metricsList->addMetric($metric);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitorId.php b/plugins/CoreHome/Columns/VisitorId.php
deleted file mode 100644
index e0f96fe3254c555cc57afbd2f51c2ba25e3ee562..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitorId.php
+++ /dev/null
@@ -1,65 +0,0 @@
-createMetric(ArchivedMetric::AGGREGATION_UNIQUE);
- $metric->setTranslatedName(Piwik::translate('General_ColumnNbUniqVisitors'));
- $metric->setName('nb_uniq_visitors');
- $metricsList->addMetric($metric);
- }
-
- public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
- {
- try {
- $visitorProfileEnabled = Live::isVisitorProfileEnabled();
- } catch (\Zend_Db_Exception $e) {
- // when running tests the db might not yet be set up when fetching available segments
- if (!defined('PIWIK_TEST_MODE') || !PIWIK_TEST_MODE) {
- throw $e;
- }
- $visitorProfileEnabled = true;
- }
-
- if ($visitorProfileEnabled) {
- parent::configureSegments($segmentsList, $dimensionSegmentFactory);
- }
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitorReturning.php b/plugins/CoreHome/Columns/VisitorReturning.php
deleted file mode 100644
index 9ce37affe14b8f1bfd6942bab6d18714a7826ef7..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitorReturning.php
+++ /dev/null
@@ -1,97 +0,0 @@
-acceptValues = 'new, returning, returningCustomer. ';
- $this->acceptValues .= Piwik::translate('General_VisitTypeExample', '"&segment=visitorType==returning,visitorType==returningCustomer"');
- $this->sqlFilterValue = function ($type) {
- if (is_numeric($type)) {
- return $type;
- }
- return $type == "new" ? 0 : ($type == "returning" ? 1 : 2);
- };
- }
-
- public function formatValue($value, $idSite, Formatter $formatter)
- {
- if ($value === 1 || $value === '1' || $value === 'returning') {
- return Piwik::translate('CoreHome_VisitTypeReturning');
- } elseif ($value === 2 || $value === '2' || $value === 'returningCustomer') {
- return Piwik::translate('CoreHome_VisitTypeReturningCustomer');
- } elseif ($value === 0 || $value === '0' || $value === 'new') {
- return Piwik::translate('General_New');
- }
-
- return $value;
- }
-
- public function getEnumColumnValues()
- {
- return array(
- self::IS_RETURNING_CUSTOMER => 'returningCustomer',
- self::IS_RETURNING => 'returning',
- self::IS_NEW => 'new',
- );
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onNewVisit(Request $request, Visitor $visitor, $action)
- {
- $hasOrder = $visitor->getVisitorColumn('visitor_seconds_since_order')
- ?: $visitor->getPreviousVisitColumn('visitor_seconds_since_order')
- ?: $request->getParam('ec_id');
- $isReturningCustomer = (bool) $hasOrder;
-
- if ($isReturningCustomer) {
- return self::IS_RETURNING_CUSTOMER;
- }
-
- if ($visitor->isVisitorKnown()) {
- return self::IS_RETURNING;
- }
-
- return self::IS_NEW;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
- {
- return $visitor->getVisitorColumn($this->columnName);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitorSecondsSinceFirst.php b/plugins/CoreHome/Columns/VisitorSecondsSinceFirst.php
deleted file mode 100644
index 2c4f454514fdbfa48fbfa10b03a75bbaa837a818..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitorSecondsSinceFirst.php
+++ /dev/null
@@ -1,84 +0,0 @@
-isVisitorKnown()) {
- return 0;
- }
-
- $prevSecondsSinceFirst = $visitor->getPreviousVisitColumn('visitor_seconds_since_first');
-
- // no data for previous visit, we can't calculate for this one
- if (
- $prevSecondsSinceFirst === null
- || $prevSecondsSinceFirst === false
- || $prevSecondsSinceFirst === ''
- ) {
- return null;
- }
-
- $prevVisitStart = $visitor->getPreviousVisitColumn('visit_first_action_time');
- $currentVisitStart = $visitor->getVisitorColumn('visit_first_action_time');
- if (
- empty($prevVisitStart)
- || empty($currentVisitStart)
- ) {
- Common::printDebug("Unexpected: found empty visit first action time for either previous or current visit (previous = $prevVisitStart, current = $currentVisitStart)");
- return null;
- }
-
- try {
- $timeBetweenVisitStarts = Date::factory($currentVisitStart)->getTimestamp() - Date::factory($prevVisitStart)->getTimestamp();
- } catch (\Exception $ex) {
- Common::printDebug("Error in parsing current/previous visit start datetime values: " . $ex->getMessage());
- return null;
- }
-
- $newVisitorSecondsSinceFirst = $prevSecondsSinceFirst + $timeBetweenVisitStarts;
-
- if ($newVisitorSecondsSinceFirst < 0) { // visit in the past
- return null;
- }
-
- return $newVisitorSecondsSinceFirst;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
- {
- return $visitor->getVisitorColumn($this->columnName);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitorSecondsSinceOrder.php b/plugins/CoreHome/Columns/VisitorSecondsSinceOrder.php
deleted file mode 100644
index c96444010ed166aef1e2ab1969a70d41b8efd482..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitorSecondsSinceOrder.php
+++ /dev/null
@@ -1,76 +0,0 @@
-onExistingVisit($request, $visitor, $action);
- }
-
- public function onExistingVisit(Request $request, Visitor $visitor, $action)
- {
- $idorder = $request->getParam('ec_id');
- $isOrder = !empty($idorder);
- if ($isOrder) {
- return 0;
- }
-
- $existingValue = $visitor->getVisitorColumn($this->columnName);
- if ($existingValue !== null && $existingValue !== false) { // already set
- return $existingValue;
- }
-
- $prevSecondsSinceLastOrder = $visitor->getPreviousVisitColumn($this->columnName);
- if ($prevSecondsSinceLastOrder === null || $prevSecondsSinceLastOrder === false) { // no order at all for visitor
- return null;
- }
-
- $visitFirstActionTime = $visitor->getPreviousVisitColumn('visit_first_action_time');
- if ($visitFirstActionTime === null || $visitFirstActionTime === false) { // no previous visit
- return null;
- }
-
- $visitFirstActionTime = Date::factory($visitFirstActionTime)->getTimestamp();
- $secondsSinceLastAction = $request->getCurrentTimestamp() - $visitFirstActionTime;
-
- $secondsSinceLastOrder = $prevSecondsSinceLastOrder + $secondsSinceLastAction;
- return $secondsSinceLastOrder;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
- {
- return $visitor->getVisitorColumn($this->columnName);
- }
-}
diff --git a/plugins/CoreHome/Columns/VisitsCount.php b/plugins/CoreHome/Columns/VisitsCount.php
deleted file mode 100644
index ea67871694e3e0fca72bef2b881a1de8fb7f6095..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Columns/VisitsCount.php
+++ /dev/null
@@ -1,54 +0,0 @@
-getPreviousVisitColumn($this->columnName);
- if ($previousVisitCount === false || $previousVisitCount === null || $previousVisitCount === '') {
- return 1;
- }
- $result = $previousVisitCount + 1;
- return $result;
- }
-
- /**
- * @param Action|null $action
- * @return mixed
- */
- public function onAnyGoalConversion(Request $request, Visitor $visitor, $action)
- {
- return $visitor->getVisitorColumn($this->columnName);
- }
-}
diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php
deleted file mode 100644
index 7bea4fa96cb16014983ae2d810936b4345d6897d..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Controller.php
+++ /dev/null
@@ -1,356 +0,0 @@
-translator = $translator;
-
- parent::__construct();
-
- $this->featureFlagManager = new FeatureFlagManager(
- [new ConfigFeatureFlagStorage(Config::getInstance())],
- StaticContainer::get(LoggerInterface::class)
- );
- }
-
- public function getDefaultAction()
- {
- return 'redirectToCoreHomeIndex';
- }
-
- public function renderReportWidget(Report $report)
- {
- Piwik::checkUserHasSomeViewAccess();
- $this->checkSitePermission();
-
- $report->checkIsEnabled();
-
- return $report->render();
- }
-
- /**
- * Renders a widget container (used for dashboard/tab widget containers as well as
- * widgetized/exported embeds).
- * @return string
- */
- public function renderWidgetContainer()
- {
- Piwik::checkUserHasSomeViewAccess();
- $this->checkSitePermission();
-
- $view = new View('@CoreHome/widgetContainer');
- $view->isWidgetized = (bool) Common::getRequestVar('widget', 0, 'int');
- $view->containerId = Common::getRequestVar('containerId', null, 'string');
-
- return $view->render();
- }
-
- /**
- * @param Widget $widget
- * @return mixed
- * @throws Exception
- */
- public function renderWidget($widget)
- {
- Piwik::checkUserHasSomeViewAccess();
-
- $config = new WidgetConfig();
- $widget::configure($config);
-
- $content = $widget->render();
-
- if ($config->getName() && Common::getRequestVar('showtitle', '', 'string') === '1') {
- if (
- strpos($content, '') === false
- && strpos($content, 'class="card"') === false
- && strpos($content, "class='card'") === false
- && strpos($content, 'class="card-content"') === false
- && strpos($content, "class='card-content'") === false
- ) {
- $view = new View('@CoreHome/_singleWidget');
- $view->title = $config->getName();
- $view->content = $content;
- return $view->render();
- }
- }
-
- return $content;
- }
-
- public function redirectToCoreHomeIndex()
- {
- $defaultReport = API::getInstance()->getUserPreference(
- API::PREFERENCE_DEFAULT_REPORT,
- Piwik::getCurrentUserLogin()
- );
- $module = 'CoreHome';
- $action = 'index';
-
- // User preference: default report to load is the All Websites dashboard
- if (
- $defaultReport == 'MultiSites'
- && \Piwik\Plugin\Manager::getInstance()->isPluginActivated('MultiSites')
- ) {
- $module = 'MultiSites';
- }
-
- if ($defaultReport == Piwik::getLoginPluginName()) {
- $module = Piwik::getLoginPluginName();
- }
-
- parent::redirectToIndex($module, $action, $this->idSite);
- }
-
- public function showInContext()
- {
- $controllerName = Common::getRequestVar('moduleToLoad');
- $actionName = Common::getRequestVar('actionToLoad', 'index');
-
- if ($controllerName == 'API') {
- throw new Exception("Showing API requests in context is not supported for security reasons. Please change query parameter 'moduleToLoad'.");
- }
- if ($actionName == 'showInContext') {
- throw new Exception("Preventing infinite recursion...");
- }
-
- $view = $this->getDefaultIndexView();
- $view->content = FrontController::getInstance()->fetchDispatch($controllerName, $actionName);
- return $view->render();
- }
-
- public function markNotificationAsRead()
- {
- Piwik::checkUserHasSomeViewAccess();
- $this->checkTokenInUrl();
-
- $notificationId = Common::getRequestVar('notificationId');
- NotificationManager::cancel($notificationId);
-
- Json::sendHeaderJSON();
- return json_encode(true);
- }
-
- protected function getDefaultIndexView()
- {
- if (SettingsPiwik::isInternetEnabled() && Marketplace::isMarketplaceEnabled()) {
- $this->securityPolicy->addPolicy('img-src', '*.matomo.org');
- $this->securityPolicy->addPolicy('default-src', '*.matomo.org');
- }
-
- $view = new View('@CoreHome/getDefaultIndexView');
- $this->setGeneralVariablesView($view);
- $view->showMenu = true;
- $view->content = '';
- $view->exampleFeatureEnabled = $this->featureFlagManager->isFeatureActive(Example::class);
- $view->groupsWithoutTrackingRequirement = CategoryList::get()->getGroupsWithoutTrackingRequirement();
- return $view;
- }
-
- protected function setDateTodayIfWebsiteCreatedToday()
- {
- $date = Common::getRequestVar('date', false);
- if (
- $date == 'today'
- || Common::getRequestVar('period', false) == 'range'
- ) {
- return;
- }
-
- if ($this->site) {
- $datetimeCreationDate = $this->site->getCreationDate()->getDatetime();
- $creationDateLocalTimezone = Date::factory($datetimeCreationDate, $this->site->getTimezone())->toString('Y-m-d');
- $todayLocalTimezone = Date::factory('now', $this->site->getTimezone())->toString('Y-m-d');
-
- if ($creationDateLocalTimezone == $todayLocalTimezone) {
- Piwik::redirectToModule(
- 'CoreHome',
- 'index',
- array('date' => 'today',
- 'idSite' => $this->idSite,
- 'period' => Common::getRequestVar('period'))
- );
- }
- }
- }
-
- public function index()
- {
- $this->setDateTodayIfWebsiteCreatedToday();
- $view = $this->getDefaultIndexView();
- return $view->render();
- }
-
- // --------------------------------------------------------
- // ROW EVOLUTION
- // The following methods render the popover that shows the
- // evolution of a single or multiple rows in a data table
- // --------------------------------------------------------
-
- /** Render the entire row evolution popover for a single row */
- public function getRowEvolutionPopover()
- {
- $rowEvolution = $this->makeRowEvolution($isMulti = false);
- $view = new View('@CoreHome/getRowEvolutionPopover');
- return $rowEvolution->renderPopover($this, $view);
- }
-
- /** Render the entire row evolution popover for multiple rows */
- public function getMultiRowEvolutionPopover()
- {
- $rowEvolution = $this->makeRowEvolution($isMulti = true);
- $view = new View('@CoreHome/getMultiRowEvolutionPopover');
- return $rowEvolution->renderPopover($this, $view);
- }
-
- /** Generic method to get an evolution graph or a sparkline for the row evolution popover */
- public function getRowEvolutionGraph($fetch = false, $rowEvolution = null)
- {
- if (empty($rowEvolution)) {
- $label = Common::getRequestVar('label', '', 'string');
- $isMultiRowEvolution = strpos($label, ',') !== false;
-
- $rowEvolution = $this->makeRowEvolution($isMultiRowEvolution, $graphType = 'graphEvolution');
- $rowEvolution->useAvailableMetrics();
- }
-
- $view = $rowEvolution->getRowEvolutionGraph();
- return $this->renderView($view);
- }
-
- /** Utility function. Creates a RowEvolution instance. */
- private function makeRowEvolution($isMultiRowEvolution, $graphType = null)
- {
- if ($isMultiRowEvolution) {
- return new MultiRowEvolution($this->idSite, $this->date, $graphType);
- } else {
- return new RowEvolution($this->idSite, $this->date, $graphType);
- }
- }
-
- /**
- * Forces a check for updates and re-renders the header message.
- *
- * This will check piwik.org at most once per 10s.
- */
- public function checkForUpdates()
- {
- Piwik::checkUserHasSomeAdminAccess();
- $this->checkTokenInUrl();
-
- // perform check (but only once every 10s)
- UpdateCheck::check($force = false, UpdateCheck::UI_CLICK_CHECK_INTERVAL);
-
- $view = new View('@CoreHome/checkForUpdates');
- $view->isManualUpdateCheck = true;
- $view->lastUpdateCheckFailed = UpdateCheck::hasLastCheckFailed();
- $this->setGeneralVariablesView($view);
- return $view->render();
- }
-
- /**
- * Redirects the user to a paypal so they can donate to Piwik.
- */
- public function redirectToPaypal()
- {
- $parameters = Request::getRequestArrayFromString($request = null);
- foreach ($parameters as $name => $param) {
- if (
- $name == 'idSite'
- || $name == 'module'
- || $name == 'action'
- ) {
- unset($parameters[$name]);
- }
- }
- $paypalParameters = [
- "cmd" => "_s-xclick",
- ];
- if (empty($parameters["onetime"]) || $parameters["onetime"] != "true") {
- $paypalParameters["hosted_button_id"] = "DVKLY73RS7JTE";
- $paypalParameters["currency_code"] = "USD";
- $paypalParameters["on0"] = "Piwik Supporter";
- if (!empty($parameters["os0"])) {
- $paypalParameters["os0"] = $parameters["os0"];
- }
- } else {
- $paypalParameters["hosted_button_id"] = "RPL23NJURMTFA";
- }
-
- $url = "https://www.paypal.com/cgi-bin/webscr?" . Url::getQueryStringFromParameters($paypalParameters);
-
- Url::redirectToUrl($url);
- exit;
- }
-
- public function saveViewDataTableParameters()
- {
- Piwik::checkUserIsNotAnonymous();
- $this->checkTokenInUrl();
-
- $reportId = Common::getRequestVar('report_id', null, 'string');
- $parameters = (array) Common::getRequestVar('parameters', null, 'json');
- $login = Piwik::getCurrentUserLogin();
- $containerId = Common::getRequestVar('containerId', '', 'string');
-
- ViewDataTableManager::saveViewDataTableParameters($login, $reportId, $parameters, $containerId);
- }
-}
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php
deleted file mode 100644
index 4b26004014985ae1be6c8718f878757b67452c9b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/CoreHome.php
+++ /dev/null
@@ -1,498 +0,0 @@
- 'getStylesheetFiles',
- 'AssetManager.getJavaScriptFiles' => 'getJsFiles',
- 'AssetManager.filterMergedJavaScripts' => 'filterMergedJavaScripts',
- 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
- 'Metric.addComputedMetrics' => 'addComputedMetrics',
- 'Request.initAuthenticationObject' => ['function' => 'checkAllowedIpsOnAuthentication', 'before' => true],
- 'AssetManager.addStylesheets' => 'addStylesheets',
- 'Request.dispatchCoreAndPluginUpdatesScreen' => ['function' => 'checkAllowedIpsOnAuthentication', 'before' => true],
- 'Tracker.setTrackerCacheGeneral' => 'setTrackerCacheGeneral',
- 'Segment.filterSegments' => 'filterSegments',
- 'Template.bodyClass' => 'addBodyClass',
- );
- }
-
- public function addBodyClass(&$out, $type)
- {
- $featureFlagManager = StaticContainer::get(FeatureFlagManager::class);
-
- // The report header redesign moves widget controls and report actions to a shared
- // top-right header. It is gated app-wide by this flag so later tickets can scope
- // CSS/JS with `body.report-header-redesign-enabled` across every report surface.
- if ($featureFlagManager->isFeatureActive(ReportHeaderRedesign::class)) {
- $out .= ' report-header-redesign-enabled';
- }
- }
-
- public function isTrackerPlugin()
- {
- return true;
- }
-
- public function setTrackerCacheGeneral(&$cacheGeneral)
- {
- /** @var ArchiveInvalidator $archiveInvalidator */
- $archiveInvalidator = StaticContainer::get(ArchiveInvalidator::class);
- $cacheGeneral[ArchiveInvalidator::TRACKER_CACHE_KEY] = $archiveInvalidator->getAllRememberToInvalidateArchivedReportsLater();
-
- $hasIndex = DbHelper::tableHasIndex(Common::prefixTable('log_visit'), 'index_idsite_idvisitor_time');
- $cacheGeneral[TrackerModel::CACHE_KEY_INDEX_IDSITE_IDVISITOR_TIME] = $hasIndex;
- }
-
- public function addStylesheets(&$mergedContent)
- {
- $themeStyles = ThemeStyles::get();
- $mergedContent = $themeStyles->toLessCode() . "\n" . $mergedContent;
- }
-
- public function checkAllowedIpsOnAuthentication()
- {
- if (SettingsServer::isTrackerApiRequest()) {
- // authenticated tracking requests should always work
- return;
- }
-
- $isApi = Piwik::getModule() === 'API' && (Piwik::getAction() == '' || Piwik::getAction() == 'index');
-
- if ($isApi) {
- // will be checked in API itself to make sure we return an API response in the proper format.
- return;
- }
-
- $list = new LoginAllowlist();
- if ($list->shouldCheckAllowlist()) {
- $ip = IP::getIpFromHeader();
- $list->checkIsAllowed($ip);
- }
- }
-
- public function addComputedMetrics(MetricsList $list, ComputedMetricFactory $computedMetricFactory)
- {
- $metrics = $list->getMetrics();
- foreach ($metrics as $metric) {
- if ($metric instanceof ArchivedMetric && $metric->getDimension()) {
- $metricName = $metric->getName();
- if (
- $metric->getDbTableName() === 'log_visit'
- && $metricName !== 'nb_uniq_visitors'
- && $metricName !== 'nb_visits'
- && strpos($metricName, ArchivedMetric::AGGREGATION_SUM_PREFIX) === 0
- ) {
- $metric = $computedMetricFactory->createComputedMetric($metric->getName(), 'nb_visits', ComputedMetric::AGGREGATION_AVG);
- $list->addMetric($metric);
- }
- }
- }
- }
-
- public function filterMergedJavaScripts(&$mergedContent)
- {
- $mergedContent = preg_replace('/(sourceMappingURL=(.*?).map)/', '', $mergedContent);
- }
-
- public function getStylesheetFiles(&$stylesheets)
- {
- $stylesheets[] = "node_modules/jquery-ui-dist/jquery-ui.min.css";
- $stylesheets[] = "node_modules/jquery-ui-dist/jquery-ui.theme.min.css";
- $stylesheets[] = "node_modules/@materializecss/materialize/dist/css/materialize.min.css";
- $stylesheets[] = "plugins/Morpheus/stylesheets/base/bootstrap.css";
- $stylesheets[] = "plugins/Morpheus/stylesheets/base/icons.css";
- $stylesheets[] = "plugins/Morpheus/stylesheets/base.less";
- $stylesheets[] = "plugins/Morpheus/stylesheets/main.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/coreHome.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/dataTable.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/cloud.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/jquery.ui.autocomplete.css";
- $stylesheets[] = "plugins/CoreHome/stylesheets/sparklineColors.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/promo.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/color_manager.css";
- $stylesheets[] = "plugins/CoreHome/stylesheets/sparklineColors.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/notification.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/zen-mode.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/layout.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/matomo-loader.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/EnrichedHeadline/EnrichedHeadline.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/Notification/Notification.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/QuickAccess/QuickAccess.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/SearchInput/SearchInput.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/selector.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/ReportingPage/ReportingPage.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/ReportExport/ReportExport.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/WidgetByDimensionContainer/WidgetByDimensionContainer.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/Progressbar/Progressbar.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/MultiPairField/MultiPairField.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/DropdownMenu/DropdownMenu.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/DraggableList/DraggableList.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/Sparkline/Sparkline.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/FieldArray/FieldArray.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/Comparisons/Comparisons.less";
- $stylesheets[] = "plugins/CoreHome/stylesheets/vue-transitions.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/PasswordStrength/PasswordStrength.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/EntityDuplicator/EntityDuplicatorModal.less";
- $stylesheets[] = "plugins/CoreHome/vue/src/EntityDuplicator/EntityDuplicatorAction.less";
- }
-
- public function getJsFiles(&$jsFiles)
- {
- $jsFiles[] = "node_modules/jquery/dist/jquery.min.js";
- $jsFiles[] = "node_modules/jquery-ui-dist/jquery-ui.min.js";
- $jsFiles[] = "node_modules/@materializecss/materialize/dist/js/materialize.min.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/materialize-bc.js";
- $jsFiles[] = "node_modules/jquery.scrollto/jquery.scrollTo.min.js";
- $jsFiles[] = "node_modules/sprintf-js/dist/sprintf.min.js";
- $jsFiles[] = "node_modules/mousetrap/mousetrap.min.js";
-
- $jsFiles[] = "plugins/Morpheus/javascripts/piwikHelper.js";
- $jsFiles[] = "plugins/Morpheus/javascripts/layout.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/require.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/uiControl.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/dataTable.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/dataTable_rowactions.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/popover.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/broadcast.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/calendar.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/sparkline.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/corehome.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/top_controls.js";
- $jsFiles[] = "libs/jqplot/jqplot-custom.min.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/themes.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/color_manager.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/notification.js";
- $jsFiles[] = "plugins/CoreHome/javascripts/listingFormatter.js";
-
- // we have to load these CorePluginsAdmin files here. If we loaded them in CorePluginsAdmin,
- // there would be JS errors as CorePluginsAdmin is loaded first. Meaning it is loaded before
- // any Vue UMD file is loaded etc.
- $jsFiles[] = "node_modules/iframe-resizer/js/iframeResizer.min.js";
- $jsFiles[] = "node_modules/iframe-resizer/js/iframeResizer.contentWindow.min.js";
- }
-
- public function getClientSideTranslationKeys(&$translationKeys)
- {
- $translationKeys[] = 'General_Export';
- $translationKeys[] = 'General_InvalidDateRange';
- $translationKeys[] = 'General_Loading';
- $translationKeys[] = 'General_Show';
- $translationKeys[] = 'General_Remove';
- $translationKeys[] = 'General_Hide';
- $translationKeys[] = 'General_Save';
- $translationKeys[] = 'General_Website';
- $translationKeys[] = 'General_Pagination';
- $translationKeys[] = 'General_RowsToDisplay';
- $translationKeys[] = 'Intl_Year_Short';
- $translationKeys[] = 'General_MultiSitesSummary';
- $translationKeys[] = 'General_SearchNoResults';
- $translationKeys[] = 'CoreHome_ChooseX';
- $translationKeys[] = 'CoreHome_ClickToSeeFullInformation';
- $translationKeys[] = 'CoreHome_YouAreUsingTheLatestVersion';
- $translationKeys[] = 'CoreHome_IncludeRowsWithLowPopulation';
- $translationKeys[] = 'CoreHome_ExcludeRowsWithLowPopulation';
- $translationKeys[] = 'CoreHome_DataTableIncludeAggregateRows';
- $translationKeys[] = 'CoreHome_DataTableExcludeAggregateRows';
- $translationKeys[] = 'CoreHome_DataTableCombineDimensions';
- $translationKeys[] = 'CoreHome_DataTableShowDimensions';
- $translationKeys[] = 'CoreHome_Default';
- $translationKeys[] = 'CoreHome_FormatMetrics';
- $translationKeys[] = 'CoreHome_ShowExportUrl';
- $translationKeys[] = 'CoreHome_HideExportUrl';
- $translationKeys[] = 'CoreHome_FlattenDataTable';
- $translationKeys[] = 'CoreHome_UnFlattenDataTable';
- $translationKeys[] = 'CoreHome_ExternalHelp';
- $translationKeys[] = 'CoreHome_ClickToEditX';
- $translationKeys[] = 'CoreHome_Menu';
- $translationKeys[] = 'CoreHome_AddTotalsRowDataTable';
- $translationKeys[] = 'CoreHome_RemoveTotalsRowDataTable';
- $translationKeys[] = 'CoreHome_PeriodHasOnlyRawData';
- $translationKeys[] = 'CoreHome_PeriodHasOnlyRawDataNoVisitsLog';
- $translationKeys[] = 'SitesManager_NotFound';
- $translationKeys[] = 'Annotations_ViewAndAddAnnotations';
- $translationKeys[] = 'General_RowEvolutionRowActionTooltipTitle';
- $translationKeys[] = 'General_RowEvolutionRowActionTooltip';
- $translationKeys[] = 'Annotations_IconDesc';
- $translationKeys[] = 'Annotations_IconDescHideNotes';
- $translationKeys[] = 'Annotations_HideAnnotationsFor';
- $translationKeys[] = 'General_LoadingPopover';
- $translationKeys[] = 'General_LoadingPopoverFor';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_1';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_2';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_3';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_4';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_5';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_6';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_7';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_8';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_9';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_10';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_11';
- $translationKeys[] = 'Intl_Month_Short_StandAlone_12';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_1';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_2';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_3';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_4';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_5';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_6';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_7';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_8';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_9';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_10';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_11';
- $translationKeys[] = 'Intl_Month_Long_StandAlone_12';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_1';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_2';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_3';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_4';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_5';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_6';
- $translationKeys[] = 'Intl_Day_Short_StandAlone_7';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_1';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_2';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_3';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_4';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_5';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_6';
- $translationKeys[] = 'Intl_Day_Long_StandAlone_7';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_1';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_2';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_3';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_4';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_5';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_6';
- $translationKeys[] = 'Intl_Day_Min_StandAlone_7';
- $translationKeys[] = 'Intl_PeriodDay';
- $translationKeys[] = 'Intl_PeriodWeek';
- $translationKeys[] = 'Intl_PeriodMonth';
- $translationKeys[] = 'Intl_PeriodYear';
- $translationKeys[] = 'Intl_ListPatternAnd2';
- $translationKeys[] = 'Intl_ListPatternAndEnd';
- $translationKeys[] = 'Intl_ListPatternAndMiddle';
- $translationKeys[] = 'Intl_ListPatternAndStart';
- $translationKeys[] = 'Intl_ListPatternOr2';
- $translationKeys[] = 'Intl_ListPatternOrEnd';
- $translationKeys[] = 'Intl_ListPatternOrMiddle';
- $translationKeys[] = 'Intl_ListPatternOrStart';
- $translationKeys[] = 'General_DateRangeInPeriodList';
- $translationKeys[] = 'General_And';
- $translationKeys[] = 'General_All';
- $translationKeys[] = 'General_Search';
- $translationKeys[] = 'General_Clear';
- $translationKeys[] = 'General_MoreDetails';
- $translationKeys[] = 'General_Help';
- $translationKeys[] = 'General_MoreDetails';
- $translationKeys[] = 'General_HelpReport';
- $translationKeys[] = 'General_Id';
- $translationKeys[] = 'General_Name';
- $translationKeys[] = 'General_JsTrackingTag';
- $translationKeys[] = 'General_Yes';
- $translationKeys[] = 'General_No';
- $translationKeys[] = 'General_Edit';
- $translationKeys[] = 'General_Delete';
- $translationKeys[] = 'General_Default';
- $translationKeys[] = 'General_LoadingData';
- $translationKeys[] = 'General_Error';
- $translationKeys[] = 'General_ErrorRequest';
- $translationKeys[] = 'General_ErrorRateLimit';
- $translationKeys[] = 'General_ErrorRequestFaqLink';
- $translationKeys[] = 'General_Warning';
- $translationKeys[] = 'General_YourChangesHaveBeenSaved';
- $translationKeys[] = 'General_LearnMore';
- $translationKeys[] = 'General_ChooseDate';
- $translationKeys[] = 'General_ReadThisToLearnMore';
- $translationKeys[] = 'CoreHome_UndoPivotBySubtable';
- $translationKeys[] = 'CoreHome_PivotBySubtable';
- $translationKeys[] = 'General_LearnMore';
- $translationKeys[] = 'CoreHome_NoSuchPage';
- $translationKeys[] = 'CoreHome_QuickAccessTitle';
- $translationKeys[] = 'CoreHome_Segments';
- $translationKeys[] = 'CoreHome_MenuEntries';
- $translationKeys[] = 'SitesManager_Sites';
- $translationKeys[] = 'CoreHome_MainNavigation';
- $translationKeys[] = 'CoreHome_ChangeCurrentWebsite';
- $translationKeys[] = 'General_CreatedByUser';
- $translationKeys[] = 'General_DateRangeFromTo';
- $translationKeys[] = 'General_DateRangeFrom';
- $translationKeys[] = 'General_DateRangeTo';
- $translationKeys[] = 'General_DoubleClickToChangePeriod';
- $translationKeys[] = 'General_Apply';
- $translationKeys[] = 'General_ChoosePeriod';
- $translationKeys[] = 'General_Period';
- $translationKeys[] = 'General_CompareTo';
- $translationKeys[] = 'CoreHome_PresetDateToday';
- $translationKeys[] = 'CoreHome_PresetDateYesterday';
- $translationKeys[] = 'CoreHome_PresetDateLast7Days';
- $translationKeys[] = 'CoreHome_PresetDateLast30Days';
- $translationKeys[] = 'CoreHome_PresetDateLast90Days';
- $translationKeys[] = 'CoreHome_PresetDateLastWeekMonSun';
- $translationKeys[] = 'CoreHome_PresetDateLastMonth';
- $translationKeys[] = 'CoreHome_PresetDateLastQuarter';
- $translationKeys[] = 'CoreHome_PresetDateLastYear';
- $translationKeys[] = 'CoreHome_PresetDateThisWeekMonToday';
- $translationKeys[] = 'CoreHome_PresetDateThisMonth';
- $translationKeys[] = 'CoreHome_PresetDateThisQuarter';
- $translationKeys[] = 'CoreHome_PresetDateThisYear';
- $translationKeys[] = 'CoreHome_DateInvalid';
- $translationKeys[] = 'CoreHome_EnterZenMode';
- $translationKeys[] = 'CoreHome_ExitZenMode';
- $translationKeys[] = 'CoreHome_ShortcutZenMode';
- $translationKeys[] = 'CoreHome_ShortcutSegmentSelector';
- $translationKeys[] = 'CoreHome_ShortcutWebsiteSelector';
- $translationKeys[] = 'CoreHome_ShortcutCalendar';
- $translationKeys[] = 'CoreHome_ShortcutSearch';
- $translationKeys[] = 'CoreHome_ShortcutHelp';
- $translationKeys[] = 'CoreHome_ShortcutRefresh';
- $translationKeys[] = 'CoreHome_StandardReport';
- $translationKeys[] = 'CoreHome_ReportWithMetadata';
- $translationKeys[] = 'CoreHome_ReportType';
- $translationKeys[] = 'CoreHome_RowLimit';
- $translationKeys[] = 'CoreHome_ExportFormat';
- $translationKeys[] = 'CoreHome_ExportTooltip';
- $translationKeys[] = 'CoreHome_ExportTooltipWithLink';
- $translationKeys[] = 'CoreHome_FlattenReport';
- $translationKeys[] = 'CoreHome_IncludeDimensionsSeparately';
- $translationKeys[] = 'CoreHome_CustomLimit';
- $translationKeys[] = 'CoreHome_ExpandSubtables';
- $translationKeys[] = 'CoreHome_HomeShortcut';
- $translationKeys[] = 'CoreHome_PageUpShortcutDescription';
- $translationKeys[] = 'CoreHome_EndShortcut';
- $translationKeys[] = 'CoreHome_PageDownShortcutDescription';
- $translationKeys[] = 'CoreHome_MacPageUp';
- $translationKeys[] = 'CoreHome_MacPageDown';
- $translationKeys[] = 'CoreHome_SearchOnMatomo';
- $translationKeys[] = 'General_ComputedMetricMax';
- $translationKeys[] = 'General_XComparedToY';
- $translationKeys[] = 'General_ComparisonCardTooltip1';
- $translationKeys[] = 'General_ComparisonCardTooltip2';
- $translationKeys[] = 'General_Comparisons';
- $translationKeys[] = 'General_ClickToRemoveComp';
- $translationKeys[] = 'General_Custom';
- $translationKeys[] = 'General_PreviousPeriod';
- $translationKeys[] = 'General_PreviousYear';
- $translationKeys[] = 'CoreHome_ReportingCategoryHelpPrefix';
- $translationKeys[] = 'CoreHome_TechDeprecationWarning';
- $translationKeys[] = 'CoreHome_StartDate';
- $translationKeys[] = 'CoreHome_EndDate';
- $translationKeys[] = 'CoreHome_InvalidComparisonDateRange';
- $translationKeys[] = 'CoreHome_DataForThisReportHasBeenDisabled';
- $translationKeys[] = 'CoreHome_ChangeVisualization';
- $translationKeys[] = 'CoreHome_ReportConfigure';
- $translationKeys[] = 'General_ExportThisReport';
- $translationKeys[] = 'Annotations_Annotations';
- $translationKeys[] = 'CoreHome_CloseSearch';
- $translationKeys[] = 'CoreHome_DataTableHowToSearch';
- $translationKeys[] = 'CoreHome_ChangePeriod';
- $translationKeys[] = 'General_NewUpdatePiwikX';
- $translationKeys[] = 'CoreHome_SeeAvailableVersions';
- $translationKeys[] = 'CoreHome_OneClickUpdateNotPossibleAsMultiServerEnvironment';
- $translationKeys[] = 'General_PiwikXIsAvailablePleaseUpdateNow';
- $translationKeys[] = 'General_PiwikXIsAvailablePleaseNotifyPiwikAdmin';
- $translationKeys[] = 'General_YouAreCurrentlyUsing';
- $translationKeys[] = 'General_Copy';
- $translationKeys[] = 'General_CopiedToClipboard';
- $translationKeys[] = 'CoreHome_ReportLowercase';
- $translationKeys[] = 'CoreHome_LearnMoreFullStop';
- $translationKeys[] = 'CoreHome_ChooseWebsite';
- $translationKeys[] = 'CoreHome_CopyModalNote';
- $translationKeys[] = 'CoreHome_CopyX';
- $translationKeys[] = 'CoreHome_CopyXDescription';
- $translationKeys[] = 'CoreHome_WebAnalyticsReports';
-
- // add admin menu translations
- if (
- SettingsPiwik::isMatomoInstalled()
- && Common::getRequestVar('module', '') != 'CoreUpdater'
- && Piwik::isUserHasSomeViewAccess()
- ) {
- /*
- * Executed as super user to ensure we are able to add translations for all menu entries that might be displayed.
- */
- Access::doAsSuperUser(function () use (&$translationKeys) {
- $menu = MenuAdmin::getInstance()->getMenu();
- foreach ($menu as $level1 => $level2) {
- if (strpos($level1, '_') !== false) {
- $translationKeys[] = $level1;
- }
- foreach ($level2 as $name => $params) {
- if (strpos($name, '_') !== false) {
- $translationKeys[] = $name;
- }
- }
- }
- });
- }
- }
-
- public function filterSegments(SegmentsList &$list, array $idSites)
- {
- $limitSegmentsSettingEnabled = false;
- if (empty($idSites)) {
- $limitSegmentsSettingEnabled = LimitSegments::getInstance()->getValue();
- } else {
- foreach ($idSites as $idsite) {
- $limitSegmentsSettingEnabled |= LimitSegments::getInstance($idsite)->getValue();
- }
- }
- if ($limitSegmentsSettingEnabled) {
- $list->remove('General_Visitors', 'userId');
- $list->remove('General_Visitors', 'visitIp');
- $list->remove('General_Visitors', 'visitId');
- $list->remove('General_Visitors', 'visitorId');
- $list->remove('General_Visitors', 'fingerprint');
- $list->remove('Referrers_Referrers', 'campaignId');
- $list->remove('General_Actions', 'actionServerHour');
- $list->remove('General_Actions', 'actionServerMinute');
- $list->remove('General_Visitors', 'visitServerHour');
- $list->remove('General_Visitors', 'visitEndServerMinute');
- $list->remove('General_Visitors', 'visitEndServerSecond');
- $list->remove('General_Visitors', 'visitStartServerHour');
- $list->remove('General_Visitors', 'visitStartServerMinute');
- }
- }
-}
diff --git a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php
deleted file mode 100644
index 6bad435e99b6917d9d9f6c44c3364d3ae7c80b85..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php
+++ /dev/null
@@ -1,109 +0,0 @@
-date from controller)
- * @param string $graphType
- */
- public function __construct($idSite, $date, $graphType = 'graphEvolution')
- {
- $this->metric = Common::sanitizeInputValue(Request::fromRequest()->getStringParameter('column', ''));
- parent::__construct($idSite, $date, $graphType);
- }
-
- protected function loadEvolutionReport($column = false)
- {
- // set the "column" parameter for the API.getRowEvolution call
- parent::loadEvolutionReport($this->metric);
- }
-
- protected function extractEvolutionReport($report)
- {
- $this->metric = $report['column'];
- $this->dataTable = $report['reportData'];
- $this->availableMetrics = $report['metadata']['metrics'];
- $this->metricsForSelect = $report['metadata']['columns'];
- $this->dimension = $report['metadata']['dimension'];
- }
-
- /**
- * Render the popover
- * @param \Piwik\Plugins\CoreHome\Controller $controller
- * @param \Piwik\View $view the popover_rowevolution template
- * @return string
- */
- public function renderPopover($controller, $view)
- {
- // add data for metric select box
- $view->availableMetrics = $this->metricsForSelect;
- $view->selectedMetric = $this->metric;
-
- $view->availableRecordsText = $this->dimension . ': '
- . Piwik::translate('RowEvolution_ComparingRecords', array(count($this->availableMetrics)));
-
- return parent::renderPopover($controller, $view);
- }
-
- protected function getRowEvolutionGraphFromController(\Piwik\Plugins\CoreHome\Controller $controller)
- {
- // the row evolution graphs should not compare serieses
- return Context::executeWithQueryParameters(['compareSegments' => [], 'comparePeriods' => [], 'compareDates' => []], function () use ($controller) {
- return parent::getRowEvolutionGraphFromController($controller);
- });
- }
-
- public function getRowEvolutionGraph($graphType = false, $metrics = false)
- {
- // the row evolution graphs should not compare serieses
- return Context::executeWithQueryParameters(['compareSegments' => [], 'comparePeriods' => [], 'compareDates' => []], function () use ($graphType, $metrics) {
- return parent::getRowEvolutionGraph($graphType, $metrics);
- });
- }
-
- protected function getSparkline($metric)
- {
- // the row evolution graphs should not compare serieses
- return Context::executeWithQueryParameters(['compareSegments' => [], 'comparePeriods' => [], 'compareDates' => []], function () use ($metric) {
- return parent::getSparkline($metric);
- });
- }
-}
diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
deleted file mode 100644
index 42ded45fe24a2fb0c9d7bceccec1a8675c300cff..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php
+++ /dev/null
@@ -1,524 +0,0 @@
-
- */
- protected $availableMetrics;
-
- /**
- * The name of the dimension of the current report
- * @var string
- */
- protected $dimension;
-
- /**
- * The data
- * @var Map
- */
- protected $dataTable;
-
- /**
- * The label of the current record
- * @var string
- */
- protected $rowLabel;
-
- /**
- * The icon of the current record
- * @var string|false
- */
- protected $rowIcon;
-
- /**
- * The type of graph that has been requested last
- * @var string
- */
- protected $graphType;
-
- /**
- * The metrics for the graph that has been requested last
- * @var array
- */
- protected $graphMetrics;
-
- /**
- * Whether or not to show all metrics in the evolution graph when to popover opens
- * @var bool
- */
- protected $initiallyShowAllMetrics = false;
-
- /**
- * The constructor
- * Initialize some local variables from the request
- * @param int $idSite
- * @param Date $date ($this->date from controller)
- * @param string $graphType
- * @throws Exception
- */
- public function __construct($idSite, $date, $graphType = 'graphEvolution')
- {
- $this->apiMethod = Common::getRequestVar('apiMethod', '', 'string');
- if (empty($this->apiMethod)) {
- throw new Exception("Parameter apiMethod not set.");
- }
-
- $label = DataTablePostProcessor::getLabelFromRequest($_GET);
- if (!is_array($label)) {
- throw new Exception("Expected label to be an array, got instead: " . $label);
- }
- $this->label = Common::unsanitizeInputValue($label[0]);
-
- if ($this->label === '') {
- throw new Exception("Parameter label not set.");
- }
-
- $this->period = Common::getRequestVar('period', '', 'string');
- PeriodFactory::checkPeriodIsEnabled($this->period);
-
- if ($this->period != 'range' && !($date instanceof Date)) {
- throw new Exception("Expected date to be an instance of \\Piwik\\Date");
- }
-
- $this->idSite = $idSite;
- $this->graphType = $graphType;
-
- if ($this->period != 'range') {
- // handle day, week, month and year: display last X periods
- //handle cache if exist
- $cache = ViewDataTableManager::getViewDataTableParameters(
- Piwik::getCurrentUserLogin(),
- 'CoreHome.getRowEvolutionGraph'
- );
- $lastDay = (isset($cache['evolution_' . $this->period . '_last_n']) ? $cache['evolution_' . $this->period . '_last_n'] : null);
- $end = $date->toString();
- [$this->date, $lastN] = EvolutionViz::getDateRangeAndLastN($this->period, $end, $lastDay);
- }
- $this->segment = \Piwik\API\Request::getRawSegmentFromRequest();
-
- $this->loadEvolutionReport();
- }
-
- /**
- * Render the popover
- * @param \Piwik\Plugins\CoreHome\Controller $controller
- * @param \Piwik\View $view the popover_rowevolution template
- * @return string
- */
- public function renderPopover($controller, $view)
- {
- // render main evolution graph
- $this->graphType = 'graphEvolution';
- $this->graphMetrics = $this->availableMetrics;
- $view->graph = $this->getRowEvolutionGraphFromController($controller);
-
- // render metrics overview
- $view->metrics = $this->getMetricsToggles();
-
- // available metrics text
- $metricsText = Piwik::translate('RowEvolution_AvailableMetrics');
- $popoverTitle = '';
- if ($this->rowLabel) {
- $icon = $this->rowIcon ? '
' : '';
- $rowLabel = str_replace('/', '/', str_replace('&', '&', $this->rowLabel));
- $metricsText = sprintf(Piwik::translate('RowEvolution_MetricsFor'), $this->dimension . ': ' . $icon . ' ' . $rowLabel);
- $popoverTitle = $icon . ' ' . $this->rowLabel;
- }
-
- $view->availableMetricsText = $metricsText;
- $view->popoverTitle = $popoverTitle;
-
- return $view->render();
- }
-
- /**
- * @param string|false|null $column
- * @return void
- */
- protected function loadEvolutionReport($column = false)
- {
- [$apiModule, $apiAction] = explode('.', $this->apiMethod);
-
- // getQueryStringFromParameters expects sanitised query parameter values
- $parameters = array(
- 'method' => 'API.getRowEvolution',
- 'label' => $this->label,
- 'apiModule' => $apiModule,
- 'apiAction' => $apiAction,
- 'idSite' => $this->idSite,
- 'period' => $this->period,
- 'date' => $this->date,
- 'format' => 'original',
- 'serialize' => '0',
- );
-
- if (!empty($this->segment)) {
- $parameters['segment'] = $this->segment;
- }
-
- if ($column !== false) {
- $parameters['column'] = $column;
- }
-
- $unmodifiedSeriesLabels = [];
- $isComparing = DataComparisonFilter::isCompareParamsPresent();
- if ($isComparing) {
- $compareDates = Common::getRequestVar('compareDates', [], 'array');
- $comparePeriods = Common::getRequestVar('comparePeriods', [], 'array');
- $compareSegments = Common::getRequestVar('compareSegments', [], 'array');
-
- $totalSeriesCount = (count($compareSegments) + 1) * (count($comparePeriods) + 1);
-
- for ($i = 0; $i < $totalSeriesCount; ++$i) {
- $unmodifiedSeriesLabels[] = DataComparisonFilter::getPrettyComparisonLabelFromSeriesIndex($i);
- }
-
- $parameters['compare'] = 1;
-
- foreach ($comparePeriods as $index => $period) {
- $date = $compareDates[$index];
-
- if ($period == 'range') {
- $comparePeriods[$index] = 'day';
- } else {
- [$newDate, $lastN] = EvolutionViz::getDateRangeAndLastN($period, $date);
- $compareDates[$index] = $newDate;
- }
- }
-
- $parameters['compareDates'] = $compareDates;
- $parameters['comparePeriods'] = $comparePeriods;
- }
-
- $parameters = array_filter($parameters, function ($value) {
- return $value !== null && $value !== false;
- });
-
- /** @var array{label: string, reportData: Map, metadata: array{metrics: array, dimension: string, columns: array}} $report */
- $report = Request::processRequest('API.getRowEvolution', $parameters);
-
- // at this point the report data will reference the comparison series labels for the changed compare periods/dates. We don't
- // want to show this to users because they will not recognize the changed periods, so we have to replace them.
- if ($isComparing) {
- $dataTables = $report['reportData']->getDataTables();
- $modifiedSeriesLabels = reset($dataTables)->getMetadata('comparisonSeries');
- $seriesMap = array_combine($modifiedSeriesLabels, $unmodifiedSeriesLabels);
-
- foreach ($report['metadata']['metrics'] as $key => $metricInfo) {
- foreach ($seriesMap as $modified => $unmodified) {
- $report['metadata']['metrics'][$key]['name'] = str_replace($modified, $unmodified, $report['metadata']['metrics'][$key]['name']);
- }
- }
- }
-
- $this->extractEvolutionReport($report);
- }
-
- /**
- * @param array $report
- * @return void
- */
- protected function extractEvolutionReport($report)
- {
- $this->dataTable = $report['reportData'];
- $this->rowLabel = $this->extractPrettyLabel($report);
- $this->rowIcon = !empty($report['logo']) ? $report['logo'] : false;
- $this->availableMetrics = $report['metadata']['metrics'];
- $this->dimension = $report['metadata']['dimension'];
- }
-
- /**
- * Generic method to get an evolution graph or a sparkline for the row evolution popover.
- * Do as much as possible from outside the controller.
- * @param string|bool $graphType
- * @param array|bool $metrics
- * @return ViewDataTable
- */
- public function getRowEvolutionGraph($graphType = false, $metrics = false)
- {
- // set up the view data table
- $view = Factory::build(
- $graphType ? : $this->graphType,
- $this->apiMethod,
- $controllerAction = 'CoreHome.getRowEvolutionGraph',
- $forceDefault = true
- );
- $view->setDataTable($this->dataTable);
-
- if (!empty($this->graphMetrics)) { // In row Evolution popover, this is empty
- $view->config->columns_to_display = array_keys($metrics ? : $this->graphMetrics);
- }
-
- $view->requestConfig->request_parameters_to_modify['label'] = '';
- $view->config->export_parameters_to_modify['label'] = $this->label;
- $view->config->show_flatten_table_export = false;
- $view->config->show_goals = false;
- $view->config->show_search = false;
- $view->config->show_all_views_icons = false;
- $view->config->show_related_reports = false;
- $view->config->show_footer_message = false;
-
- foreach ($this->availableMetrics as $metric => $metadata) {
- $view->config->translations[$metric] = $metadata['name'];
- }
-
- if ($view->config instanceof GraphConfig) {
- $view->config->show_series_picker = false;
- }
-
- if ($view->config instanceof JqplotGraphConfig) {
- $view->config->external_series_toggle = 'RowEvolutionSeriesToggle';
- $view->config->external_series_toggle_show_all = $this->initiallyShowAllMetrics;
- }
-
- return $view;
- }
-
- /**
- * Prepare metrics toggles with spark lines
- * @return array
- */
- protected function getMetricsToggles()
- {
- $i = 0;
- $metrics = array();
- foreach ($this->availableMetrics as $metric => $metricData) {
- $unit = Metrics::getUnit($metric, $this->idSite);
- $change = isset($metricData['change']) ? $metricData['change'] : false;
-
- [$first, $last] = $this->getFirstAndLastDataPointsForMetric($metric);
- $fractionDigits = max($this->getFractionDigits($first), $this->getFractionDigits($last));
-
- $details = Piwik::translate('RowEvolution_MetricBetweenText', array(
- NumberFormatter::getInstance()->format($first, $fractionDigits) . $unit,
- NumberFormatter::getInstance()->format($last, $fractionDigits) . $unit,
- ));
-
- if ($change !== false) {
- $lowerIsBetter = Metrics::isLowerValueBetter($metric);
- if (substr($change, 0, 1) == '+') {
- $changeClass = $lowerIsBetter ? 'bad' : 'good';
- $changeImage = $lowerIsBetter ? 'arrow_up_red' : 'arrow_up';
- } elseif (substr($change, 0, 1) == '-') {
- $changeClass = $lowerIsBetter ? 'good' : 'bad';
- $changeImage = $lowerIsBetter ? 'arrow_down_green' : 'arrow_down';
- } else {
- $changeClass = 'neutral';
- $changeImage = false;
- }
-
- $change = ''
- . ($changeImage ? '
' : '')
- . $change . '';
-
- $details .= ', ' . Piwik::translate('RowEvolution_MetricChangeText', $change);
- }
-
- // set metric min/max text (used as tooltip for details)
- $max = isset($metricData['max']) ? $metricData['max'] : 0;
- $min = isset($metricData['min']) ? $metricData['min'] : 0;
- $minmax = Piwik::translate('RowEvolution_MetricMinMax', array(
- $metricData['name'],
- NumberFormatter::getInstance()->formatNumber($min, $fractionDigits, $fractionDigits) . $unit,
- NumberFormatter::getInstance()->formatNumber($max, $fractionDigits, $fractionDigits) . $unit,
- ));
-
- $newMetric = array(
- 'label' => $metricData['name'],
- 'details' => $details,
- 'minmax' => $minmax,
- 'sparkline' => $this->getSparkline($metric),
- );
- // Multi Rows, each metric can be for a particular row and display an icon
- if (!empty($metricData['logo'])) {
- $newMetric['logo'] = $metricData['logo'];
- }
-
- // TODO: this check should be determined by metric metadata, not hardcoded here
- if (
- $metric == 'nb_users'
- && $first == 0
- && $last == 0
- ) {
- $newMetric['hide'] = true;
- }
-
- $metrics[] = $newMetric;
- $i++;
- }
-
- return $metrics;
- }
-
- /**
- * Get the img tag for a sparkline showing a single metric
- *
- * @param string $metric
- * @return string
- */
- protected function getSparkline($metric)
- {
- // sparkline is always echoed, so we need to buffer the output
- $view = $this->getRowEvolutionGraph($graphType = 'sparkline', $metrics = array($metric => $metric));
-
- ob_start();
- $view->render();
- $spark = ob_get_contents();
- ob_end_clean();
-
- // undo header change by sparkline renderer
- Common::sendHeader('Content-type: text/html');
-
- // base64 encode the image and put it in an img tag
- $spark = base64_encode($spark);
- return '
';
- }
-
- /**
- * Use the available metrics for the metrics of the last requested graph.
- * @return void
- */
- public function useAvailableMetrics()
- {
- $this->graphMetrics = $this->availableMetrics;
- }
-
- /**
- * @param string|int $metric
- * @return array
- */
- private function getFirstAndLastDataPointsForMetric($metric)
- {
- $first = 0;
- $firstTable = $this->dataTable->getFirstRow();
- if (!empty($firstTable)) {
- $row = $firstTable->getFirstRow();
- if (!empty($row)) {
- $first = floatval($row->getColumn($metric));
- }
- }
-
- $last = 0;
- $lastTable = $this->dataTable->getLastRow();
- if (!empty($lastTable)) {
- $row = $lastTable->getFirstRow();
- if (!empty($row)) {
- $last = floatval($row->getColumn($metric));
- }
- }
-
- return array($first, $last);
- }
-
- /**
- * @param array $report
- * @return string
- */
- protected function extractPrettyLabel($report)
- {
- // By default, use the specified label
- $rowLabel = Common::sanitizeInputValue($report['label']);
-
- /** @var \Piwik\DataTable\Map $dataTableMap */
- $dataTableMap = $report['reportData'];
-
- // If the dataTable specifies a label_html, use this instead
- if ($dataTableMap instanceof DataTableInterface) {
- $labelPretty = $dataTableMap->getColumn('label_html');
- $labelPretty = array_filter($labelPretty, 'strlen');
- $labelPretty = current($labelPretty);
- if (!empty($labelPretty)) {
- return $labelPretty;
- }
- }
- return $rowLabel;
- }
-
- /**
- * @param string|int|float $value
- */
- private function getFractionDigits($value): int
- {
- $value = (string) $value;
- $fraction = substr(strrchr($value, ".") ?: '', 1);
- return strlen($fraction);
- }
-
- /**
- * @return string|null
- */
- protected function getRowEvolutionGraphFromController(\Piwik\Plugins\CoreHome\Controller $controller)
- {
- return $controller->getRowEvolutionGraph($fetch = true, $rowEvolution = $this);
- }
-}
diff --git a/plugins/CoreHome/EntityDuplicator/DuplicateRequestResponse.php b/plugins/CoreHome/EntityDuplicator/DuplicateRequestResponse.php
deleted file mode 100644
index 1b39c411e8314d53d19475a0298d03f9fd13672d..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/EntityDuplicator/DuplicateRequestResponse.php
+++ /dev/null
@@ -1,185 +0,0 @@
-initialState = $this->getCurrentState();
- }
-
- public function isSuccess(): bool
- {
- return $this->success ?? false;
- }
-
- public function setSuccess(bool $success): void
- {
- $this->success = $success;
- }
-
- public function getMessage(): string
- {
- return $this->message ?? '';
- }
-
- public function setMessage(string $message): void
- {
- $this->message = $message;
- }
-
- /**
- * @return array
- */
- public function getAdditionalData(): array
- {
- return $this->additionalData ?? [];
- }
-
- /**
- * @param array $additionalData
- */
- public function setAdditionalData(array $additionalData): void
- {
- $this->additionalData = $additionalData;
- }
-
- public function hasResponseBeenModified(): bool
- {
- return $this->initialState !== $this->getCurrentState();
- }
-
- /**
- * Checks which property values have changed from the initial state and only includes them in the JSON string.
- *
- * @return string JSON of the response object
- * @throws \Exception If none of the properties have been set
- */
- public function getJsonResponse(): string
- {
- return json_encode($this->getResponseArray());
- }
-
- /**
- * Checks which property values have changed from the initial state and only includes them in the array.
- *
- * @return array response object properties
- * @throws \Exception If none of the properties have been set
- */
- public function getResponseArray(): array
- {
- $responseArray = [];
- $currentState = $this->getCurrentState();
- foreach ($this->initialState as $propertyName => $value) {
- if ($currentState[$propertyName] !== $value) {
- $responseArray[$propertyName] = $currentState[$propertyName];
- }
- }
-
- if (count($responseArray) === 0) {
- throw new \Exception('No duplicate request response properties were set.');
- }
-
- // If the flag is set to post the event and the request was successful, post the event for the duplication
- if ($this->success && $this->eventDataToPost !== null) {
- Piwik::postEvent('EntityDuplicator.DuplicationSuccessful', $this->eventDataToPost);
- }
-
- return $responseArray;
- }
-
- /**
- * @return array
- */
- private function getCurrentState(): array
- {
- // Get an array of all the property values
- $state = get_object_vars($this);
- // Exclude the state property and eventDataToPost
- unset($state['initialState']);
- unset($state['eventDataToPost']);
-
- return $state;
- }
-
- /**
- * Set the arguments to be used while posting the event when the response array is built. This is used by plugins
- * which use this class while generating the response to a duplication request.
- *
- * @param string $entityTypeTranslation Translation key for the name of the type of entity. E.g. Goals_Goal,
- * Heatmaps_Heatmap, etc.
- * @param string $entityName The name of the entity being copied. E.g. 'Goal that does thing' or'Home page heatmap'.
- * @param int|null $idEntity The ID of the entity being copied. E.g. 2 or 900. It's optional since some entities
- * might only have a string identifier which should be provided as the entityName.
- * @param int|null $idSite ID of the source site. It's optional in case the entity being copied is not site scoped,
- * like a system-wide configuration.
- * @param array|null $idDestinationSites IDs of the destination sites. This is optional for the same reason as
- * idSite but also since it doesn't need to be provided if the only destination site is the source site (idSite).
- * @param array|null $additionalData Optional array of additional data relating to the entity being copied.
- */
- public function setRequestDataForEvent(
- string $entityTypeTranslation,
- string $entityName,
- ?int $idEntity = null,
- ?int $idSite = null,
- ?array $idDestinationSites = null,
- ?array $additionalData = null
- ): void {
- $this->eventDataToPost = [
- $entityTypeTranslation,
- $entityName,
- $idEntity,
- $idSite,
- $idDestinationSites,
- $additionalData,
- ];
- }
-}
diff --git a/plugins/CoreHome/EntityDuplicator/EntityDuplicatorHelper.php b/plugins/CoreHome/EntityDuplicator/EntityDuplicatorHelper.php
deleted file mode 100644
index 9e805a04a85c553184a5cfd6de11d399d85b52c4..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/EntityDuplicator/EntityDuplicatorHelper.php
+++ /dev/null
@@ -1,93 +0,0 @@
- $maxLength) {
- $modifiedName = substr($modifiedName, 0, ($maxLength - 3) - strlen((string) $number));
- }
-
- $modifiedName .= " ($number)";
-
- return $modifiedName;
- }
-
- /**
- * Takes a list of existing names and updates the provided name with a numerical suffix until it's unique. It also
- * truncates the name to make sure that it doesn't exceed the maximum length.
- *
- * @param string $name The name that needs to be updated with a number suffix. If no suffix exists, one will be
- * added. If one already exists, the number in the suffix will be incremented.
- * @param string[] $names List of existing names to compare against in order to provide a unique name.
- * @param int $maxLength Optional number indicates the maximum allowed length. If adding the suffix exceeds the max,
- * the string will be truncated just enough to allow the suffix. Default is -1 allowing infinite length.
- * @return string
- * @throws \Exception If the maximum length is too small".
- */
- public static function getUniqueNameComparedToList(string $name, array $names, int $maxLength = -1)
- {
- // Make sure that the name is at least one character long
- if ($maxLength !== -1 && $maxLength < 1) {
- throw new \Exception('The maximum name length cannot be less than 1 character.');
- }
-
- $newName = $name;
- // Make sure that the string is no more than the max length
- if ($maxLength !== -1 && strlen($newName) > $maxLength) {
- $newName = substr($newName, 0, $maxLength);
- }
-
- // Logically, the name should at most need to be adjusted once per listed name.
- for ($i = 0; $i < count($names); $i++) {
- if (!in_array($newName, $names)) {
- break;
- }
- $newName = self::incrementNameWithNumericalSuffix($newName, $maxLength);
- }
-
- return $newName;
- }
-}
diff --git a/plugins/CoreHome/FeatureFlags/ReportHeaderRedesign.php b/plugins/CoreHome/FeatureFlags/ReportHeaderRedesign.php
deleted file mode 100644
index b46cb1ea0b76edbefdd701d8788b1630329a5713..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/FeatureFlags/ReportHeaderRedesign.php
+++ /dev/null
@@ -1,22 +0,0 @@
-getGeneralConfig();
- return !empty($general['login_allowlist_apply_to_reporting_api_requests']) || !empty($general['login_whitelist_apply_to_reporting_api_requests']);
- }
-
- public function shouldCheckAllowlist()
- {
- if (Common::isPhpCliMode()) {
- return false;
- }
-
- // ignore whitelist checks for opt out iframe or opt out JS
- if (
- !SettingsServer::isTrackerApiRequest()
- && (('CoreAdminHome' === Piwik::getModule() && ('optOut' === Piwik::getAction() || 'optOutJS' === Piwik::getAction())))
- ) {
- return false;
- }
-
- $ips = $this->getAllowlistedLoginIps();
- return !empty($ips);
- }
-
- public function checkIsAllowed($ipString)
- {
- if (!$this->isIpAllowed($ipString)) {
- throw new NoAccessException(Piwik::translate('CoreHome_ExceptionNotAllowlistedIP', $ipString));
- }
- }
-
- public function isIpAllowed($userIpString)
- {
- $userIp = NetworkIp::fromStringIP($userIpString);
- $ipsAllowed = $this->getAllowlistedLoginIps();
-
- if (empty($ipsAllowed)) {
- return false;
- }
-
- return $userIp->isInRanges($ipsAllowed);
- }
-
- /**
- * @return array
- */
- protected function getAllowlistedLoginIps()
- {
- $ips = StaticContainer::get('login.allowlist.ips');
-
- if (!empty($ips) && is_array($ips)) {
- $ips = array_map(function ($ip) {
- return trim($ip);
- }, $ips);
- $ips = array_filter($ips, function ($ip) {
- return !empty($ip);
- });
- return array_unique(array_values($ips));
- }
-
- return array();
- }
-
- private function getGeneralConfig()
- {
- $config = Config::getInstance();
- $general = $config->General;
- return $general;
- }
-}
diff --git a/plugins/CoreHome/Menu.php b/plugins/CoreHome/Menu.php
deleted file mode 100644
index 73a8d4efad35b3d99d397c4579fd77bf9fedcd92..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Menu.php
+++ /dev/null
@@ -1,126 +0,0 @@
-configureReportingGroupMenuItems($menu);
-
- $module = $this->getLoginModule();
- if (Piwik::isUserIsAnonymous()) {
- $menu->registerMenuIcon('Login_LogIn', 'icon-sign-in');
- $menu->addItem('Login_LogIn', null, array('module' => $module, 'action' => false), 1000, Piwik::translate('Login_LogIn'));
- } else {
- $menu->registerMenuIcon('General_Logout', 'icon-sign-out');
- $menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 1000, Piwik::translate('General_Logout'));
- }
- }
-
- /**
- * Adds a top menu entry for each non-default reporting menu group (e.g. "AI Insights"). Each entry
- * leads into the regular reporting single-page-app, which filters the reporting menu to the active
- * group. This keeps every reporting section within the same SPA (no full page reloads when navigating
- * within a section) and lets categories opt into sections via Category::setGroups() instead of any
- * plugin scraping another plugin's reports.
- *
- * The reporting SPA reads the section from the hash, filters the menu to it and selects its first
- * page. The `data-reporting-group` attribute lets the active top-menu highlight be kept in sync
- * client-side (the server cannot read the hash).
- */
- private function configureReportingGroupMenuItems(MenuTop $menu): void
- {
- $idSite = $this->getMenuIdSite();
- if (null === $idSite) {
- return;
- }
-
- foreach ($this->getReportingMenuGroups() as $group => $order) {
- $params = $this->urlForModuleActionWithDefaultUserParams('CoreHome', 'index', ['idSite' => $idSite]);
- if (empty($params)) {
- continue;
- }
-
- $url = $this->urlForReportingSection($params, $group);
-
- $menu->addItem($group, null, $url, $order, false, false, false, 'data-reporting-group="' . $group . '"');
- }
- }
-
- /**
- * Resolves the site id to use for the reporting group menu entries. Mirrors the Analytics top-menu
- * entry: the entry stays visible (linking to the user's default site) even on pages without an idSite
- * in the URL, such as the All Websites page or admin pages.
- */
- private function getMenuIdSite(): ?int
- {
- $userPreferences = new UserPreferences();
- $idSite = (int) $userPreferences->getDefaultWebsiteId();
- $idSite = Request::fromRequest()->getIntegerParameter('idSite', $idSite);
-
- if (!$idSite || !Piwik::isUserHasViewAccess($idSite)) {
- return null;
- }
-
- return $idSite;
- }
-
- /**
- * Returns the reporting menu groups (excluding the default Analytics group) that have at least one
- * category with reporting pages, mapped to the order of the resulting top-menu entry. Sections are
- * ordered by their lowest category order and placed right after the Analytics entry.
- *
- * @return array map of group id => top-menu order
- */
- private function getReportingMenuGroups(): array
- {
- $categoryOrderByGroup = [];
-
- foreach (CategoryList::get()->getCategories() as $category) {
- if (!$category->hasSubCategories()) {
- continue;
- }
-
- foreach ($category->getGroups() as $group) {
- if (Category::DEFAULT_GROUP === $group) {
- continue;
- }
-
- $order = (int) $category->getOrder();
- if (!isset($categoryOrderByGroup[$group]) || $order < $categoryOrderByGroup[$group]) {
- $categoryOrderByGroup[$group] = $order;
- }
- }
- }
-
- asort($categoryOrderByGroup);
-
- $groups = [];
- $order = 2; // right after the Analytics entry (order 1)
- foreach (array_keys($categoryOrderByGroup) as $group) {
- $groups[$group] = $order++;
- }
-
- return $groups;
- }
-
- private function getLoginModule()
- {
- return Piwik::getLoginPluginName();
- }
-}
diff --git a/plugins/CoreHome/Segment.php b/plugins/CoreHome/Segment.php
deleted file mode 100644
index 02aa7aa758bbd8ba4fdaec64049af4c9121a23cb..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Segment.php
+++ /dev/null
@@ -1,21 +0,0 @@
-setCategory('General_Visit');
- }
-}
diff --git a/plugins/CoreHome/SystemSummary/Item.php b/plugins/CoreHome/SystemSummary/Item.php
deleted file mode 100644
index 34cfcdbcb354e28c1ba46106856cd91406569719..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/SystemSummary/Item.php
+++ /dev/null
@@ -1,94 +0,0 @@
-key = $key;
- $this->label = $label;
- $this->value = $value;
- $this->urlParams = $urlParams;
- $this->icon = $icon;
- $this->order = $order;
- }
-
- /**
- * @return string
- */
- public function getKey()
- {
- return $this->key;
- }
-
- /**
- * @return string
- */
- public function getLabel()
- {
- return $this->label;
- }
-
- /**
- * @return mixed
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * @return array|null
- */
- public function getUrlParams()
- {
- return $this->urlParams;
- }
-
- /**
- * @return string
- */
- public function getIcon()
- {
- return $this->icon;
- }
-
- /**
- * @return int
- */
- public function getOrder()
- {
- return $this->order;
- }
-}
diff --git a/plugins/CoreHome/Tracker/LogTable/Action.php b/plugins/CoreHome/Tracker/LogTable/Action.php
deleted file mode 100644
index 5571be61487d78795b78b52fece132481a0ac76b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Tracker/LogTable/Action.php
+++ /dev/null
@@ -1,40 +0,0 @@
-eventDispatcher = $eventDispatcher;
- $this->visitorRecognizer = $visitorRecognizer;
- $this->userSettings = $userSettings;
- $this->visitStandardLength = $visitStandardLength;
- $this->trackerAlwaysNewVisitor = $trackerAlwaysNewVisitor;
- }
-
- public function processRequestParams(VisitProperties $visitProperties, Request $request)
- {
- // the IP is needed by isExcluded() and GoalManager->recordGoals()
- $visitProperties->setProperty('location_ip', $request->getIp());
-
- $excluded = new VisitExcluded($request);
- $isExcluded = $excluded->isExcluded();
- $request->setMetadata('CoreHome', 'isVisitExcluded', $isExcluded);
-
- if ($isExcluded) {
- return true;
- }
-
- $privacyConfig = new PrivacyManagerConfig($request->getIdSiteIfExists());
-
- if ($privacyConfig->randomizeConfigId) {
- // always new visit when randomising config id
- $request->setMetadata('CoreHome', 'visitorId', $this->userSettings->getRandomConfigId());
- $request->setMetadata('CoreHome', 'isVisitorKnown', false);
- $request->setMetadata('CoreHome', 'isNewVisit', true);
- $request->setMetadata('CoreHome', 'lastKnownVisit', false);
-
- return false;
- }
-
- $ip = $request->getIpString();
- if ($privacyConfig->useAnonymizedIpForVisitEnrichment) {
- $ip = $visitProperties->getProperty('location_ip');
- }
-
- // visitor recognition
- $visitorId = $this->userSettings->getConfigId($request, $ip);
- $request->setMetadata('CoreHome', 'visitorId', $visitorId);
-
- $isKnown = $this->visitorRecognizer->findKnownVisitor($visitorId, $visitProperties, $request);
- $request->setMetadata('CoreHome', 'isVisitorKnown', $isKnown);
-
- $isNewVisit = $this->isVisitNew($visitProperties, $request, $this->visitorRecognizer->getLastKnownVisit());
- $request->setMetadata('CoreHome', 'isNewVisit', $isNewVisit);
-
- $request->setMetadata('CoreHome', 'lastKnownVisit', $this->visitorRecognizer->getLastKnownVisit());
-
- if (!$isNewVisit) { // only copy over known visitor's information, if this is for an ongoing visit
- $this->visitorRecognizer->updateVisitPropertiesFromLastVisitRow($visitProperties);
- }
-
- return false;
- }
-
- public function afterRequestProcessed(VisitProperties $visitProperties, Request $request)
- {
- $ip = $visitProperties->getProperty('location_ip');
-
- /**
- * Triggered after visits are tested for exclusion so plugins can modify the IP address
- * persisted with a visit.
- *
- * This event is primarily used by the **PrivacyManager** plugin to anonymize IP addresses.
- *
- * @param string &$ip The visitor's IP address.
- * @param int $idSite The site ID we're tracking the visit for.
- */
- $this->eventDispatcher->postEvent('Tracker.setVisitorIp', [&$ip, (int) $request->getIdSiteIfExists()]);
-
- $visitProperties->setProperty('location_ip', $ip);
-
- return false;
- }
-
- /**
- * Determines if the current action should be treated as the start of a new visit or
- * an action in an existing visit.
- *
- * Note: public only for tests.
- *
- * @param VisitProperties $visitProperties The current visit/visitor information.
- * @return bool
- */
- public function isVisitNew(VisitProperties $visitProperties, Request $request, $lastKnownVisit)
- {
- $isKnown = $request->getMetadata('CoreHome', 'isVisitorKnown');
- if (!$isKnown) {
- return true;
- }
-
- $isNewVisitForced = $request->getParam('new_visit');
- $isNewVisitForced = !empty($isNewVisitForced);
- if ($isNewVisitForced) {
- Common::printDebug("-> New visit forced: &new_visit=1 in request");
- return true;
- }
-
- if ($this->trackerAlwaysNewVisitor) {
- Common::printDebug("-> New visit forced: Debug.tracker_always_new_visitor = 1 in config.ini.php");
- return true;
- }
-
- $isLastActionInTheSameVisit = $this->isLastActionInTheSameVisit($visitProperties, $request, $lastKnownVisit);
- if (!$isLastActionInTheSameVisit) {
- Common::printDebug("Visitor detected, but last action was more than 30 minutes ago...");
-
- return true;
- }
-
- $wasLastActionYesterday = $this->wasLastActionNotToday($visitProperties, $request, $lastKnownVisit);
- $forceNewVisitAtMidnight = TrackerConfig::getBoolConfigValue('create_new_visit_after_midnight', false, $request->getIdSiteIfExists());
-
- if ($wasLastActionYesterday && $forceNewVisitAtMidnight) {
- Common::printDebug("Visitor detected, but last action was yesterday...");
-
- return true;
- }
-
- if (!$this->lastUserIdWasSetAndDoesMatch($visitProperties, $request)) {
- Common::printDebug("Visitor detected, but last user_id does not match...");
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns true if the last action was done within the standard visit length.
- * @return bool
- */
- protected function isLastActionInTheSameVisit(VisitProperties $visitProperties, Request $request, $lastKnownVisit)
- {
- $lastActionTime = $this->getLastKnownActionTime($visitProperties, $lastKnownVisit);
-
- return isset($lastActionTime)
- && false !== $lastActionTime
- && ($lastActionTime > ($request->getCurrentTimestamp() - $this->visitStandardLength));
- }
-
- /**
- * Returns true if the last action was not today.
- * @return bool
- */
- private function wasLastActionNotToday(VisitProperties $visitProperties, Request $request, $lastKnownVisit)
- {
- $lastActionTime = $this->getLastKnownActionTime($visitProperties, $lastKnownVisit);
-
- if (empty($lastActionTime)) {
- return false;
- }
-
- $idSite = $request->getIdSite();
- $timezone = $this->getTimezoneForSite($idSite);
-
- if (empty($timezone)) {
- throw new UnexpectedWebsiteFoundException('An unexpected website was found, check idSite in the request');
- }
-
- $date = Date::factory((int)$lastActionTime, $timezone);
- $now = $request->getCurrentTimestamp();
- $now = Date::factory((int)$now, $timezone);
-
- return $date->toString() !== $now->toString();
- }
-
- private function getTimezoneForSite($idSite) // TODO: duplicate function in Visit
- {
- try {
- $site = Cache::getCacheWebsiteAttributes($idSite);
- } catch (UnexpectedWebsiteFoundException $e) {
- return null;
- }
-
- if (!empty($site['timezone'])) {
- return $site['timezone'];
- }
-
- return null;
- }
-
- /**
- * Returns the last action time for the last recorded visit of this visitor, or if the visitor is new,
- * the current request's timestamp.
- *
- * @param $lastKnownVisit
- * @return false|int|mixed
- */
- private function getLastKnownActionTime(VisitProperties $visitProperties, $lastKnownVisit)
- {
- if (isset($lastKnownVisit['visit_last_action_time'])) {
- return strtotime($lastKnownVisit['visit_last_action_time']);
- }
-
- return $visitProperties->getProperty('visit_last_action_time');
- }
-
- /**
- * Returns true if the last user_id did not change.
- * @return bool
- */
- protected function lastUserIdWasSetAndDoesMatch(VisitProperties $visitProperties, Request $request)
- {
- $lastUserId = $visitProperties->getProperty('user_id');
-
- if (empty($lastUserId)) {
- return true;
- }
-
- $currentUserId = $request->getForcedUserId();
-
- if (empty($currentUserId)) {
- return true;
- }
-
- return $lastUserId === $currentUserId;
- }
-}
diff --git a/plugins/CoreHome/VisitorDetails.php b/plugins/CoreHome/VisitorDetails.php
deleted file mode 100644
index 03a4c9524bf7ec0e162992682b86264b02a13081..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/VisitorDetails.php
+++ /dev/null
@@ -1,134 +0,0 @@
-getUserId();
- $visitor['visitorType'] = $this->getVisitorReturning();
- $visitor['visitorTypeIcon'] = $this->getVisitorReturningIcon();
- $visitor['visitConverted'] = $this->isVisitorGoalConverted();
- $visitor['visitConvertedIcon'] = $this->getVisitorGoalConvertedIcon();
- $visitor['visitCount'] = $this->getVisitCount();
- $visitor['visitEcommerceStatus'] = $this->getVisitEcommerceStatus();
- $visitor['visitEcommerceStatusIcon'] = $this->getVisitEcommerceStatusIcon();
- $visitor['daysSinceFirstVisit'] = $this->getDaysSinceFirstVisit();
- $visitor['secondsSinceFirstVisit'] = $this->getSecondsSinceFirstVisit();
- $visitor['daysSinceLastEcommerceOrder'] = $this->getDaysSinceLastEcommerceOrder();
- $visitor['secondsSinceLastEcommerceOrder'] = $this->getSecondsSinceLastEcommerceOrder();
- $visitor['visitDuration'] = $this->getVisitLength();
- $visitor['visitDurationPretty'] = $this->getVisitLengthPretty();
- }
-
- protected function getVisitEcommerceStatusIcon()
- {
- $status = $this->getVisitEcommerceStatus();
-
- if (in_array($status, array('ordered', 'orderedThenAbandonedCart'))) {
- return "plugins/Morpheus/images/ecommerceOrder.svg";
- } elseif ($status == 'abandonedCart') {
- return "plugins/Morpheus/images/ecommerceAbandonedCart.svg";
- }
- // Note: it is important that there is no icon when there was no ecommerce conversion
- return null;
- }
-
- protected function getVisitEcommerceStatus()
- {
- return VisitGoalBuyer::getVisitEcommerceStatusFromId($this->details['visit_goal_buyer']);
- }
-
- protected function isVisitorGoalConverted()
- {
- return $this->details['visit_goal_converted'];
- }
-
- protected function getVisitorGoalConvertedIcon()
- {
- return $this->isVisitorGoalConverted()
- ? "plugins/Morpheus/images/goal.svg"
- : null;
- }
-
- protected function getDaysSinceFirstVisit()
- {
- return floor($this->details['visitor_seconds_since_first'] / 86400);
- }
-
- protected function getSecondsSinceFirstVisit()
- {
- return $this->details['visitor_seconds_since_first'];
- }
-
- protected function getDaysSinceLastEcommerceOrder()
- {
- return floor($this->details['visitor_seconds_since_order'] / 86400);
- }
-
- protected function getSecondsSinceLastEcommerceOrder()
- {
- return $this->details['visitor_seconds_since_order'];
- }
-
- protected function getVisitorReturning()
- {
- $type = $this->details['visitor_returning'];
- return $type == 2
- ? 'returningCustomer'
- : ($type == 1
- ? 'returning'
- : 'new');
- }
-
- protected function getVisitorReturningIcon()
- {
- $type = $this->getVisitorReturning();
- if (
- $type == 'returning'
- || $type == 'returningCustomer'
- ) {
- return "plugins/Live/images/returningVisitor.png";
- }
- return null;
- }
-
- protected function getVisitCount()
- {
- return $this->details['visitor_count_visits'];
- }
-
- protected function getVisitLength()
- {
- return $this->details['visit_total_time'];
- }
-
- protected function getVisitLengthPretty()
- {
- $formatter = new Formatter();
- return $formatter->getPrettyTimeFromSeconds($this->details['visit_total_time'], true);
- }
-
- protected function getUserId()
- {
- if (
- isset($this->details['user_id'])
- && strlen($this->details['user_id']) > 0
- ) {
- return $this->details['user_id'];
- }
- return null;
- }
-}
diff --git a/plugins/CoreHome/Widgets/GetDonateForm.php b/plugins/CoreHome/Widgets/GetDonateForm.php
deleted file mode 100644
index bf0f0be1e5cc7a002d1107a2adc77b02b0aee54c..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Widgets/GetDonateForm.php
+++ /dev/null
@@ -1,51 +0,0 @@
-translator = $translator;
- }
-
- public static function configure(WidgetConfig $config)
- {
- $config->setCategoryId('About Matomo');
- $config->setName('CoreHome_SupportPiwik');
- $config->setOrder(5);
- }
-
- public function render()
- {
- $footerMessage = null;
- if (
- Common::getRequestVar('widget', false)
- && Piwik::hasUserSuperUserAccess()
- ) {
- $footerMessage = $this->translator->translate('CoreHome_OnlyForSuperUserAccess');
- }
-
- return $this->renderTemplate('getDonateForm', array(
- 'footerMessage' => $footerMessage,
- ));
- }
-}
diff --git a/plugins/CoreHome/Widgets/GetPromoVideo.php b/plugins/CoreHome/Widgets/GetPromoVideo.php
deleted file mode 100644
index 0054ec70b0e913aa2ab49dff79ec098ff2e88b49..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Widgets/GetPromoVideo.php
+++ /dev/null
@@ -1,46 +0,0 @@
-translator = $translator;
- }
-
- public static function configure(WidgetConfig $config)
- {
- $config->setCategoryId('About Matomo');
- $config->setName('Installation_Welcome');
- $config->setOrder(10);
- }
-
- public function render()
- {
- $view = new View('@CoreHome/getPromoVideo');
- $view->shareText = $this->translator->translate('CoreHome_SharePiwikShort');
- $view->shareTextLong = $this->translator->translate('CoreHome_SharePiwikLong');
- $view->promoVideoUrl = Url::addCampaignParametersToMatomoLink('https://matomo.org/docs/videos/');
-
- return $view->render();
- }
-}
diff --git a/plugins/CoreHome/Widgets/GetSystemSummary.php b/plugins/CoreHome/Widgets/GetSystemSummary.php
deleted file mode 100644
index a8b0e68b94a8e7712a8bb428bf03fe4d37d279eb..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Widgets/GetSystemSummary.php
+++ /dev/null
@@ -1,130 +0,0 @@
-storedSegmentService = $storedSegmentService;
- $this->pluginManager = $pluginManager;
- }
-
- public static function configure(WidgetConfig $config)
- {
- $config->setCategoryId('About Matomo');
- $config->setName('CoreHome_SystemSummaryWidget');
- $config->setOrder(15);
- $config->setIsEnabled(Piwik::hasUserSuperUserAccess());
- }
-
- public function render()
- {
- $mysqlVersion = $this->getMySqlVersion();
- $phpVersion = $this->getPHPVersion();
-
- $systemSummary = array();
-
- /**
- * Triggered to add system summary items that are shown in the System Summary widget.
- *
- * **Example**
- *
- * public function addSystemSummaryItem(&$systemSummary)
- * {
- * $numUsers = 5;
- * $systemSummary[] = new SystemSummary\Item($key = 'users', Piwik::translate('General_NUsers', $numUsers), $value = null, array('module' => 'UsersManager', 'action' => 'index'), $icon = 'icon-user');
- * }
- *
- * @param Item[] &$systemSummary An array containing system summary items.
- */
- Piwik::postEvent('System.addSystemSummaryItems', array(&$systemSummary));
-
- $systemSummary[] = new Item($key = 'piwik-version', Piwik::translate('CoreHome_SystemSummaryPiwikVersion'), Version::VERSION, $url = null, $icon = '', $order = 21);
- $systemSummary[] = new Item($key = 'mysql-version', Piwik::translate('CoreHome_SystemSummaryMysqlVersion'), $mysqlVersion, $url = null, $icon = '', $order = 22);
- $systemSummary[] = new Item($key = 'php-version', Piwik::translate('CoreHome_SystemSummaryPhpVersion'), $phpVersion, $url = null, $icon = '', $order = 23);
-
- $systemSummary = array_filter($systemSummary);
- usort($systemSummary, function ($itemA, $itemB) {
- if ($itemA->getOrder() == $itemB->getOrder()) {
- return 0;
- }
- if ($itemA->getOrder() > $itemB->getOrder()) {
- return 1;
- }
- return -1;
- });
-
- /**
- * Triggered to filter system summary items that are shown in the System Summary widget. A plugin might also
- * sort the system summary items differently.
- *
- * **Example**
- *
- * public function filterSystemSummaryItems(&$systemSummary)
- * {
- * foreach ($systemSummaryItems as $index => $item) {
- * if ($item && $item->getKey() === 'users') {
- * $systemSummaryItems[$index] = null;
- * }
- * }
- * }
- *
- * @param Item[] &$systemSummary An array containing system summary items.
- */
- Piwik::postEvent('System.filterSystemSummaryItems', array(&$systemSummary));
-
- $systemSummary = array_filter($systemSummary);
-
- return $this->renderTemplate('getSystemSummary', array(
- 'items' => $systemSummary,
- ));
- }
-
- private function getMySqlVersion()
- {
- if (defined('PIWIK_TEST_MODE')) {
- return self::TEST_MYSQL_VERSION;
- }
-
- $db = Db::get();
- return $db->getServerVersion();
- }
-
- private function getPHPVersion()
- {
- if (defined('PIWIK_TEST_MODE')) {
- return self::TEST_PHP_VERSION;
- }
-
- return phpversion();
- }
-}
diff --git a/plugins/CoreHome/Widgets/QuickLinks.php b/plugins/CoreHome/Widgets/QuickLinks.php
deleted file mode 100644
index 7f49a34a7e4885e92145ce725565ce51a15e54cf..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/Widgets/QuickLinks.php
+++ /dev/null
@@ -1,31 +0,0 @@
-setCategoryId('About Matomo');
- $config->setName('CoreHome_QuickLinks');
- $config->setOrder(16);
- $config->setIsEnabled(Piwik::hasUserSuperUserAccess());
- }
-
- public function render()
- {
- $hasUsersAdmin = UsersManager::isUsersAdminEnabled();
- $hasSitesAdmin = SitesManager::isSitesAdminEnabled();
-
- return $this->renderTemplate('quickLinks', array(
- 'hasUsersAdmin' => $hasUsersAdmin,
- 'hasSitesAdmin' => $hasSitesAdmin,
- ));
- }
-}
diff --git a/plugins/CoreHome/config/config.php b/plugins/CoreHome/config/config.php
deleted file mode 100644
index 432c4eadd42c5720afcfb7814c18a463b7ecab80..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/config/config.php
+++ /dev/null
@@ -1,9 +0,0 @@
- Piwik\DI::autowire()
- ->constructorParameter('visitStandardLength', Piwik\DI::get('ini.Tracker.visit_standard_length'))
- ->constructorParameter('trackerAlwaysNewVisitor', Piwik\DI::get('ini.Debug.tracker_always_new_visitor')),
-
-);
diff --git a/plugins/CoreHome/config/test.php b/plugins/CoreHome/config/test.php
deleted file mode 100644
index d799ac36653e0c46f2475ce402eb60accf23e8b6..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/config/test.php
+++ /dev/null
@@ -1,38 +0,0 @@
- Piwik\DI::add([
- [
- 'Request.dispatch',
- Piwik\DI::value(
- function () {
- if (!empty($_GET['setNotifications']) && $_GET['setNotifications'] == 1) {
- // trigger some notification
- $notification = new Notification('This is a persistent test notification');
- $notification->title = 'Warning:';
- $notification->context = Notification::CONTEXT_WARNING;
- $notification->type = Notification::TYPE_PERSISTENT;
- $notification->flags = Notification::FLAG_CLEAR;
- Notification\Manager::notify('NotificationFixture_persistent_warning', $notification);
-
- $notification = new Notification('This is another persistent test notification');
- $notification->title = 'Error:';
- $notification->context = Notification::CONTEXT_ERROR;
- $notification->type = Notification::TYPE_PERSISTENT;
- $notification->flags = Notification::FLAG_CLEAR;
- Notification\Manager::notify('NotificationFixture_persistent_error', $notification);
-
- $notification = new Notification('This is transient test notification');
- $notification->title = 'Error:';
- $notification->context = Notification::CONTEXT_ERROR;
- $notification->type = Notification::TYPE_TRANSIENT;
- $notification->flags = Notification::FLAG_CLEAR;
- Notification\Manager::notify('NotificationFixture_transient_error', $notification);
- }
- }
- ),
- ],
- ]),
-];
diff --git a/plugins/CoreHome/config/tracker.php b/plugins/CoreHome/config/tracker.php
deleted file mode 100644
index d5be5de26f92a935f318ed4c0a04fe01434bfe66..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/config/tracker.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/plugins/CoreHome/images/applogo_128.png b/plugins/CoreHome/images/applogo_128.png
deleted file mode 100644
index 3292a95602b5fffce82b369a5e90cc6922e7969b..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_128.png and /dev/null differ
diff --git a/plugins/CoreHome/images/applogo_144.png b/plugins/CoreHome/images/applogo_144.png
deleted file mode 100644
index ced97022498ea962ce1e83e985c2257b45148240..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_144.png and /dev/null differ
diff --git a/plugins/CoreHome/images/applogo_192.png b/plugins/CoreHome/images/applogo_192.png
deleted file mode 100644
index 5002de513ba80f7d251081fc55d94edcd7d807c9..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_192.png and /dev/null differ
diff --git a/plugins/CoreHome/images/applogo_256.png b/plugins/CoreHome/images/applogo_256.png
deleted file mode 100644
index 3592d7feb271c9628023a83207b637a844fecb43..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_256.png and /dev/null differ
diff --git a/plugins/CoreHome/images/applogo_32.png b/plugins/CoreHome/images/applogo_32.png
deleted file mode 100644
index f9f29f49193636e43cf1b18ed2df70b4102d30b9..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_32.png and /dev/null differ
diff --git a/plugins/CoreHome/images/applogo_72.png b/plugins/CoreHome/images/applogo_72.png
deleted file mode 100644
index 95190d3935a8336a03a1c0d64ef94294b1b82a2d..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_72.png and /dev/null differ
diff --git a/plugins/CoreHome/images/applogo_732.png b/plugins/CoreHome/images/applogo_732.png
deleted file mode 100644
index 40447fdae13dbde4e9d5897644bf65d427ed6e09..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/applogo_732.png and /dev/null differ
diff --git a/plugins/CoreHome/images/bg_header.png b/plugins/CoreHome/images/bg_header.png
deleted file mode 100644
index f0fc545f9f2f66cd2a8aa59830a4a9c8c29a2270..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/bg_header.png and /dev/null differ
diff --git a/plugins/CoreHome/images/bullet1.png b/plugins/CoreHome/images/bullet1.png
deleted file mode 100644
index 6a4bc2a467ea4d156c242ca68f69324f7c4ad2bd..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/bullet1.png and /dev/null differ
diff --git a/plugins/CoreHome/images/bullet2.png b/plugins/CoreHome/images/bullet2.png
deleted file mode 100644
index 2e00eda5ec845ccbab38ecf250cc4d7c7b13b5cb..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/bullet2.png and /dev/null differ
diff --git a/plugins/CoreHome/images/favicon.ico b/plugins/CoreHome/images/favicon.ico
deleted file mode 100644
index 6944bc33a6ebfe027363704718d04ff718a80181..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/favicon.ico and /dev/null differ
diff --git a/plugins/CoreHome/images/favicon.png b/plugins/CoreHome/images/favicon.png
deleted file mode 100644
index d5f4828bc823b912d6679032245a3ed632994d7f..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/favicon.png and /dev/null differ
diff --git a/plugins/CoreHome/images/more.png b/plugins/CoreHome/images/more.png
deleted file mode 100644
index cba03a05f5c372f4c8eb247d718f7060957ee648..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/more.png and /dev/null differ
diff --git a/plugins/CoreHome/images/more_date.png b/plugins/CoreHome/images/more_date.png
deleted file mode 100644
index 17983a7e4a22cdbe80e7c7b1cfd51a5fe3f0464f..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/more_date.png and /dev/null differ
diff --git a/plugins/CoreHome/images/more_period.png b/plugins/CoreHome/images/more_period.png
deleted file mode 100644
index 92b10dd7824e553b218cee1c4693c9edc8c65938..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/more_period.png and /dev/null differ
diff --git a/plugins/CoreHome/images/navigation_collapse.png b/plugins/CoreHome/images/navigation_collapse.png
deleted file mode 100644
index cbbab2b464610be6891d5eeb460df77722cf3206..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/navigation_collapse.png and /dev/null differ
diff --git a/plugins/CoreHome/images/navigation_expand.png b/plugins/CoreHome/images/navigation_expand.png
deleted file mode 100644
index 7d8dad34b0a1389d743c7aeca976c806f72226e7..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/navigation_expand.png and /dev/null differ
diff --git a/plugins/CoreHome/images/promo_video_splash.jpg b/plugins/CoreHome/images/promo_video_splash.jpg
deleted file mode 100644
index a2bf76a0c0310738dad55f0f1f794e542a6cb82c..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/promo_video_splash.jpg and /dev/null differ
diff --git a/plugins/CoreHome/images/reset_search.png b/plugins/CoreHome/images/reset_search.png
deleted file mode 100644
index cb1d9e80a2a21f8a15a416a405e5746afeb803fd..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/reset_search.png and /dev/null differ
diff --git a/plugins/CoreHome/images/search.png b/plugins/CoreHome/images/search.png
deleted file mode 100644
index 6d1f037c69979be5721874cf0e0a9f35bd827ab8..0000000000000000000000000000000000000000
Binary files a/plugins/CoreHome/images/search.png and /dev/null differ
diff --git a/plugins/CoreHome/javascripts/broadcast.js b/plugins/CoreHome/javascripts/broadcast.js
deleted file mode 100644
index 764cbb3df419830c3a871ee9de7e2fc4ab918e89..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/javascripts/broadcast.js
+++ /dev/null
@@ -1,662 +0,0 @@
-/*!
- * Matomo - free/libre analytics platform
- *
- * @link https://matomo.org
- * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-/**
- * broadcast object is to help maintain a hash for link clicks and ajax calls
- * so we can have back button and refresh button working.
- *
- * @type {object}
- */
-var broadcast = {
-
- /**
- * Last known hash url without popover parameter
- */
- currentHashUrl: false,
-
- /**
- * Last known popover parameter
- */
- currentPopoverParameter: false,
-
- /**
- * Callbacks for popover parameter change
- */
- popoverHandlers: [],
-
- /**
- * Holds the stack of popovers opened in sequence. When closing a popover, the last popover in the stack
- * is opened (if any).
- */
- popoverParamStack: [],
-
- /**
- * Force reload once
- */
- forceReload: false,
-
- /**
- * Suppress content update on hash changing
- */
- updateHashOnly: false,
-
- isWidgetizedDashboard: function() {
- return broadcast.getValueFromUrl('module') == 'Widgetize' && broadcast.getValueFromUrl('moduleToWidgetize') == 'Dashboard';
- },
-
- isWidgetizeRequestWithoutSession: function() {
- // whenever a token_auth is set in the URL, we assume a widget or page is tried to be shown widgetized.
- return broadcast.getValueFromUrl('token_auth') != '' && broadcast.getValueFromUrl('force_api_session') != '1';
- },
-
- /**
- * Returns if the current page is the login page
- * @return {boolean}
- */
- isLoginPage: function() {
- return !!$('body#loginPage').length;
- },
-
- /**
- * Returns if the current page is the no data page
- * @return {boolean}
- */
- isNoDataPage: function() {
- return !!$('body#site-without-data').length;
- },
-
- /**
- * Returns the current hash with updated parameters that were provided in ajaxUrl
- *
- * Parameters like idGoal and idDashboard will be automatically reset if the won't be relevant anymore
- *
- * NOTE: this method does not issue any ajax call, but returns the hash instead
- *
- * @param {string} ajaxUrl querystring with parameters to be updated
- * @return {string} current hash with updated parameters
- */
- buildReportingUrl: function (ajaxUrl) {
-
- // available in global scope
- var currentHashStr = broadcast.getHash();
-
- ajaxUrl = ajaxUrl.replace(/^\?|/, '');
-
- var params_vals = ajaxUrl.split("&");
- for (var i = 0; i < params_vals.length; i++) {
- currentHashStr = broadcast.updateParamValue(params_vals[i], currentHashStr);
- }
-
- // if the module is not 'Goals', we specifically unset the 'idGoal' parameter
- // this is to ensure that the URLs are clean (and that clicks on graphs work as expected - they are broken with the extra parameter)
- var action = broadcast.getParamValue('action', currentHashStr);
- if (action != 'goalReport' && action != 'ecommerceReport' && action != 'products' && action != 'sales') {
- currentHashStr = broadcast.updateParamValue('idGoal=', currentHashStr);
- }
- // unset idDashboard if use doesn't display a dashboard
- var module = broadcast.getParamValue('module', currentHashStr);
- if (module != 'Dashboard') {
- currentHashStr = broadcast.updateParamValue('idDashboard=', currentHashStr);
- }
-
- return '#' + currentHashStr;
- },
-
- /**
- * propagateNewPage() -- update url value and load new page,
- * Example:
- * 1) We want to update idSite to both search query and hash then reload the page,
- * 2) update period to both search query and hash then reload page.
- *
- * Expecting:
- * str = "param1=newVal1¶m2=newVal2";
- *
- * NOTE: This method will refresh the page with new values.
- *
- * @param {string} str url with parameters to be updated
- * @param {boolean} [showAjaxLoading] whether to show the ajax loading gif or not.
- * @param {string} strHash additional parameters that should be updated on the hash
- * @param {array} paramsToRemove Optional parameters to remove from the URL.
- * @return {void}
- */
- propagateNewPage: function (str, showAjaxLoading, strHash, paramsToRemove, wholeNewUrl) {
- // abort all existing ajax requests
- globalAjaxQueue.abort();
-
- paramsToRemove = paramsToRemove || [];
-
- if (typeof showAjaxLoading === 'undefined' || showAjaxLoading) {
- piwikHelper.showAjaxLoading();
- }
-
- var params_vals = str.split("&");
-
- // available in global scope
- var currentSearchStr = window.location.search;
- var currentHashStr = broadcast.getHashFromUrl();
-
- if (!currentSearchStr) {
- currentSearchStr = '?';
- }
-
- var oldUrl = currentSearchStr + currentHashStr;
- var newUrl;
-
- if (!wholeNewUrl) {
- // remove all array query params that are currently set. if we don't do this the array parameters we add
- // just get added to the existing parameters.
- params_vals.forEach(function (param) {
- if (/\[]=/.test(decodeURIComponent(param))) {
- var paramName = decodeURIComponent(param).split('[]=')[0];
- removeParam(paramName);
- }
- });
-
- // remove parameters if needed
- paramsToRemove.forEach(function (paramName) {
- removeParam(paramName);
- });
-
- // update/add parameters based on whether the parameter is an array param or not
- params_vals.forEach(function (param) {
- if (!param.length) {
- return; // updating with empty string would destroy some values
- }
-
- if (/\[]=/.test(decodeURIComponent(param))) { // array param value
- currentSearchStr = broadcast.addArrayParamValue(param, currentSearchStr);
-
- if (currentHashStr.length !== 0) {
- currentHashStr = broadcast.addArrayParamValue(param, currentHashStr);
- }
- } else {
- // update both the current search query and hash string
- currentSearchStr = broadcast.updateParamValue(param, currentSearchStr);
-
- if (currentHashStr.length !== 0) {
- currentHashStr = broadcast.updateParamValue(param, currentHashStr);
- }
- }
- });
-
- var updatedUrl = new RegExp('&updated=([0-9]+)');
- var updatedCounter = updatedUrl.exec(currentSearchStr);
- if (!updatedCounter) {
- currentSearchStr += '&updated=1';
- } else {
- updatedCounter = 1 + parseInt(updatedCounter[1]);
- currentSearchStr = currentSearchStr.replace(new RegExp('(&updated=[0-9]+)'), '&updated=' + updatedCounter);
- }
-
- if (strHash && currentHashStr.length != 0) {
- var params_hash_vals = strHash.split("&");
- for (var i = 0; i < params_hash_vals.length; i++) {
- currentHashStr = broadcast.updateParamValue(params_hash_vals[i], currentHashStr);
- }
- }
-
- // Now load the new page.
- newUrl = currentSearchStr + currentHashStr;
- } else {
- newUrl = wholeNewUrl;
- }
-
- if (oldUrl == newUrl) {
- window.location.reload();
- } else {
- this.forceReload = true;
- window.location.href = newUrl;
- }
- return false;
-
- function removeParam(paramName) {
- var paramRegex = new RegExp(paramName + '(\\[]|%5B%5D)?=[^&?#]*&?', 'gi');
- currentSearchStr = currentSearchStr.replace(paramRegex, '');
- currentHashStr = currentHashStr.replace(paramRegex, '');
- }
- },
-
- /*************************************************
- *
- * Broadcast Supporter Methods:
- *
- *************************************************/
-
- /**
- * updateParamValue(newParamValue,urlStr) -- Helping propagate functions to update value to url string.
- * eg. I want to update date value to search query or hash query
- *
- * Expecting:
- * urlStr : A Hash or search query string. e.g: module=whatever&action=index=date=yesterday
- * newParamValue : A param value pair: e.g: date=2009-05-02
- *
- * Return module=whatever&action=index&date=2009-05-02
- *
- * @param {string} newParamValue param to be updated
- * @param {string} urlStr url to be updated
- * @return {string} urlStr with updated param
- */
- updateParamValue: function (newParamValue, urlStr) {
- var p_v = newParamValue.split("=");
-
- var paramName = p_v[0];
- var valFromUrl = broadcast.getParamValue(paramName, urlStr) || broadcast.getParamValue(encodeURIComponent(paramName), urlStr);
- // if set 'idGoal=' then we remove the parameter from the URL automatically (rather than passing an empty value)
- var paramValue = p_v[1];
- if (paramValue == '') {
- newParamValue = '';
- }
- var getQuotedRegex = function(str) {
- return (str+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
- };
-
- if (valFromUrl != '' || urlStr.indexOf(paramName + '=') !== -1) {
- // replacing current param=value to newParamValue;
- valFromUrl = getQuotedRegex(valFromUrl);
- var regToBeReplace = new RegExp(paramName + '=' + valFromUrl, 'ig');
- if (newParamValue == '') {
- // if new value is empty remove leading &, as well
- regToBeReplace = new RegExp('[\&]?(' + paramName + '|' + encodeURIComponent(paramName) + ')=' + valFromUrl, 'ig');
- }
- urlStr = urlStr.replace(regToBeReplace, newParamValue);
- } else if (newParamValue != '') {
- urlStr += (urlStr == '') ? newParamValue : '&' + newParamValue;
- }
-
- return urlStr;
- },
-
- /**
- * Adds a query param value. Use it to add an array parameter value where you don't want to remove an existing value first.
- *
- * @param newParamValue
- * @param urlStr
- */
- addArrayParamValue: function (newParamValue, urlStr) {
- if (urlStr.indexOf('?') === -1) {
- urlStr += '?';
- } else {
- urlStr += '&';
- }
- return urlStr + newParamValue;
- },
-
- /**
- * Loads a popover by adding a 'popover' query parameter to the current URL and
- * indirectly executing the popover handler.
- *
- * This function should be called to open popovers that can be opened by URL alone.
- * That is, if you want users to be able to copy-paste the URL displayed when a popover
- * is open into a new browser window/tab and have the same popover open, you should
- * call this function.
- *
- * In order for this function to open a popover, there must be a popover handler
- * associated with handlerName. To associate one, call broadcast.addPopoverHandler.
- *
- * @param {String} handlerName The name of the popover handler.
- * @param {String} value The String value that should be passed to the popover
- * handler.
- */
- propagateNewPopoverParameter: function (handlerName, value) {
- var popover = '';
- if (handlerName && '' != value && 'undefined' != typeof value) {
- popover = handlerName + ':' + value;
-
- // between jquery.history and different browser bugs, it's impossible to ensure
- // that the parameter is en- and decoded the same number of times. in order to
- // make sure it doesn't change, we have to manipulate the url encoding a bit.
- popover = encodeURIComponent(popover);
- popover = popover.replace(/%/g, '\$');
-
- broadcast.popoverParamStack.push(popover);
- } else {
- broadcast.popoverParamStack.pop();
- if (broadcast.popoverParamStack.length) {
- popover = broadcast.popoverParamStack[broadcast.popoverParamStack.length - 1];
- }
- }
-
- var MatomoUrl = window.CoreHome.MatomoUrl;
- MatomoUrl.updateHash(
- Object.assign({}, MatomoUrl.hashParsed.value, { popover }),
- );
- },
-
- /**
- * Resets the popover param stack ensuring when a popover is closed, no new popover will
- * be loaded.
- */
- resetPopoverStack: function () {
- broadcast.popoverParamStack = [];
- },
-
- /**
- * Adds a handler for the 'popover' query parameter.
- *
- * @see broadcast#propagateNewPopoverParameter
- *
- * @param {String} handlerName The handler name, eg, 'visitorProfile'. Should identify
- * the popover that the callback will open up.
- * @param {Function} callback This function should open the popover. It should take
- * one string parameter.
- */
- addPopoverHandler: function (handlerName, callback) {
- broadcast.popoverHandlers[handlerName] = callback;
- },
-
- /**
- * Loads the given url with ajax and replaces the content
- *
- * Note: the method is replaced in Overlay/javascripts/Piwik_Overlay.js - keep this in mind when making changes.
- *
- * @param {string} urlAjax url to load
- * @return {Boolean}
- */
- loadAjaxContent: function (urlAjax) {
- if(broadcast.getParamValue('module', urlAjax) == 'API') {
- broadcast.lastUrlRequested = null;
- $('#content').html("Loading content from the API and displaying it within Matomo is not allowed.");
- piwikHelper.hideAjaxLoading();
- return false;
- }
-
- piwikHelper.hideAjaxError('loadingError');
- piwikHelper.showAjaxLoading();
- $('#content').empty();
- $("object").remove();
-
- urlAjax = urlAjax.match(/^\?/) ? urlAjax : "?" + urlAjax;
- broadcast.lastUrlRequested = urlAjax;
-
- function sectionLoaded(content, status, request) {
- if (request) {
- var responseHeader = request.getResponseHeader('Content-Type');
- if (responseHeader && 0 <= responseHeader.toLowerCase().indexOf('json')) {
- var message = 'JSON cannot be displayed for';
- if (this.getParams && this.getParams['module']) {
- message += ' module=' + this.getParams['module'];
- }
- if (this.getParams && this.getParams['action']) {
- message += ' action=' + this.getParams['action'];
- }
- $('#content').text(message);
- piwikHelper.hideAjaxLoading();
- return;
- }
- }
-
- // if content is whole HTML document, do not show it, otherwise recursive page load could occur
- var htmlDocType = '= 0) {
- url = url.slice(url.indexOf('?')+1);
- }
-
- var urlPieces = url.split('&');
-
- // look for the latest occurrence of the parameter if available
- for (var i=urlPieces.length-1; i>=0; i--) {
- if (urlPieces[i].indexOf(lookFor) === 0) {
- return getSingleValue(urlPieces[i]);
- }
- }
-
- // gather parameter array if available
- lookFor = param + '[]=';
- var result = [];
- for (var j=0; j!@\$\.()=,;0-9a-zA-Z]/gi, '');
- }
- return value;
- }
- },
-
- /**
- * Returns the hash without the starting #
- * @return {string} hash part of the current url
- */
- getHash: function () {
- return broadcast.getHashFromUrl().replace(/^#/, '').split('#')[0];
- },
-
- /**
- * Removes the hash portion of a URL and returns the rest.
- *
- * @param {string} url
- * @return {string} url w/o hash
- */
- _removeHashFromUrl: function (url) {
- var searchString = '';
- if (url) {
- var urlParts = url.split('#');
- searchString = urlParts[0];
- } else {
- searchString = window.location.search;
- }
- return searchString;
- }
-};
-
-window.broadcast = broadcast; // hack to get broadcast to work in vue (jest) tests
diff --git a/plugins/CoreHome/javascripts/broadcast.spec.js b/plugins/CoreHome/javascripts/broadcast.spec.js
deleted file mode 100644
index 139850a741cf58ae243deea68f0070cc4615955b..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/javascripts/broadcast.spec.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- * Matomo - free/libre analytics platform
- *
- * @link https://matomo.org
- * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-(function () {
- describe('broadcast', function () {
-
- var tests = [
- { url: 'http://matomo.org/index.php?param=val', param: 'param', expectedValue: 'val' },
- { url: 'http://matomo.org/index.php?param=val', param: 'custom', expectedValue: '' },
- { url: 'http://matomo.org/index.php?myparam=test¶m=val', param: 'param', expectedValue: 'val' },
- { url: 'http://matomo.org/index.php?param=val&myparam=test', param: 'param', expectedValue: 'val' },
- { url: 'http://matomo.org/index.php?param=val¶m=val2', param: 'param', expectedValue: 'val2' },
- { url: 'http://matomo.org/index.php?param[]=val&myparam[]=x¶m[]=val2', param: 'param', expectedValue: ['val', 'val2'] },
- ];
-
- tests.forEach(function(test,index) {
- it('should return correct parameters with getParamValue ' + (index+1), function () {
- expect(broadcast.getParamValue(test.param, test.url)).to.deep.equal(test.expectedValue);
- });
- });
- });
-})();
diff --git a/plugins/CoreHome/javascripts/calendar.js b/plugins/CoreHome/javascripts/calendar.js
deleted file mode 100644
index 8921f1eab63e8e256741a5b7d7e4cd4efada5b3a..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/javascripts/calendar.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*!
- * Matomo - free/libre analytics platform
- *
- * @link https://matomo.org
- * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-(function ($) {
- // min/max date for picker
- var piwikMinDate = new Date(piwik.minDateYear, piwik.minDateMonth - 1, piwik.minDateDay),
- piwikMaxDate = new Date(piwik.maxDateYear, piwik.maxDateMonth - 1, piwik.maxDateDay);
-
- piwik.getBaseDatePickerOptions = function (defaultDate) {
- return {
- showOtherMonths: false,
- dateFormat: 'yy-mm-dd',
- firstDay: 1,
- minDate: piwikMinDate,
- maxDate: piwikMaxDate,
- prevText: "",
- nextText: "",
- currentText: "",
- defaultDate: defaultDate,
- changeMonth: true,
- changeYear: true,
- stepMonths: 1,
- // jquery-ui-i18n 1.7.2 lacks some translations, so we use our own
- dayNamesMin: [
- _pk_translate('Intl_Day_Min_StandAlone_7'),
- _pk_translate('Intl_Day_Min_StandAlone_1'),
- _pk_translate('Intl_Day_Min_StandAlone_2'),
- _pk_translate('Intl_Day_Min_StandAlone_3'),
- _pk_translate('Intl_Day_Min_StandAlone_4'),
- _pk_translate('Intl_Day_Min_StandAlone_5'),
- _pk_translate('Intl_Day_Min_StandAlone_6')],
- dayNamesShort: [
- _pk_translate('Intl_Day_Short_StandAlone_7'), // start with sunday
- _pk_translate('Intl_Day_Short_StandAlone_1'),
- _pk_translate('Intl_Day_Short_StandAlone_2'),
- _pk_translate('Intl_Day_Short_StandAlone_3'),
- _pk_translate('Intl_Day_Short_StandAlone_4'),
- _pk_translate('Intl_Day_Short_StandAlone_5'),
- _pk_translate('Intl_Day_Short_StandAlone_6')],
- dayNames: [
- _pk_translate('Intl_Day_Long_StandAlone_7'), // start with sunday
- _pk_translate('Intl_Day_Long_StandAlone_1'),
- _pk_translate('Intl_Day_Long_StandAlone_2'),
- _pk_translate('Intl_Day_Long_StandAlone_3'),
- _pk_translate('Intl_Day_Long_StandAlone_4'),
- _pk_translate('Intl_Day_Long_StandAlone_5'),
- _pk_translate('Intl_Day_Long_StandAlone_6')],
- monthNamesShort: [
- _pk_translate('Intl_Month_Short_StandAlone_1'),
- _pk_translate('Intl_Month_Short_StandAlone_2'),
- _pk_translate('Intl_Month_Short_StandAlone_3'),
- _pk_translate('Intl_Month_Short_StandAlone_4'),
- _pk_translate('Intl_Month_Short_StandAlone_5'),
- _pk_translate('Intl_Month_Short_StandAlone_6'),
- _pk_translate('Intl_Month_Short_StandAlone_7'),
- _pk_translate('Intl_Month_Short_StandAlone_8'),
- _pk_translate('Intl_Month_Short_StandAlone_9'),
- _pk_translate('Intl_Month_Short_StandAlone_10'),
- _pk_translate('Intl_Month_Short_StandAlone_11'),
- _pk_translate('Intl_Month_Short_StandAlone_12')],
- monthNames: [
- _pk_translate('Intl_Month_Long_StandAlone_1'),
- _pk_translate('Intl_Month_Long_StandAlone_2'),
- _pk_translate('Intl_Month_Long_StandAlone_3'),
- _pk_translate('Intl_Month_Long_StandAlone_4'),
- _pk_translate('Intl_Month_Long_StandAlone_5'),
- _pk_translate('Intl_Month_Long_StandAlone_6'),
- _pk_translate('Intl_Month_Long_StandAlone_7'),
- _pk_translate('Intl_Month_Long_StandAlone_8'),
- _pk_translate('Intl_Month_Long_StandAlone_9'),
- _pk_translate('Intl_Month_Long_StandAlone_10'),
- _pk_translate('Intl_Month_Long_StandAlone_11'),
- _pk_translate('Intl_Month_Long_StandAlone_12')]
- };
- };
-
- piwikHelper.registerShortcut('d', _pk_translate('CoreHome_ShortcutCalendar'), function(event) {
- if (event.altKey) {
- return;
- }
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- event.returnValue = false; // IE
- }
- $('#periodString .title').trigger('click').focus();
- });
-
-}(jQuery));
diff --git a/plugins/CoreHome/javascripts/color_manager.js b/plugins/CoreHome/javascripts/color_manager.js
deleted file mode 100644
index 1fde9dfe4c07123a97bbe9a6f2ebf2d895c31821..0000000000000000000000000000000000000000
--- a/plugins/CoreHome/javascripts/color_manager.js
+++ /dev/null
@@ -1,225 +0,0 @@
-/*!
- * Matomo - free/libre analytics platform
- *
- * @link https://matomo.org
- * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-
-(function ($) {
-
- var colorNames = {"aliceblue":"#f0f8ff","antiquewhite":"#faebd7","aqua":"#00ffff","aquamarine":"#7fffd4","azure":"#f0ffff",
- "beige":"#f5f5dc","bisque":"#ffe4c4","black":"#000000","blanchedalmond":"#ffebcd","blue":"#0000ff","blueviolet":"#8a2be2","brown":"#a52a2a","burlywood":"#deb887",
- "cadetblue":"#5f9ea0","chartreuse":"#7fff00","chocolate":"#d2691e","coral":"#ff7f50","cornflowerblue":"#6495ed","cornsilk":"#fff8dc","crimson":"#dc143c","cyan":"#00ffff",
- "darkblue":"#00008b","darkcyan":"#008b8b","darkgoldenrod":"#b8860b","darkgray":"#a9a9a9","darkgreen":"#006400","darkkhaki":"#bdb76b","darkmagenta":"#8b008b","darkolivegreen":"#556b2f",
- "darkorange":"#ff8c00","darkorchid":"#9932cc","darkred":"#8b0000","darksalmon":"#e9967a","darkseagreen":"#8fbc8f","darkslateblue":"#483d8b","darkslategray":"#2f4f4f","darkturquoise":"#00ced1",
- "darkviolet":"#9400d3","deeppink":"#ff1493","deepskyblue":"#00bfff","dimgray":"#696969","dodgerblue":"#1e90ff",
- "firebrick":"#b22222","floralwhite":"#fffaf0","forestgreen":"#228b22","fuchsia":"#ff00ff","gainsboro":"#dcdcdc","ghostwhite":"#f8f8ff","gold":"#ffd700","goldenrod":"#daa520","gray":"#808080","green":"#43a047","greenyellow":"#adff2f",
- "honeydew":"#f0fff0","hotpink":"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082","ivory":"#fffff0","khaki":"#f0e68c",
- "lavender":"#e6e6fa","lavenderblush":"#fff0f5","lawngreen":"#7cfc00","lemonchiffon":"#fffacd","lightblue":"#add8e6","lightcoral":"#f08080","lightcyan":"#e0ffff","lightgoldenrodyellow":"#fafad2",
- "lightgrey":"#d3d3d3","lightgreen":"#90ee90","lightpink":"#ffb6c1","lightsalmon":"#ffa07a","lightseagreen":"#20b2aa","lightskyblue":"#87cefa","lightslategray":"#778899","lightsteelblue":"#b0c4de",
- "lightyellow":"#ffffe0","lime":"#00ff00","limegreen":"#32cd32","linen":"#faf0e6","magenta":"#ff00ff","maroon":"#800000","mediumaquamarine":"#66cdaa","mediumblue":"#0000cd","mediumorchid":"#ba55d3","mediumpurple":"#9370d8","mediumseagreen":"#3cb371","mediumslateblue":"#7b68ee",
- "mediumspringgreen":"#00fa9a","mediumturquoise":"#48d1cc","mediumvioletred":"#c71585","midnightblue":"#191970","mintcream":"#f5fffa","mistyrose":"#ffe4e1","moccasin":"#ffe4b5",
- "navajowhite":"#ffdead","navy":"#000080","oldlace":"#fdf5e6","olive":"#808000","olivedrab":"#6b8e23","orange":"#ffa500","orangered":"#ff4500","orchid":"#da70d6",
- "palegoldenrod":"#eee8aa","palegreen":"#98fb98","paleturquoise":"#afeeee","palevioletred":"#d87093","papayawhip":"#ffefd5","peachpuff":"#ffdab9","peru":"#cd853f","pink":"#ffc0cb","plum":"#dda0dd","powderblue":"#b0e0e6","purple":"#800080",
- "red":"#ff0000","rosybrown":"#bc8f8f","royalblue":"#4169e1","saddlebrown":"#8b4513","salmon":"#fa8072","sandybrown":"#f4a460","seagreen":"#2e8b57","seashell":"#fff5ee","sienna":"#a0522d","silver":"#c0c0c0","skyblue":"#87ceeb","slateblue":"#6a5acd","slategray":"#708090","snow":"#fffafa","springgreen":"#00ff7f","steelblue":"#4682b4",
- "tan":"#d2b48c","teal":"#008080","thistle":"#d8bfd8","tomato":"#ff6347","turquoise":"#40e0d0","violet":"#ee82ee","wheat":"#f5deb3","white":"#ffffff","whitesmoke":"#f5f5f5","yellow":"#ffff00","yellowgreen":"#9acd32"};
-
- /**
- * The ColorManager class allows JS code to grab colors defined in CSS for
- * components that don't manage HTML (like jqPlot or sparklines). Such components
- * can't use CSS colors directly since the colors are used to generate images
- * or by