From 920591a171a711b7e74703dd846e7511d945cc4a Mon Sep 17 00:00:00 2001 From: Paul Kirby Date: Mon, 17 Feb 2020 20:02:27 -0600 Subject: [PATCH] Initial attempt at starting daemon in background --- classes/LBRY_Daemon.php | 17 +++++++++++++---- templates/help_page.php | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/classes/LBRY_Daemon.php b/classes/LBRY_Daemon.php index d54eda9..76e7871 100644 --- a/classes/LBRY_Daemon.php +++ b/classes/LBRY_Daemon.php @@ -38,8 +38,9 @@ class LBRY_Daemon $this->notice = new LBRY_Admin_Notice(); $this->daemon_running = $this->test_daemon(); - if (!$this->daemon_running && !$this->start_daemon()) { - $this->notice->set_notice('error', 'Cannot connect to the LBRY Daemon. Click HERE for help.'); + if (!$this->daemon_running) { + $this->start_daemon(); + $this->notice->set_notice('error', 'Cannot connect to the LBRY Daemon. Attempting to start server.
If you are still having troubles, click HERE for help.'); } } @@ -60,11 +61,19 @@ class LBRY_Daemon /** * Attempts to start the daemon - * @return bool True on success */ private function start_daemon() { - return false; + $response = popen(ABSPATH . '/lbrynet start', "w"); + error_log(print_r($response)); + } + + /** + * Attempts to start the daemon + */ + private function stop_daemon() + { + exec(ABSPATH . '/lbrynet stop &'); } /** diff --git a/templates/help_page.php b/templates/help_page.php index dfe2445..f1d6a77 100644 --- a/templates/help_page.php +++ b/templates/help_page.php @@ -9,7 +9,7 @@

Usage

-

By default, `lbrynet` will provide a JSON-RPC server at `http://localhost:5279`. This is the address our plugin will be expecting to use.

+

By default, lbrynet will provide a JSON-RPC server at http://localhost:5279. This is the address our plugin will be expecting to use.

If curious, The full API is documented here

SDK Github