From cf170edeb2ccddadda1e609ea68a24bc9f989e68 Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Wed, 13 Aug 2025 10:02:11 +0000
Subject: [PATCH] GS-2251

---
 lib/libIlias.js |   12 ++++++++++++
 bin/pingPhp.js  |   21 +++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/bin/pingPhp.js b/bin/pingPhp.js
new file mode 100644
index 0000000..904e05e
--- /dev/null
+++ b/bin/pingPhp.js
@@ -0,0 +1,21 @@
+const db = require("../lib/db")
+const yargs = require("yargs")
+const libIlias = require("../lib/libIlias")
+
+/////////////////////////////////////////////////////////////////////////
+
+const argv = yargs
+   .usage("$0", "ping ilias php",)
+   .strict()
+   .parse()
+
+
+run(argv)
+   .then(console.log)
+   .catch(console.error)
+   .finally(process.exit)
+
+async function run ({}) {
+   return libIlias.ping()
+}
+
diff --git a/lib/libIlias.js b/lib/libIlias.js
index 4d8e7c2..0babefb 100644
--- a/lib/libIlias.js
+++ b/lib/libIlias.js
@@ -9,6 +9,8 @@
 /////////////////////////////////////////////////////////////////////////
 
 module.exports = {
+   ping,
+
    getUser,
 
    importIliasUser,
@@ -27,6 +29,16 @@
 
 /////////////////////////////////////////////////////////////////////////
 
+async function ping() {
+   const sp = new URLSearchParams({
+      command: "ping",
+      token: iliastoken,
+   })
+   let url2 = `${url}?${sp.toString()}`
+   const res = await fetch(url2, {method: "GET"})
+   return await res.json() //
+}
+
 /////// GET USER ////////////////////////////////////////////////////////////////
 async function getUser (usr_id) {
    const sp = new URLSearchParams({

--
Gitblit v1.8.0