public function __construct($options = array()) { $enableSSH = false; if (count($options) > 0) { $this->installLocation = $options['installLocation'] . "/ShooterGame/Saved/SavedArks"; if (isset($options['enableSSH'])) { $enableSSH = $options['enableSSH']; } if ($enableSSH === true) { if (!function_exists('ssh2_connect')) { die('You must enable php_ssh2 for your PHP installation to use SSH!'); } } } if (!isset($this->installLocation)) { die('Invalid Settings!'); } $this->Players = array(); $this->Tribes = array(); $Rules = array(); $this->SteamLoaded = false; $this->DataLoaded = false; if ($enableSSH === false) { $this->Timers['App'] = MicroTime(true); $this->playerFiles = glob("{$this->installLocation}/*.arkprofile"); $this->tribeFiles = glob("{$this->installLocation}/*.arktribe"); if (!$this->playerFiles && !$this->tribeFiles) { die('Invalid directory detected, no profiles or tribes found!'); } foreach ($this->playerFiles as $key => $value) { $player = new Player(); $parse = (object) $player->ParsePlayer($value); if (!$parse->Id) { continue; } $this->Players[(string) $parse->Id] = $parse; } foreach ($this->tribeFiles as $key => $value) { $tribe = new Tribe(); $parse = $tribe->ParseTribe($value); if (!$parse->Id) { continue; } $this->Tribes[$parse->Id] = $parse; } } else { if ($this->setupSSH($options['SSHSettings']['host'], @$options['SSHSettings']['port'], $options['SSHSettings']['known_host'], $options['SSHSettings']['pub_key_location'], $options['SSHSettings']['priv_key_location'], $options['SSHSettings']['key_user'], $options['SSHSettings']['cache_dir'])) { $this->Timers['App'] = MicroTime(true); $this->playerFiles = glob($options['SSHSettings']['cache_dir'] . '/*.arkprofile'); $this->tribeFiles = glob($options['SSHSettings']['cache_dir'] . '/*.arktribe'); if (!$this->playerFiles && !$this->tribeFiles) { die('Invalid directory detected, no profiles or tribes found!'); } foreach ($this->playerFiles as $key => $value) { $player = new Player(); $parse = (object) $player->ParsePlayer($value); if (!$parse->Id) { continue; } $this->Players[(string) $parse->Id] = $parse; } foreach ($this->tribeFiles as $key => $value) { $tribe = new Tribe(); $parse = $tribe->ParseTribe($value); if (!$parse->Id) { continue; } $this->Tribes[$parse->Id] = $parse; } } else { die('SSH Failed To Process, please check your logs for any exceptions!'); } } // $this->Timer = MicroTime(true); $this->LinkPlayerTribe(); // $this->Timer = MicroTime(true) - $this->Timer; // $tribe = new Tribe(); // $tribe->ParseTribe($installLocation."/1596232110.arktribe"); $this->Timers['App'] = Number_Format(MicroTime(true) - $this->Timers['App'], 4, '.', ''); }