Testing out downloading and running the Daemon
This commit is contained in:
parent
0dac605bc6
commit
c50904c49c
3 changed files with 50 additions and 4 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -0,0 +1,4 @@
|
||||||
|
# ignore extension-less files
|
||||||
|
*
|
||||||
|
!/**/
|
||||||
|
!*.*
|
|
@ -8,20 +8,62 @@
|
||||||
if (! class_exists('LBRYPress')) {
|
if (! class_exists('LBRYPress')) {
|
||||||
class LBRYPress
|
class LBRYPress
|
||||||
{
|
{
|
||||||
|
// Employ Singleton pattern to preserve single instance
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
public static function get_instance()
|
||||||
|
{
|
||||||
|
if (null == self::$instance) {
|
||||||
|
self::$instance = new self;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create instances of all necessary classes
|
||||||
private $LBRY_Admin;
|
private $LBRY_Admin;
|
||||||
|
|
||||||
public function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
$this->requireDependencies();
|
$this->require_dependencies();
|
||||||
$this->LBRY_Admin = new LBRY_Admin();
|
$this->LBRY_Admin = new LBRY_Admin();
|
||||||
|
|
||||||
|
|
||||||
$this->LBRY_Admin->settings_init();
|
$this->LBRY_Admin->settings_init();
|
||||||
|
|
||||||
|
$this->download_daemon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function requireDependencies()
|
private function require_dependencies()
|
||||||
{
|
{
|
||||||
require_once(LBRY_URI . '/classes/admin/lbry_admin.php');
|
require_once(LBRY_URI . '/classes/admin/lbry_admin.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function download_daemon()
|
||||||
|
{
|
||||||
|
$output_filename = "lbrydaemon";
|
||||||
|
|
||||||
|
$host = "http://build.lbry.io/daemon/build-6788_commit-5099e19_branch-lbryum-refactor/mac/lbrynet";
|
||||||
|
$fp = fopen(LBRY_URI . '/' . $output_filename, 'w+');
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $host);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||||
|
curl_setopt($ch, CURLOPT_AUTOREFERER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||||
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||||
|
|
||||||
|
$result = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
$filepath = LBRY_URI . '/' . $output_filename;
|
||||||
|
|
||||||
|
|
||||||
|
`chmod +x {$filepath}`;
|
||||||
|
error_log(`{$filepath} status`);
|
||||||
|
`{$filepath} start &`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ if (lbry_requirements_met()) {
|
||||||
require_once(dirname(__FILE__) . '/classes/lbrypress.php');
|
require_once(dirname(__FILE__) . '/classes/lbrypress.php');
|
||||||
|
|
||||||
if (class_exists('LBRYPress')) {
|
if (class_exists('LBRYPress')) {
|
||||||
$lbryPress = new LBRYPress();
|
$lbryPress = LBRYPress::get_instance();
|
||||||
// register_activation_hook(__FILE__, array( $lbryPress, 'activate' ));
|
// register_activation_hook(__FILE__, array( $lbryPress, 'activate' ));
|
||||||
// register_deactivation_hook(__FILE__, array( $lbryPress, 'deactivate' ));
|
// register_deactivation_hook(__FILE__, array( $lbryPress, 'deactivate' ));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue