Updated the status change function
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
279fca5ed1
commit
41a6a89ac8
10
lib.php
10
lib.php
@ -32,15 +32,21 @@ require_once(__DIR__ . "/locallib.php");
|
|||||||
/**
|
/**
|
||||||
* Change the status of the service.
|
* Change the status of the service.
|
||||||
*
|
*
|
||||||
* @param number $serviceid
|
* @param number $serviceid Service identifier
|
||||||
* @return boolean
|
* @return boolean The result of the operation
|
||||||
*/
|
*/
|
||||||
function local_webhooks_change_status($serviceid) {
|
function local_webhooks_change_status($serviceid) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
|
/* Gets the current status */
|
||||||
$status = $DB->get_field(LOCAL_WEBHOOKS_TABLE_SERVICES, "status", array("id" => $serviceid), IGNORE_MISSING);
|
$status = $DB->get_field(LOCAL_WEBHOOKS_TABLE_SERVICES, "status", array("id" => $serviceid), IGNORE_MISSING);
|
||||||
|
|
||||||
|
/* Changes the status to the opposite */
|
||||||
$result = $DB->set_field(LOCAL_WEBHOOKS_TABLE_SERVICES, "status", !boolval($status), array("id" => $serviceid));
|
$result = $DB->set_field(LOCAL_WEBHOOKS_TABLE_SERVICES, "status", !boolval($status), array("id" => $serviceid));
|
||||||
|
|
||||||
|
/* Clears the cache */
|
||||||
|
local_webhooks_cache_reset();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user