From 539af322a15fcf9bff42c9a2d0defdce58fdbccd Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 9 Feb 2019 00:53:02 -0500 Subject: [PATCH] Afform.revert - Refuse to revert if there are no "where" constraints Bulk reverting everything would be... a bit... dangerous? --- ext/afform/core/Civi/Api4/Action/Afform/Revert.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Revert.php b/ext/afform/core/Civi/Api4/Action/Afform/Revert.php index f194e6f175..377dd2683a 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Revert.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Revert.php @@ -9,6 +9,10 @@ class Revert extends Get { protected $select = ['name']; public function _run(Result $result) { + if (empty($this->where)) { + throw new \API_Exception('Cannot revert with no "where" paramater specified'); + } + $scanner = \Civi::service('afform_scanner'); parent::_run($result); -- 2.25.1