setName('core:matomo550-purge-legacy-annotations'); $this->setDescription( 'Only needed for Matomo 5.5.0-b2 upgrade. ' . 'Purge legacy annotations from option table after migrating them to a separate annotations table.' ); } protected function doExecute(): int { self::purge(); $this->getOutput()->writeln('Done'); return self::SUCCESS; } public static function purge(): void { $migration = StaticContainer::get(MigrationFactory::class); $migrations = []; // remove legacy option table values $migrations[] = $migration->db->sql(self::removeLegacyValuesFromOptionsTableSql()); $updater = StaticContainer::get(Updater::class); $updater->executeMigrations(__FILE__, $migrations); } private static function removeLegacyValuesFromOptionsTableSql(): string { return sprintf("DELETE FROM `%s` WHERE `option_name` LIKE '%%_annotations'", Common::prefixTable('option')); } }