aboutsummaryrefslogtreecommitdiff
path: root/lib.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2018-03-13 00:01:42 +0300
committerValentin Popov <info@valentineus.link>2018-03-13 00:01:42 +0300
commit82842e5ed85cc51d5024c2abb28b20b1d48ef021 (patch)
tree633c9c6a9bd8dcc42a1f9f51d1b8d106bd53db79 /lib.php
parent98c33a639ae8716ff65b62a561a6d9668be53955 (diff)
downloadlocal_webhooks-82842e5ed85cc51d5024c2abb28b20b1d48ef021.tar.xz
local_webhooks-82842e5ed85cc51d5024c2abb28b20b1d48ef021.zip
Update function 'local_webhooks_change_status'
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'lib.php')
-rw-r--r--lib.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib.php b/lib.php
index 02042ea..9bc8389 100644
--- a/lib.php
+++ b/lib.php
@@ -38,11 +38,8 @@ require_once(__DIR__ . "/locallib.php");
function local_webhooks_change_status($serviceid) {
global $DB;
- $result = false;
- if ($record = local_webhooks_get_record($serviceid)) {
- $record->enable = !boolval($record->enable);
- $result = local_webhooks_update_record($record);
- }
+ $status = $DB->get_field(LOCAL_WEBHOOKS_TABLE_SERVICES, "status", array("id" => $serviceid), IGNORE_MISSING);
+ $result = $DB->set_field(LOCAL_WEBHOOKS_TABLE_SERVICES, "status", !boolval($status), array("id" => $serviceid));
return $result;
}