diff options
author | Stefan Giehl <stefan@matomo.org> | 2022-04-12 10:17:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-12 10:17:04 +0300 |
commit | c45534af3667986cb7b282111f2e683e94fa44c7 (patch) | |
tree | 44045e18567a48defa8bea848493e8fa11cb548f /core | |
parent | 5d8f340a1f114f76d246660710cee113c735540f (diff) |
Adds update script to remove broken scheduled reports from db (#19062)
* Adds update script to remove broken scheduled reports from db
* Update core/Updates/4.10.0-b1.php
Co-authored-by: Ben Burgess <88810029+bx80@users.noreply.github.com>
Co-authored-by: Ben Burgess <88810029+bx80@users.noreply.github.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Updates/4.10.0-b1.php | 61 | ||||
-rw-r--r-- | core/Version.php | 3 |
2 files changed, 63 insertions, 1 deletions
diff --git a/core/Updates/4.10.0-b1.php b/core/Updates/4.10.0-b1.php new file mode 100644 index 0000000000..df8d408041 --- /dev/null +++ b/core/Updates/4.10.0-b1.php @@ -0,0 +1,61 @@ +<?php + +/** + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ + +namespace Piwik\Updates; + +use Piwik\Common; +use Piwik\Db; +use Piwik\Updater; +use Piwik\Updates as PiwikUpdates; +use Piwik\Updater\Migration; +use Piwik\Updater\Migration\Factory as MigrationFactory; + +/** + * Update for version 4.10.0-b1 + */ +class Updates_4_10_0_b1 extends PiwikUpdates +{ + /** + * @var MigrationFactory + */ + private $migration; + + public function __construct(MigrationFactory $factory) + { + $this->migration = $factory; + } + + /** + * @param Updater $updater + * + * @return Migration[] + */ + public function getMigrations(Updater $updater) + { + $table = Common::prefixTable('report'); + $invalidCount = Db::fetchOne( + "SELECT COUNT(*) FROM $table WHERE reports = ? OR parameters = ?", + ['Array', 'Array'] + ); + + if (0 === (int) $invalidCount) { + return []; + } + + return [ + $this->migration->db->sql("DELETE FROM " . $table . " WHERE reports = 'Array' OR parameters = 'Array'") + ]; + } + + public function doUpdate(Updater $updater) + { + $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); + } +} diff --git a/core/Version.php b/core/Version.php index 2a6a8016e9..9b50b2eed2 100644 --- a/core/Version.php +++ b/core/Version.php @@ -1,4 +1,5 @@ <?php + /** * Matomo - free/libre analytics platform * @@ -20,7 +21,7 @@ final class Version * The current Matomo version. * @var string */ - const VERSION = '4.9.0-rc1'; + const VERSION = '4.10.0-b1'; const MAJOR_VERSION = 4; |