aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-11-23 17:11:33 +0300
committerValentin Popov <info@valentineus.link>2017-11-23 17:11:33 +0300
commit4f342659d4a83fca265f985bfd999d667d8da217 (patch)
tree3b466ea2606547fa4114b1e9a21b8804b468547b
parent0bc809ba07e16c8d043edb58dde95d5dfaed32d7 (diff)
downloadlocal_webhooks-4f342659d4a83fca265f985bfd999d667d8da217.tar.xz
local_webhooks-4f342659d4a83fca265f985bfd999d667d8da217.zip
Updating external functions
-rw-r--r--index.php2
-rw-r--r--lib.php39
2 files changed, 25 insertions, 16 deletions
diff --git a/index.php b/index.php
index 6d0ef10..8fb92f2 100644
--- a/index.php
+++ b/index.php
@@ -50,7 +50,7 @@ if (boolval($deleteid)) {
}
/* Retrieving a list of services */
-$callbacks = local_webhooks_list_records();
+$callbacks = local_webhooks_get_list_records();
/* Upload settings as a file */
if (boolval($backupservices)) {
diff --git a/lib.php b/lib.php
index 6cffd1b..ab20526 100644
--- a/lib.php
+++ b/lib.php
@@ -25,6 +25,27 @@
defined("MOODLE_INTERNAL") || die();
/**
+ * Getting a list of all services.
+ *
+ * @param number $limitfrom
+ * @param number $limitnum
+ * @return array
+ */
+function local_webhooks_get_list_records($limitfrom = 0, $limitnum = 0) {
+ global $DB;
+
+ $listservices = $DB->get_records("local_webhooks_service", null, "id", "*", $limitfrom, $limitnum);
+
+ foreach ($listservices as $servicerecord) {
+ if (!empty($servicerecord->events)) {
+ $servicerecord->events = local_webhooks_unarchive_data($servicerecord->events);
+ }
+ }
+
+ return $listservices;
+}
+
+/**
* Getting information about the service.
*
* @param number $serviceid
@@ -43,24 +64,12 @@ function local_webhooks_get_record($serviceid = 0) {
}
/**
- * Getting a list of all services.
- *
- * @param number $limitfrom
- * @param number $limitnum
- * @return array
+ * Clear the database table.
*/
-function local_webhooks_list_records($limitfrom = 0, $limitnum = 0) {
+function local_webhooks_remove_list_records() {
global $DB;
- $listservices = $DB->get_records("local_webhooks_service", null, "id", "*", $limitfrom, $limitnum);
-
- foreach ($listservices as $servicerecord) {
- if (!empty($servicerecord->events)) {
- $servicerecord->events = local_webhooks_unarchive_data($servicerecord->events);
- }
- }
-
- return $listservices;
+ $DB->delete_records("local_webhooks_service", null);
}
/**