-
Notifications
You must be signed in to change notification settings - Fork 22
Adds ability to send alerts to MicrosoftTeams Channel, #PG-4671 #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?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\Plugins\CustomAlerts; | ||
|
|
||
| use Piwik\Common; | ||
| use Piwik\Updater; | ||
| use Piwik\Updater\Migration\Factory as MigrationFactory; | ||
| use Piwik\Updates; | ||
|
|
||
| /** | ||
| */ | ||
| class Updates_5_2_0 extends Updates | ||
| { | ||
| /** | ||
| * @var MigrationFactory | ||
| */ | ||
| private $migration; | ||
|
|
||
| public function __construct(MigrationFactory $factory) | ||
| { | ||
| $this->migration = $factory; | ||
| } | ||
|
|
||
| public function doUpdate(Updater $updater) | ||
| { | ||
| $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); | ||
| } | ||
|
|
||
| public function getMigrations(Updater $updater) | ||
| { | ||
| $alertTableName = Common::prefixTable('alert'); | ||
| $alertTriggeredTableName = Common::prefixTable('alert_triggered'); | ||
|
|
||
| return array( | ||
| $this->migration->db->addColumn('alert', 'ms_teams_webhook_url', 'VARCHAR(500) NULL', 'slack_channel_id'), | ||
| $this->migration->db->addColumn('alert_triggered', 'ms_teams_webhook_url', 'VARCHAR(500) NULL', 'slack_channel_id'), | ||
| ); | ||
|
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe code can be migrated before db is updated, for up to an hour. Codex impact assessment below. I'm not sure what our policy for this stuff is currently - I suspect previously we wouldn't have thought about it, and wouldn't have seen any of the errors. Maybe a good middle ground is to is to fix Model.php only, so that alerts continue working until the schema is updated. A fix would be to check for existence of the column first.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is okay to pass, as we have done similar thing in past and have received very few complaints
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only add//update will be broken, till the time we run the update, existing alerts will keep working. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right - triggerAlert could potentially insert the wrong column, but it's reading from the db in the first place, so never will. |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, don't fix. Use strict.